Skip to content

compound_cut multi-tool path produces non-manifold, non-deterministic, incorrect results #747

@andymai

Description

@andymai

Summary

compound_cut (and the equivalent sequential multi-cut path) is only robust for a single tool. With 2+ tools it produces non-manifold, non-deterministic (varies across processes), and geometrically incorrect (under-cut or catastrophically over-cut) results.

This surfaced while root-causing a flaky CI Coverage failure in compound_cut_matches_sequential_4x4_grid.

Evidence

Probed compound_cut(box, [cylinder tools]) with manifold + volume checks across repeated runs:

tools manifold volume expected deterministic?
1 ✅ true 793.99 793.72 ✅ identical every run
2 ❌ flips ~790 787.4 nf 54–59
3 ❌ flips ~784 781.2 nf 90–92
4×4 (16) ~530 ~775 nf 31–187
4×4 box tools 264.7 ~768 deterministic but completely wrong (nf=6, no holes)

So only n=1 is correct. For n≥2 the result is unusable.

Root mechanism

Multi-tool cuts route cylinder-box through the mesh-boolean fallback, which re-triangulates and re-cuts already-faceted geometry. Two compounding problems:

  1. Non-determinism — seed-dependent std::HashMap iteration in the merge/assembly path (signature: identical within a process, varies across processes). One concrete site fixed in this PR (heal::unify_same_domain into_values() ordering), but the under-cutting persists.
  2. Under-cutting / corruption — re-cutting faceted mesh-boolean output repeatedly misses intersections and welds vertices incorrectly, so most holes are not punched through (or the solid is corrupted).

Test debt

The compound_cut_matches_sequential_{2x2,3x3,4x4}_grid and compound_cut_shelled_* tests assert only vol < box * 0.99, which passes on any volume reduction — including garbage. They never validated correctness; they are currently #[ignore]d as flaky. A meaningful regression test can only assert the single-tool case until the multi-tool path is fixed.

Scope

This is GFA-rewrite robustness territory (see the GFA parity / rewrite effort). Fixing it properly likely means routing multi-tool cuts through a single robust pass rather than iterated mesh-boolean co-refinement.

Acceptance criteria

  • compound_cut with N≥2 well-separated tools produces a manifold solid
  • Resulting volume matches box − Σ(tool∩box) within tessellation tolerance
  • Deterministic across processes
  • Re-enable the grid tests with a real volume oracle (not < box*0.99)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions