Skip to content

fix: edge use, face and shell destruction notifications and attribute cleanup (#556) - #631

Merged
bherbruck merged 5 commits into
tangency-labs:mainfrom
embed-3d:fix/topology-destruction-faces-edgeuses-shells
Oct 23, 2026
Merged

bherbruck merged 5 commits into
tangency-labs:mainfrom
embed-3d:fix/topology-destruction-faces-edgeuses-shells

Conversation

@embed-3d

@embed-3d embed-3d commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

The rest of #556, after #628 (edges, merged). Rust now runs the destructors that send SM_NO_DESTRUCTION where it deletes their records, each followed by ~SmAObject's ClearAttributes.

Changes

  • New helpers. Each notifies Notify(SM_NO_DESTRUCTION, this, NULL, NULL) through the object's context (GetContext(): the environment's context, else the kernel's). The notification status is ignored; Unported propagates. Then the record is dropped with what it owns, and ClearAttributes runs.
  • brep_p4:
    • DeleteEdge: its edge uses and the face a manifold delete merges away.
    • DeleteVertex: its vertex shell.
  • brep_p5: the shells GlueVertices deletes.
  • brep_p3 DeleteFace now deletes what upstream deletes (SmBrep.cpp:7072-7546):
    • the easy branch's edge uses, which it only unlinked before (delete pEU; delete pEUMate)
    • the other shell of a region merge (delete pOtherShell)
    • the emptied shell (delete pShell)
    • the last new shell of the nesting pass (delete pLastNewShell)
    • destroy_face now also clears the face's attributes.
  • Not modelled: objects without a notifying destructor (face uses, loops, loop uses, vertices, vertex uses, regions) are removed without ClearAttributes. The whole-B-rep destroy is unchanged. Both are documented in brep::p4's module docs.

Native comparison

The topology.brep_p3 recorders (shim and runner) count SM_NO_DESTRUCTION per caller kind: edge, edge use, face and shell. DeleteFace records end with the four counts.

  • All 90 delface cases agree.
  • Counter-check: with only the brep_p4 changes, 23 failed (edge use 8 vs 4, shell 2 vs 1, …). After the first DeleteFace round, 3 still failed on the last-new-shell deletion, now fixed.

Tests

edgeuse_shell_and_face_destructors_notify_and_clear_attributes uses a wire edge use, its wire shell and a face, all sharing one reference attribute with a surviving edge:

  • Each destructor sends one destruction per callback.
  • The records leave their arenas.
  • Only the survivor stays an attribute user.

Difftest (macOS arm64, pinned c9c5979)

Full run over every green/partial unit except topology.brep_data (macOS hang, #450), compared unit by unit with main's CI reports (run 39982203560, b35cd5ac7):

After merging main 246172b5e:

PARTIAL topology.brep_p3 cases=897 passed=812 failed=0 deferred=85 max_rel_err=0e0
PARTIAL topology.brep_p4 cases=327 passed=290 failed=0 deferred=22 max_rel_err=0e0
PARTIAL topology.brep_p5 cases=797 passed=785 failed=0 deferred=12 max_rel_err=0e0
PARTIAL topology.brep_p7 cases=348 passed=285 failed=0 deferred=63 max_rel_err=0e0
PASS heal.stitch_p1 cases=300 passed=300 failed=0 deferred=0 max_rel_err=0e0
PASS heal.stitch_p2 cases=556 passed=556 failed=0 deferred=0 max_rel_err=0e0

Also run: cargo fmt --all --check, cargo clippy --workspace --all-targets -- -D warnings, the same with -p difftest --features cpp, cargo test -p solidcore (2063) and the wasm check. No tolerance or guard changed.

Overlap: #613 and #335 edit other hunks of brep/p3.rs, p4.rs, p5.rs and shell.rs (stitch_faces, stitch_and_orient, ray-world code).

🤖 Generated with Claude Code

https://claude.ai/code/session_01TYEpC4tUKxEP3MCaFL5Kz2

embed-3d and others added 4 commits October 23, 2026 18:03
…fications (tangency-labs#556)

- edgeuse::p2::destroy (~SmEdgeuse), face::p3::destroy (~SmFace) and
  shell::destroy (~SmShell): SM_NO_DESTRUCTION through the object's context
  (status ignored, Unported propagates), the record dropped with what it owns,
  then ~SmAObject's ClearAttributes. edge::with_object_context is shared with
  edge::destroy.
- brep_p4: DeleteEdge's edge uses and merged-away face, DeleteVertex's vertex
  shell. brep_p5: GlueVertices' shells. brep_p3 DeleteFace now deletes what
  upstream deletes there: the easy branch's edge uses (it only unlinked them),
  the other shell of a region merge, the emptied shell and the last new shell
  of the nesting pass; destroy_face also clears the face's attributes.
- difftest: the brep_p3 recorders count SM_NO_DESTRUCTION per caller kind
  (edge, edge use, face, shell); DeleteFace records end with the four counts.
  All 90 delface cases agree (23 failed with only the brep_p4 changes).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TYEpC4tUKxEP3MCaFL5Kz2
…logy.brep_p4)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TYEpC4tUKxEP3MCaFL5Kz2
@embed-3d embed-3d changed the title fix: face, edge use and shell destruction notifications and attribute cleanup (#556, stacked on #628) fix: edge use, face and shell destruction notifications and attribute cleanup (#556) Oct 23, 2026
@embed-3d
embed-3d marked this pull request as ready for review October 23, 2026 17:26
@bherbruck
bherbruck added this pull request to the merge queue Oct 23, 2026
Merged via the queue into tangency-labs:main with commit 0123d56 Oct 23, 2026
7 checks passed
oursland added a commit to oursland/solidcore that referenced this pull request Oct 23, 2026
Picks up tangency-labs#599 (G3 runner handles) and tangency-labs#631 (face/edge-use/shell
destructors), so the PR's plan statuses and case set match the base
commit whose reports the ratchet will use.

Local checks after the merge: cargo fmt --all --check, cargo clippy
--workspace --all-targets -D warnings, cargo test -p difftest --lib
(53 passed).

Co-Authored-By: Claude Code <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants