fix(construction): preserve exact 2D layered strip vertices#486
Conversation
- Add a non-enforcing construction option that returns valid Levels 1-4 triangulations without automatic Level 5 Delaunay repair. - Split exact 2D hull-edge insertions before symbolic perturbation can route them through interior insertion. - Allow explicit simplex imports to opt out of Level 5 validation while keeping strict Delaunay validation as the default. Closes #447
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
WalkthroughAdds exact 2D boundary-edge splitting, embedding-only validation proof flow, conditional final Delaunay enforcement across construction and explicit builder paths, and broad test and fixture updates to the new APIs and vertex macro style. ChangesExact CDT strip construction and validation
Estimated code review effort🎯 5 (Critical) | ⏱️ ~120 minutes Possibly related issues
Possibly related PRs
Suggested labels
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 322 |
🟢 Coverage 97.22% diff coverage · -0.09% coverage variation
Metric Results Coverage variation ✅ -0.09% coverage variation (-1.00%) Diff coverage ✅ 97.22% diff coverage Coverage variation details
Coverable lines Covered lines Coverage Common ancestor commit (f1109b6) 76459 69642 91.08% Head commit (5b1cf5b) 75912 (-547) 69074 (-568) 90.99% (-0.09%) Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch:
<coverage of head commit> - <coverage of common ancestor commit>Diff coverage details
Coverable lines Covered lines Diff coverage Pull request (#486) 3269 3178 97.22% Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified:
<covered lines added or modified>/<coverable lines added or modified> * 100%
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #486 +/- ##
==========================================
- Coverage 91.06% 90.96% -0.10%
==========================================
Files 86 86
Lines 76238 75691 -547
==========================================
- Hits 69423 68855 -568
- Misses 6815 6836 +21
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
Closes #447 - Preserve collinear 2D boundary vertices by splitting localized boundary-edge facets while keeping exact coordinates and labels intact. - Allow exact degenerate batch construction to return after Levels 1-4 validation when final Level 5 Delaunay enforcement is disabled. - Carry explicit simplex validation evidence into construction and reject point-insertion-only options before assembling explicit meshes. - Enforce short vertex fixture construction across non-constructor tests, examples, and benchmarks.
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
semgrep.yaml (1)
1424-1450: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winUse a Rust-aware Semgrep rule here.
The new generic regex still matches embedded string literals and other non-call text because
pattern-not-regexonly skips lines whose first token is a comment or". With the new/src/**/*.rsscope, that will create noisy warnings outside actual constructor calls.Possible rewrite
- languages: - - generic + languages: + - rust @@ - patterns: - - pattern-regex: >- - ^\s*[^\n]*\b(?:delaunay::prelude::)?Vertex\s*(?:::<[^;\n]+>)?\s*::\s*try_new(?:_with_data)?\s*\( - - pattern-not-regex: '^[ \t]*(//|///|/\*|\*|")' + patterns: + - pattern-either: + - pattern: Vertex::try_new(...) + - pattern: Vertex::<...>::try_new(...) + - pattern: Vertex::try_new_with_data(..., ...) + - pattern: Vertex::<...>::try_new_with_data(..., ...) + - pattern: delaunay::prelude::Vertex::try_new(...) + - pattern: delaunay::prelude::Vertex::<...>::try_new(...) + - pattern: delaunay::prelude::Vertex::try_new_with_data(..., ...) + - pattern: delaunay::prelude::Vertex::<...>::try_new_with_data(..., ...)🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@semgrep.yaml` around lines 1424 - 1450, Replace the generic regex-based matcher in this Semgrep rule with a Rust-aware pattern so it only flags real constructor call sites, not embedded strings or other non-call text. Update the rule that targets Vertex::try_new and Vertex::try_new_with_data to use AST-aware Semgrep syntax for Rust, keeping the current paths and intent but ensuring incidental matches in /src/**/*.rs and /tests/**/*.rs are eliminated.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/delaunay/construction.rs`:
- Around line 3981-3986: `finalize_bulk_construction()` is restoring
`delaunay_repair_policy` but not the `use_global_repair_fallback` value that
seeded builders store in `dt.insertion_state`. Update the restore logic in
`finalize_bulk_construction()` (and any related batch-construction cleanup path
it shares) to also copy back `use_global_repair_fallback` from the saved
insertion state so `without_final_delaunay_enforcement()` and
`without_global_repair_fallback()` keep their intended post-build behavior. Use
the existing `final_delaunay.batch_repair_policy()`,
`final_delaunay.enforces_final_delaunay()`, and
`final_delaunay.use_global_repair_fallback()` flow as the reference point when
locating the fix.
---
Nitpick comments:
In `@semgrep.yaml`:
- Around line 1424-1450: Replace the generic regex-based matcher in this Semgrep
rule with a Rust-aware pattern so it only flags real constructor call sites, not
embedded strings or other non-call text. Update the rule that targets
Vertex::try_new and Vertex::try_new_with_data to use AST-aware Semgrep syntax
for Rust, keeping the current paths and intent but ensuring incidental matches
in /src/**/*.rs and /tests/**/*.rs are eliminated.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yml
Review profile: CHILL
Plan: Pro
Run ID: c6bd8e21-a258-4293-a11e-acd784a8112e
📒 Files selected for processing (72)
benches/boundary_uuid_iter.rsbenches/circumsphere_containment.rsjustfilesemgrep.yamlsrc/core/adjacency.rssrc/core/algorithms/flips.rssrc/core/algorithms/incremental_insertion.rssrc/core/algorithms/locate.rssrc/core/algorithms/pl_manifold_repair.rssrc/core/collections/triangulation_maps.rssrc/core/construction.rssrc/core/edge.rssrc/core/facet.rssrc/core/facet_incidence.rssrc/core/insertion.rssrc/core/operations.rssrc/core/orientation.rssrc/core/query.rssrc/core/repair.rssrc/core/rollback.rssrc/core/simplex.rssrc/core/tds/equality.rssrc/core/tds/incidence.rssrc/core/tds/mutation.rssrc/core/tds/snapshot.rssrc/core/tds/storage.rssrc/core/tds/validation.rssrc/core/traits/facet_cache.rssrc/core/util/canonical_points.rssrc/core/util/deduplication.rssrc/core/util/facet_keys.rssrc/core/util/facet_utils.rssrc/core/util/jaccard.rssrc/core/vertex.rssrc/delaunay/builder.rssrc/delaunay/construction.rssrc/delaunay/delaunayize.rssrc/delaunay/flips.rssrc/delaunay/locality.rssrc/delaunay/query.rssrc/delaunay/repair.rssrc/delaunay/rollback.rssrc/delaunay/serialization.rssrc/geometry/algorithms/convex_hull.rssrc/geometry/quality.rssrc/geometry/robust_predicates.rssrc/geometry/util/conversions.rssrc/geometry/util/measures.rssrc/geometry/util/triangulation_generation.rssrc/lib.rssrc/topology/characteristics/euler.rssrc/topology/manifold.rssrc/topology/ridge.rssrc/topology/traits/global_topology_model.rstests/circumsphere_debug_tools.rstests/dedup_batch_construction.rstests/delaunay_edge_cases.rstests/delaunay_repair_fallback.rstests/delaunayize_workflow.rstests/euler_characteristic.rstests/example_workflows.rstests/insert_with_statistics.rstests/large_scale_debug.rstests/pachner_roundtrip.rstests/proptest_delaunay_triangulation.rstests/proptest_euler_characteristic.rstests/proptest_flips.rstests/proptest_triangulation.rstests/proptest_vertex.rstests/public_topology_api.rstests/regressions.rstests/triangulation_builder.rs
✅ Files skipped from review due to trivial changes (28)
- src/topology/traits/global_topology_model.rs
- src/core/collections/triangulation_maps.rs
- src/core/repair.rs
- src/topology/characteristics/euler.rs
- benches/circumsphere_containment.rs
- src/core/adjacency.rs
- src/geometry/util/triangulation_generation.rs
- src/core/util/deduplication.rs
- src/core/util/canonical_points.rs
- src/topology/ridge.rs
- src/core/operations.rs
- benches/boundary_uuid_iter.rs
- src/core/util/jaccard.rs
- src/delaunay/serialization.rs
- src/delaunay/flips.rs
- src/geometry/robust_predicates.rs
- src/core/algorithms/pl_manifold_repair.rs
- src/core/util/facet_keys.rs
- src/core/tds/equality.rs
- src/delaunay/locality.rs
- src/core/query.rs
- src/core/facet_incidence.rs
- src/geometry/quality.rs
- src/core/tds/snapshot.rs
- src/delaunay/delaunayize.rs
- src/topology/manifold.rs
- src/delaunay/query.rs
- src/core/vertex.rs
🚧 Files skipped from review as they are similar to previous changes (3)
- tests/regressions.rs
- src/core/insertion.rs
- src/delaunay/builder.rs
- Restore seeded construction finalization from the final Delaunay policy so returned triangulations keep the intended repair and global-fallback behavior. - Keep the workflow vertex-macro guardrail Rust-AST aware so it only flags real Vertex constructor calls. Closes #447
There was a problem hiding this comment.
🧹 Nitpick comments (1)
tests/semgrep/src/project_rules/workflow_vertex_macro.rs (1)
29-37: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd a fixture for the qualified
delaunay::prelude::Vertexbranch.Line 1453 now explicitly matches both bare
Vertexanddelaunay::prelude::Vertex, but this fixture file only exercises the bare form. Adding one bad case for the qualified path would keep that new regex branch from going untested.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@tests/semgrep/src/project_rules/workflow_vertex_macro.rs` around lines 29 - 37, Add a semgrep fixture that exercises the qualified delaunay::prelude::Vertex path, since workflow_vertex_text_ok and workflow_vertex_constructor_with_data_bad only cover the bare Vertex form. Introduce one bad case using the fully qualified constructor/macro pattern so the new regex branch in the workflow vertex rule is actually tested alongside the existing bare Vertex coverage.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@tests/semgrep/src/project_rules/workflow_vertex_macro.rs`:
- Around line 29-37: Add a semgrep fixture that exercises the qualified
delaunay::prelude::Vertex path, since workflow_vertex_text_ok and
workflow_vertex_constructor_with_data_bad only cover the bare Vertex form.
Introduce one bad case using the fully qualified constructor/macro pattern so
the new regex branch in the workflow vertex rule is actually tested alongside
the existing bare Vertex coverage.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yml
Review profile: CHILL
Plan: Pro
Run ID: a2398578-7ffa-4c1b-8043-cb1b82140508
📒 Files selected for processing (3)
semgrep.yamlsrc/delaunay/construction.rstests/semgrep/src/project_rules/workflow_vertex_macro.rs
🚧 Files skipped from review as they are similar to previous changes (1)
- src/delaunay/construction.rs
- Add a workflow vertex-macro fixture for the qualified delaunay::prelude::Vertex constructor path. - Keep the Semgrep rule YAML formatted for the repository config checks.
Closes #447