solidcore

Units / boolean

boolean.api_brep partial

Layer
58
Upstream lines
410
Functions
12
Rust module
boolean::api_brep

Status history

Oct 12Nov 25
  1. todo 410 lines
  2. partial 410 lines
  3. green 410 lines
  4. partial 410 lines

Source: crates/solidcore/src/boolean/api_brep.rs

Upstream: source/SM_API/src/SmApiBrep.cpp

Port-plan notes

These notes preserve historical port measurements and limitations, not current CI results.

[2026-11-05 (#1435): PARTIAL, 104 known mismatches: integrating between the surface's knots (WR-494) moves 27 listed cases again within their accuracy (plan/findings/mass.integrator--split-at-surface-knots-default-moves-cases-2026-11-05.md)] [2026-11-05 (#1556 follow-on): PARTIAL, 104 known mismatches: the fifth-order step estimate moves 51 more property cases; the 12 quarter-annulus cases now hold the accuracy (plan/findings/mass.integrator--quadrature-step-estimate-moves-cases-2026-11-05.md)] [2026-11-05 (#1556): PARTIAL, 53 known mismatches: precise properties start each iso-u integral at the trims' lowest v, so face areas and property attributes move (plan/findings/mass.integrator--trim-base-v-default-moves-cases-2026-11-05.md)] 2026-10-30 (#1462 P5): the attributed call takes optional SmApiBooleanWithOptions flags and an SmApiBrepCopy of the first operand (fixtures/boolean.api_brep/attributed_split.json, 102 SLICE / IMPRINT / IMPRINT_CLASSIFY cases): cases=1007 passed=1003 failed=0 rejected=1 parked=3. 2026-10-30 (#1462 P2): merge_breps, boolean_trees and boolean_lists carry the B-reps' own attributes; attributed_list op (19) runs every list/tree/merge_breps fixture tagged (fixtures/boolean.api_brep/attributed_lists.json, 116 cases): cases=905 passed=903 failed=1 (rotational_sweep_region_null_whole, the ND-491 flake on main) rejected=1. 2026-10-29 (#1462 P1, Brep-owned attributes): the two-B-rep entry points seed the merge engine's attribute store from both operands' Brep::add_attribute stores (MergeEngine::seed_operand_attributes) and hand the survivors back to the result and a kept other B-rep (restore_operand_attributes); the boolean cleanup (BooleanPostProcess) now notifies DeleteEdge / DeleteVertex / DeleteTopologicalVertex on the merge's records, attributes and names, so coplanar faces merged by the cleanup keep both origins as upstream; SmApiEdgeComputeLength passes the edge's zone tolerance to the curve length. New fixtures attributed.json (44 cases: boxes, cylinders, sphere, T-pipe; union/difference/intersection, all five behaviours, merge/partial merge/imprint/imprint-classify) compare per face/edge attribute sets against SmLongAttribute-tagged C++ operands. 2026-10-29 (SM_API 1.0.1 parity, batch 1): adds SmApiBooleanWithCurves (boolean_with_curves), SmApiBoolean2d (boolean_2d), SmApiNonManifoldBoolean (non_manifold_boolean) and SmApiPiecewiseMerge (piecewise_merge), plus the runner cases of sweep::api_brep's SmApiNonManifoldSweep / SmApiNonManifoldRotationalSweep (shim ops 11-16, disk operand kind 8, fixtures/boolean.api_brep/smapi_more.json from TestSmBrep.cpp, and a separate more generated stream of MIN_GENERATED_MORE = 160 so every gen case is unchanged). Summary line: PENDING (builder run). pRegionBrep is ported (sweep::api_brep::RegionBrep, the region argument of both wrappers) and compared: fixtures NULL, the swept B-rep and a second B-rep (SM_ERR_INVALID_INPUT at SmApiBrep.cpp:1822 / :1881) for each wrapper, generated cases draw all three. Not covered: a stale selection handle (TestNonManifoldSweepStaleEntry; the shim cannot hold a freed handle). 2026-10-25 (promoted to green alongside boolean.merge_p3 / Issue #832): PASS boolean.api_brep cases=287 passed=279 failed=0 deferred=0 max_rel_err=0e0 with_values=279 no_values=0 vacuous=0 rejected=8; SENSITIVE 279/279. 2026-10-24 (FaceIntersect homogenizes on the lent B-reps): after merging main with #816, of the 33 read-only trimmed-cache deferrals 29 pass, 2 are rejected (UB-175 on the Rust side) and 2 defer at smsurf_GetSurfaceCache tolerance-growth history (surface.surface_p2): PARTIAL boolean.api_brep cases=287 passed=265 failed=0 deferred=14 rejected=8 (was 236 passed, 45 deferred, 6 rejected). 2026-10-24 (MakeEdgeInFace through the owning B-rep): SmEdgeDefinition::Imprint runs SmBrep::MakeEdgeInFace on the owning B-rep (ProtoBrep::brep_make_edge_in_face, its own m_bEditingEnabled) and UpdateFaces evaluates edge use binormals on it (ProtoBrep::edgeuse_evaluate_binormal): PARTIAL boolean.api_brep cases=287 passed=198 failed=0 deferred=85 rejected=2 known_mismatch=2 (was 187 passed, 98 deferred); gen0059 and gen0066 reach UB-175 and are rejected on the Rust side (plan/findings.md). FACE CLASSIFY (2026-10-24, claude/face-classify-tol): 50 of the 83 SmFace::PointClassify deferrals move past ComputePointParameters (now topology.face_p4 GetBrep 32, topology.brep_p1 18); 33 remain in FaceIntersect's read-only extract_geometry/Homogenize (query.face_p2 smsurf_GetSurfaceCache read-only). The 12 SmFace::GetTolerance remain: the list operands reach manifold_boolean with face surfaces lacking the recorded face tolerance (lost in boolean/merge/p3.rs before the merge). Mac difftest: passed=187 deferred=98. PR #730 (2026-10-24): operands are now built on the Rust side with the ported SmApiCreateBox / SmApiCreateSphere (primitive::api_primitives), as the shim builds them, instead of empty stand-ins, and every merge record is compared. difftest 287 cases, 187 pass, 0 failed, 98 deferred (topology.edge 71 SmEdge::GetTolerance, query.face_p1 20 SmFace::Point3DClassify dispatch gap, topology.face_p2 7 SmFace::GetTolerance), known_mismatch 2 (census_difference_cavity, gen0220: an operand entirely inside the other; the merge ray fire keys arena identities while created operands own their surfaces under notify_ref keys, plan/findings.md). partial (PR #81): difftest cases=284 passed=142 deferred=142 (blocked_by boolean.merge_p2(81): SmMerge::SmMerge for SmApiBoolean/Union/Difference/Intersection/Merge/WithOptions; boolean.merge_p3(61): SmMerge::merge_breps / BooleanLists / BooleanTrees); compared: SmApiValidateBooleanOperands (EXTRACT_SEPARATE), SmApiMergeBreps list/operation validation incl. non-consumption; NULL/aliased operands are unrepresentable with owned Breps; C++ shim runs real box/sphere booleans for the deferred cases (record = status, faces/edges/vertices/regions/manifold) so they compare once merge lands; Rust operands are empty Breps until primitive.api_primitives (SmApiCreateBox/Sphere) is ported; 12 fns; largest: SmApiMergeBreps, SmApiBoolean, SmApiBooleanDifference, SmApiBooleanIntersection; entry points: SmApiBoolean, SmApiBooleanDifference, SmApiBooleanIntersection, SmApiBooleanLists, SmApiBooleanMerge, SmApiBooleanTrees, SmApiBooleanUnion, SmApiBooleanWithOptions, SmApiMergeBreps; 13 upstream test entry points reach this unit Re-run with boolean.merge_p3 wired (PR #245): 287 cases, 151 matched, 0 failed, 136 deferred (boolean.merge_p2 114, topology.brep_p3 21, topology.brep_p2 1); with_values=151/no_values=0 (integer status/list records, no geometric-success comparison). Perturb 151/151; fuzz 2000 PASS with 0 differs/crashes/panics/timeouts. Seven old deferrals now compare empty-first-list or stack-underflow status records; new empty-forest/unreachable-leaf cases match, defined null-leaf output remains deferred at IsManifoldSolid. Re-run in PR #149 (merge with main through 39ceb995, #283): 287 cases, 151 pass, 0 fail, 136 deferred (boolean.merge_p2 114, topology.brep_p3 21, primitive.primitive_creation_p1 1): the Trees record deferral (the Rust operands are empty stand-ins; create_box / create_sphere stop at SmPrimitiveCreation) is retagged from topology.brep_p2 (IsManifoldSolid) to primitive.primitive_creation_p1. Re-run in PR #229 (boolean.merge_p2 wired, merge with main through e5f3e441): 287 cases, 151 pass, 0 fail, 136 deferred (boolean.merge_p4 114, topology.brep_p3 21, primitive.primitive_creation_p1 1): the two-B-rep entry points construct the merge through merge_p3's DependencyMerge (MergeState::with_breps, its computed tolerance through topology.brep_p2), call SmBrep::IsManifoldSolid (topology.brep_p2) and stop at merge_p3's SmMerge::ManifoldBoolean stub (boolean.merge_p4) directly or through NonManifoldBoolean; they take the kernel mutably (the driver's mark locks). After #287 (merge with main through 7b57d8de): 287 cases, 151 pass, 0 fail, 136 deferred (query.brep 114, topology.brep_p3 21, primitive.primitive_creation_p1 1): the constructor builds #287's MergeEngine, so the 114 run merge_p4's ManifoldBoolean on it and stop at SmBrep::CalculateBoundingBox (query.brep). UPDATE (PR #204, topology.brep_p3): with boolean.merge_p3's list-operand copies wired to topology::brep::p3, lists_and_trees_reach_the_merge now stops at topology.brep_p4. Gate on the wired tree (PR #204 4c7a444b): 287 cases, 151 pass, 0 fail, 136 deferred; case by case the 21 SmBrep::SmBrep(copy) (topology.brep_p3) deferrals relabel to topology.brep_p4 SmBrep::StitchFaces, no outcome change. SM_API batch S2 (fixer-7, 2026-10-29): SmApiTessellateBoundaries ported (boolean::api_brep::tessellate_boundaries over topology::brep::p1::tessellate_boundaries, SmBrep::TessellateBoundaries); shim/FFI op 18 (operand, angle tolerance, edges left without curve), fixtures/boolean.api_brep/tessellate_boundaries.json (13, incl. TestSmTessellateBoundaries) and 160 tessellate_boundaries cases on their own stream (tess0000, ...). Gate counts: to be filled from the builder's run.

Goldens

This is committed inventory, not a runtime result or a correctness proof. A golden records what solidcore produced when blessed. Current results require the canonical CI gate, not these counts.

Golden records
1,128
Stored error outcomes
0
Stored deferrals
0
Stored harness rejections
0
Known-failure entries
6

Metadata counts describe fields in the stored records; they are not passes or live failures.

Known failures (not blessed)

Source at f9704ee3b: golden JSONL · known-failure list.

Dependencies

Depends on: boolean.merge_p3 green

Soft dependencies: boolean.merge_p1 green boolean.merge_p2 green boolean.merge_p4 green geom.context green topology.brep_p2 green

Dependents: audit.recursion green

Soft dependents: none

Upstream functions

Upstream functionDefined atLinesRust (from the file header)
SmApiMergeBrepsInputsAreValidSmApiBrep.cpp:12720merge_breps_inputs_are_valid (private)
SmApiMergeBrepsKernelOperationSmApiBrep.cpp:15224merge_breps_kernel_operation (private)
SmApiValidateBooleanOperandsSmApiBrep.cpp:18615validate_boolean_operands (private)
SmApiBooleanSmApiBrep.cpp:20848[boolean], [BooleanOutcome]
SmApiBooleanUnionSmApiBrep.cpp:26347[boolean_union]
SmApiBooleanDifferenceSmApiBrep.cpp:31747[boolean_difference]
SmApiBooleanIntersectionSmApiBrep.cpp:37147[boolean_intersection]
SmApiBooleanMergeSmApiBrep.cpp:49447[boolean_merge]
SmApiMergeBrepsSmApiBrep.cpp:54849[merge_breps]
SmApiBooleanWithOptionsSmApiBrep.cpp:191336[boolean_with_options]
SmApiBooleanListsSmApiBrep.cpp:200719[boolean_lists], [BooleanListsResult]
SmApiBooleanTreesSmApiBrep.cpp:203211[boolean_trees]
Module file-header table (18 rows)
RustUpstream
merge_breps_inputs_are_valid (private)SmApiMergeBrepsInputsAreValid (static)
merge_breps_kernel_operation (private)SmApiMergeBrepsKernelOperation (static)
validate_boolean_operands (private)SmApiValidateBooleanOperands (static)
merge_boolean (private)the shared body of the two-B-rep entry points
[boolean], [BooleanOutcome]SmApiBoolean
[boolean_union]SmApiBooleanUnion
[boolean_difference]SmApiBooleanDifference
[boolean_intersection]SmApiBooleanIntersection
[boolean_merge]SmApiBooleanMerge
[merge_breps]SmApiMergeBreps
[boolean_with_options]SmApiBooleanWithOptions
[boolean_with_curves], [BooleanWithCurves]SmApiBooleanWithCurves
[boolean_2d], [Boolean2dOutcome]SmApiBoolean2d
[non_manifold_boolean]SmApiNonManifoldBoolean
[piecewise_merge], [PiecewiseMergeOutcome]SmApiPiecewiseMerge
[boolean_lists], [BooleanListsResult]SmApiBooleanLists
[boolean_trees]SmApiBooleanTrees
[tessellate_boundaries]SmApiTessellateBoundaries

Upstream tests reaching this unit

SM_API_test:TestSmMaterialCensus, SM_API_test:TestSmPiecewiseMerge, SM_API_test:TestSmBooleanLists, SM_API_test:TestApiMergeBrepsInvalidOperation, SM_API_test:TestMergeBrepsOperation, SM_API_test:TestSmMergeBreps