Skip to content

difftest: run primitive.primitive_creation_p2 through the production PrimitiveModel - #623

Merged
bherbruck merged 1 commit into
tangency-labs:mainfrom
embed-3d:wire/primitive-p2-scratch-breps
Oct 23, 2026
Merged

bherbruck merged 1 commit into
tangency-labs:mainfrom
embed-3d:wire/primitive-p2-scratch-breps

Conversation

@embed-3d

Copy link
Copy Markdown
Contributor

Follow-up to #617. The primitive.primitive_creation_p2 runner used a one-B-rep fixture adapter with two problems. First, it could not make the scratch and piece B-reps that skin, taper and planar path need: an UNPORTED(topology.brep_p3) SmBrep::SmBrep stub in the runner, although the constructor is ported. Second, it keyed new faces in its own namespace. The runner now runs every entry point through the production adapter primitive::primitive_creation::model::PrimitiveModel. It also removes ~230 lines of fixture adapter. Library code is unchanged.

Why some former passes now defer

The fixture's face keys (FACE_TYPE, 100000 + 97·i) cannot be resolved to a face by the B-rep caches of the shell ray fire (StitchAndOrient → region split → FindInfiniteRegion → SmShell::RayFire). Those caches therefore solved the faces' surfaces as untrimmed, which is the shortcut SurfaceCache::get_tree refuses for a face-owned surface.

12 pipe, skin and planar-path cases matched C++ only because the record compares status and list sizes, not geometry. To confirm, I changed nothing in the old fixture except its face keys, using the production notify_ref formula. Exactly those 12 then defer at TrimSrfCache::build_tree_with_face for a face-owned surface (passes 196 → 184, surface.trim_srf_cache 6 → 18). With the production adapter they reach the trimmed cache, as C++ does, and defer honestly. Details are in plan/findings.md.

Difftest (macOS arm64, pinned c9c5979, on main 7935b4c09)

before: PARTIAL primitive.primitive_creation_p2 cases=328 passed=196 failed=0 deferred=112 rejected=20 blocked_by=...topology.brep_p3(81)...
after:  PARTIAL primitive.primitive_creation_p2 cases=328 passed=194 failed=0 deferred=114 max_rel_err=0e0 with_values=194 no_values=0 vacuous=0 rejected=20 blocked_by=boolean.merge_p2(34),curve.curve_p2(7),query.face_p1(3),surface.trim_srf_cache(51),topology.face_p2(5),topology.face_p4(14)

Case-by-case against main's CI report:

  • 10 cases that waited for SmBrep::SmBrep now pass.
  • The 12 cases above now defer.
  • No case fails.

The other 71 former SmBrep::SmBrep cases now reach deeper unported calls. The fixture README's deferred table is updated.

Checks: cargo fmt --all --check, cargo clippy --workspace --all-targets -- -D warnings, the same with -p difftest --features cpp, cargo test -p solidcore (2054 passed), cargo test -p difftest and wasm check.

Follow-up, not in this PR

PrimitiveModel::new_merge still returns Unported(SmMerge::SmMerge, boolean.merge_p2) although the unit is ported; that accounts for the 34 taper deferrals. I left it alone because #615 is reworking model.rs.

Related

🤖 Generated with Claude Code

https://claude.ai/code/session_01TYEpC4tUKxEP3MCaFL5Kz2

…PrimitiveModel

The p2 runner's one-B-rep fixture could not make scratch B-reps (an
UNPORTED(topology.brep_p3) SmBrep::SmBrep stub in the runner) and keyed faces in a
namespace the B-rep caches cannot resolve, so the shell ray fire solved
face-owned surfaces as untrimmed. The entry points now run through
primitive::primitive_creation::model::PrimitiveModel.

difftest: 328 cases, 194 bit-identical passes, 0 failed, 114 deferred, 20
rejected. The 81 SmBrep::SmBrep deferrals are gone (10 now pass, the rest reach
deeper unported calls); 12 earlier passes relied on the fixture keys and now
defer at the face-owned trimmed surface cache, like C++ (plan/findings.md).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TYEpC4tUKxEP3MCaFL5Kz2
@bherbruck
bherbruck added this pull request to the merge queue Oct 23, 2026
Merged via the queue into tangency-labs:main with commit bf66780 Oct 23, 2026
7 checks passed
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