Commit 4a419af
committed
refactor: Surface duplicate boundary facets as errors instead of silent filtering
Replace silent deduplication with explicit error handling to catch algorithmic
bugs in cavity boundary detection early.
**Breaking API Changes**
- deduplicate_boundary_facet_info: Returns Result<SmallBuffer, InsertionError>
instead of Vec (errors on duplicates, uses SmallBuffer for performance)
- filter_boundary_facets_by_valid_facet_sharing: Returns Result<SmallBuffer>
instead of Vec (propagates errors from facet map building)
- Add InsertionError::DuplicateBoundaryFacets variant with duplicate_count and
total_count fields
**Rationale**
The cavity boundary should form a topological sphere with no duplicate facets.
Duplicates indicate:
- Incorrect neighbor traversal logic
- Non-manifold mesh connectivity
- Data structure corruption
By returning errors instead of silently filtering, we surface these bugs
immediately rather than allowing corrupted triangulations.
**Performance Optimization**
- Use SmallBuffer (stack-allocated, falls back to heap) for typical D+1 facets
- Faster than Vec for small collections (common case in D dimensions)
- Maintains O(n) duplicate detection with FastHashSet
**Implementation Details**
- Propagate DuplicateBoundaryFacets errors through insert_vertex_cavity_based
and create_cells_from_facet_handles
- Update tests to expect errors on duplicates instead of silent filtering
- Rename prop_deduplication_is_idempotent to prop_deduplication_detects_duplicates
- Fix test_create_cells_from_facet_handles_duplicate_handles to assert error1 parent bc7fc0d commit 4a419af
2 files changed
Lines changed: 236 additions & 141 deletions
File tree
- proptest-regressions/core/traits
- src/core/traits
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
0 commit comments