primitive.api_primitives green
- Layer
- 59
- Upstream lines
- 910
- Functions
- 24
- Rust module
primitive::api_primitives
Status history
- todo 885 lines
- partial 885 lines
- green 885 lines
Source: crates/solidcore/src/primitive/api_primitives.rs
Upstream: source/SM_API/src/SmApiPrimitives.cpp
Port-plan notes
These notes preserve historical port measurements and limitations, not current CI results.
2026-10-29 (SM_API 1.0.1 parity, S4): adds SmApiCreateOffsetProfile (create_offset_profile, on primitive_creation::p1::offset_profile): shim op 27 (profile curves: SmApiCreateLineSegment, SmApiCreateArc, SmApiCreateCircle SmCircle, SmBSplineCurve::CreateLineSegment / CreateCircleSegment), ffi run_offset_profile, runner op offset_profile, fixtures/primitive.api_primitives/offset_profile.json (prog_test smSweepTest test 8's profile plus squares, circles, slots, error cases) and a separate offset generated stream (MIN_GENERATED_OFFSET = 160) so every gen case is unchanged. Summary line: PENDING (builder run). UB-119 cases rejected, not deferred (2026-10-24): a pyramid whose plane fit hits FindOuterLoops' zero-area loop (the port's find_outer_loops InvalidInput 'index out of range', exactly where upstream reads past sOutLoops) is an input undefined in C++ (AGENTS.md 5.6): run_cpp decides it with the Rust create_pyramid and returns Output::rejected naming UB-119, so the C++ no longer runs it. difftest 2024 cases, 1907 pass, 0 failed, 112 deferred (topology.face_p4 112), 5 rejected (UB-119); was 117 deferred (cpp-guard:ub-119 5) (plan/findings.md 'Remaining native-guard cases are rejected, not deferred'). main CI e33985411 (2026-10-23): PARTIAL primitive.api_primitives cases=1981 passed=1623 failed=0 deferred=358 blocked_by=cpp-guard:ub-119(5),surface.trim_srf_cache(133),topology.edgeuse_p3(46),topology.face_p2(62),topology.face_p4(112). PARTIAL (PR #160): difftest 1981 cases (481 fixture: 54 from SM_API_test TestSmPrimitives/TestSmBrep/TestSmSurfaces/TestSmIntersectors/TestSmBrepCopy/TestSmErrorCodes, 211 edge cases, 216 review adversarial cases; 1500 generated): 1445 pass bit-identical (full surface records of the plane/cylinder/cone/torus surface overloads, the rest B-rep input validation and the pyramid base-edge statuses; base line geometry is never compared because every successful base defers at topology.brep_p8), 536 deferred (primitive.primitive_creation_p1 136, primitive.primitive_creation_p2 282, primitive.primitive_creation_p3 31, topology.brep_p8 87), max_rel_err 0, perturb 1445/1445 detected; torus surface crash guard applies only when both radii exceed SM_EFF_ZERO (the C++ gate); SmApiCreateBlendPrimitive not difftested (needs a B-rep with faces); C++ crash/hang inputs fenced off by the ffi guard (UB-198..181, HANG-31); 24 fns; largest: SmApiCreatePyramid, SmApiCreateCone, SmApiCreateCylinder, SmApiCreateCylindricalBox; entry points: SmApiCreateBlendPrimitive, SmApiCreateBox, SmApiCreateCone, SmApiCreateConeEllipticEnds, SmApiCreateCylinder, SmApiCreateCylindricalBox, SmApiCreatePartialCone, SmApiCreatePartialCylinder, SmApiCreatePartialSphere, SmApiCreatePartialTorus, SmApiCreatePlanarCircle, SmApiCreatePlane, SmApiCreatePyramid, SmApiCreateSphere, SmApiCreateSphereNoPole, SmApiCreateSwungPrimitive, SmApiCreateTorus; 84 upstream test entry points reach this unit NOTE (PR #204, topology.brep_p3): the nine UNPORTED(topology.brep_p3) SmBrep::SmBrep markers (create_box, create_pyramid, ...) are left as they are: brep::p3::new_brep needs k: &mut Kernel, these public functions take no kernel (upstream's SmApiCreate* take no context), and every case stops at primitive.primitive_creation_p1 right after; wiring them means adding a kernel parameter to the API (left to the overseer / this unit). UPDATE (PR #204, overseer decision on the NOTE above): the nine SmBrep::SmBrep markers are wired kernel-free: new SmBrep() is topology::Brep::new_with_infinite_region (the topology part of topology.brep_p3's constructor), so the context zone tolerance / size settings and the SM_NO_CONSTRUCTION notification are not applied (module Deviations; the same deviation as blend.fillet_geom_p1's FilletBrep::new). Every case still stops at primitive.primitive_creation_p1..p3 / topology.brep_p8 right after. base line geometry is never compared because every successful base defers at topology.brep_p8), 536 deferred (surface.sphere 1, topology.brep_p3 448, topology.brep_p8 87), max_rel_err 0, perturb 1445/1445 detected; PR #213 review integration (main e5f3e441): plane/disc APIs call p1 with caller Kernel and native no-face SM_ERR checks, all 13 p1 tags removed; new-Brep helpers defer at the first actual SmBrep::SmBrep dependency, while blend constructs p1 on its existing B-rep; refreshed native report keeps 1445 exact comparisons and 536 deferrals, with no native primitive-topology certification; UPDATE 2026-10-23 (branch claude/edge-handles): the 46 curve.curve_p2 SmCurve::GetNaturalInterval deferrals (IdenticalSolutions of CpGlobalSolver solutions on CacheObject curve handles in ray fires) resolve to the curve the solver's curve tree decomposes: PARTIAL primitive.api_primitives cases=1981 passed=1621 failed=0 deferred=360 max_rel_err=0e0 with_values=1621 no_values=0 vacuous=0 blocked_by=cpp-guard:ub-119(5),query.face_p2(140),surface.trim_srf_cache(105),topology.edgeuse_p3(46),topology.face_p2(64). UPDATE PR #613 after #616/#618: native geometry/trim/ray records cover 2024 cases, 1870 pass bit-identical, 0 fail, 154 deferred (existing C++ guard or unported face/edge callees). Includes 42 scaled/translated examples and the tall translated pyramid regression. Local macOS C9 reference; no fresh full Linux/GCC regression claim. MERGED with main bcc2f80be (stacked PR): 2024 cases, 1907 pass bit-identical, 0 fail, 117 deferred (topology.face_p4 112, cpp-guard:ub-119 5); with main point classification the partial torus now completes. PROMOTION (2026-10-24, post-queue sweep, upstream/main eaa5fc794): fresh cargo run --profile difftest -p difftest --features cpp -- --green --jobs 4: primitive.api_primitives cases=2024 passed=2019 failed=0 deferred=0 skipped_platform=0 rejected=5 max_rel_err=0. The former topology.face_p4 deferrals now compare; create_pyramid calls topology::brep::p8::create_planar_face_with_3d_curves, which calls p7::make_face_with_curves, whose owning-face reads call topology::face::p4::{brep,edges}; topology.face_p4 and topology.brep_p8 are green. UB-119 inputs remain rejected, not deferred. Full macOS sweep: 260 units, 210 passed, 37 partial, 13 failed (unrelated failures; PR remains draft pending a clean canonical gate). UPDATE (PR #831, 2026-10-25, draft WIP): native SmApiCreateBlendPrimitive is now reached by the harness (op 26: the shim builds a box with SmApiCreateBox, resolves edge/face list indices and calls the API; the record is the API status, has, the mutated B-rep record and the blend face's own surface record). 9 fixed cases were added and the generator's last arm now emits blend cases. The WIP does NOT pass: 2 fixed cases pass (invalid association, SM_ERR_INVALID_INPUT 1007 both sides) and 7 fail, exposing two kernel-side blockers recorded in plan/findings.md: (1) valid associations where C++ returns SM_SUCCESS with rpBlendFace == NULL are unrepresentable in Rust, whose create_blend_primitive maps None to NullPointer 1006; (2) adjacent/selected edge pairs make the port's DerivSurfDefinition::sample_values return SM_ERR 1001 while the C++ builds a blend face (669/648 values). Both are outside this PR's scope (shim/ffi/runner only; kernel untouched). Status is unchanged and these cases are not skipped, waived or tolerated; CI cannot be green for this unit until the kernel owners address the two blockers.
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
- 2,245
- Stored error outcomes
- 0
- Stored deferrals
- 0
- Stored harness rejections
- 0
- Known-failure entries
- 0
Metadata counts describe fields in the stored records; they are not passes or live failures.
Source at f9704ee3b:
golden JSONL ·
known-failure list.
Dependencies
Depends on: geom.vector3d green primitive.primitive_creation_p1 green primitive.primitive_creation_p2 green surface.cone_p1 green surface.plane_p1 partial
Soft dependencies: curve.line green geom.axis2_placement green geom.context green geom.extent2d green geom.object green primitive.primitive_creation_p3 green surface.torus partial topology.brep_p1 green topology.brep_p3 partial topology.brep_p4 green topology.brep_p5 green topology.brep_p8 green
Dependents: audit.recursion green primitive.api_trim_ops partial
Soft dependents: none
Upstream functions
| Upstream function | Defined at | Lines | Rust (from the file header) |
|---|---|---|---|
SmApiIsPositiveDim | SmApiPrimitives.cpp:39 | 4 | is_positive_dim (private) |
SmApiIsNonZeroRadius | SmApiPrimitives.cpp:48 | 4 | |
SmApiConeDimsValid | SmApiPrimitives.cpp:57 | 10 | cone_dims_valid (private) |
SmApiCreatePlane | SmApiPrimitives.cpp:136 | 38 | [create_plane] |
SmApiCreatePlane | SmApiPrimitives.cpp:182 | 49 | [create_plane] |
SmApiCreatePlanarCircle | SmApiPrimitives.cpp:238 | 37 | [create_planar_circle] |
SmApiCreateBox | SmApiPrimitives.cpp:283 | 45 | [create_box] |
SmApiCreateSphere | SmApiPrimitives.cpp:336 | 41 | [create_sphere] |
SmApiCreateCylinder | SmApiPrimitives.cpp:384 | 33 | [create_cylinder] |
SmApiCreateCylinder | SmApiPrimitives.cpp:424 | 53 | [create_cylinder] |
SmApiCreateCone | SmApiPrimitives.cpp:484 | 45 | [create_cone] |
SmApiCreateCone | SmApiPrimitives.cpp:536 | 54 | [create_cone] |
SmApiCreateTorus | SmApiPrimitives.cpp:597 | 39 | [create_torus] |
SmApiCreateTorus | SmApiPrimitives.cpp:643 | 39 | [create_torus] |
SmApiCreatePyramid | SmApiPrimitives.cpp:691 | 93 | [create_pyramid] |
SmApiCreateCylindricalBox | SmApiPrimitives.cpp:791 | 49 | [create_cylindrical_box] |
SmApiCreatePartialSphere | SmApiPrimitives.cpp:847 | 39 | [create_partial_sphere] |
SmApiCreateSphereNoPole | SmApiPrimitives.cpp:895 | 36 | [create_sphere_no_pole] |
SmApiCreatePartialCone | SmApiPrimitives.cpp:938 | 42 | [create_partial_cone] |
SmApiCreateConeEllipticEnds | SmApiPrimitives.cpp:987 | 41 | [create_cone_elliptic_ends], [ConeEllipticEnds] |
SmApiCreatePartialCylinder | SmApiPrimitives.cpp:1035 | 13 | [create_partial_cylinder] |
SmApiCreatePartialTorus | SmApiPrimitives.cpp:1055 | 40 | [create_partial_torus] |
SmApiCreateBlendPrimitive | SmApiPrimitives.cpp:1191 | 34 | [create_blend_primitive] |
SmApiCreateSwungPrimitive | SmApiPrimitives.cpp:1231 | 32 | [create_swung_primitive] |
Module file-header table (24 rows)
| Rust | Upstream |
|---|---|
is_positive_dim (private) | SmApiIsPositiveDim (static) |
cone_dims_valid (private) | SmApiConeDimsValid (static) |
[create_plane] | SmApiCreatePlane (SmBrep*& overload) |
[create_plane_surface] | SmApiCreatePlane (SmPlane*& overload) |
[create_planar_circle] | SmApiCreatePlanarCircle |
[create_box] | SmApiCreateBox |
[create_sphere] | SmApiCreateSphere |
[create_cylinder] | SmApiCreateCylinder (SmBrep*& overload) |
[create_cylinder_surface] | SmApiCreateCylinder (SmSurface*& overload) |
[create_cone] | SmApiCreateCone (SmBrep*& overload) |
[create_cone_surface] | SmApiCreateCone (SmSurface*& overload) |
[create_torus] | SmApiCreateTorus (SmBrep*& overload) |
[create_torus_surface] | SmApiCreateTorus (SmSurface*& overload) |
[create_pyramid] | SmApiCreatePyramid |
[create_cylindrical_box] | SmApiCreateCylindricalBox |
[create_partial_sphere] | SmApiCreatePartialSphere |
[create_sphere_no_pole] | SmApiCreateSphereNoPole |
[create_partial_cone] | SmApiCreatePartialCone |
[create_cone_elliptic_ends], [ConeEllipticEnds] | SmApiCreateConeEllipticEnds |
[create_partial_cylinder] | SmApiCreatePartialCylinder |
[create_partial_torus] | SmApiCreatePartialTorus |
[create_blend_primitive] | SmApiCreateBlendPrimitive |
[create_swung_primitive] | SmApiCreateSwungPrimitive |
[create_offset_profile] | SmApiCreateOffsetProfile |
Upstream tests reaching this unit
SM_API_test:TestSmCreatePlanarCircle, SM_API_test:TestSmCreatePlane, SM_API_test:TestSmCreateSwungPrimitive, SM_API_test:TestSmAdvancedStitch, SM_API_test:TestSmEdgeCurveOwnership, SM_API_test:TestSmGetClosestPoint