Skip to content

Commit 4a419af

Browse files
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 error
1 parent bc7fc0d commit 4a419af

2 files changed

Lines changed: 236 additions & 141 deletions

File tree

proptest-regressions/core/traits/insertion_algorithm.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@
55
# It is recommended to check this file in to source control so that
66
# everyone who runs the test benefits from these saved cases.
77
cc 87a07747781317977c0434e7fa3b29a415e54b0b22c6f3510657229a4daf0bbc # shrinks to vertices_processed = 1, cavity_failures = 0, fallback_uses = 2
8+
cc 49467c2716ef7d552c20f2c532e469f9093e68440f5e5f352c8bb588402a7b4f # shrinks to count = 1

0 commit comments

Comments
 (0)