solidcore

Units / query

query.api_queries green

Layer
49
Upstream lines
843
Functions
27
Rust module
query::api_queries

Status history

Oct 12Nov 25
  1. todo 809 lines
  2. partial 809 lines
  3. green 809 lines
  4. partial 843 lines
  5. green 843 lines

Source: crates/solidcore/src/query/api_queries.rs

Upstream: source/SM_API/src/SmApiQueries.cpp

Port-plan notes

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

PR #1447 (fixes #1436): SmApiBrepMaterialCensus ported as query::api_queries::brep_material_census; shim/FFI op 27, kinds 14-16 (box minus inner box, two disjoint boxes, nested boxes merged), fixtures/query.api_queries/material_census.json (88 cases: boxes, sheets, wires, empty B-rep, face with hole, void-flag rewrites incl. UNSURE): 88/88 pass. PR #1328 (2026-10-27), pinned v1.0.1: PASS query.api_queries cases=1203 passed=1203 failed=0 deferred=0 with_values=1203 max_rel_err=0. The 16 previously deferred touching, interpenetrating and coincident relationship/distance cases now compare: the shared B-rep classifier's boundary solve uses its retained owner-preserving copy and existing face-aware live services, rather than an unprepared read-only adapter. Previous v1.0.1 baseline: 1187 passed, 16 deferred at SmFace handle of a surface's face. main CI e33985411 (2026-10-23): PARTIAL query.api_queries cases=1203 passed=988 failed=0 deferred=215 blocked_by=topology.edge(31),topology.edgeuse_p3(27),topology.face_p2(157). 27 fns; largest: SmApiBrepRelationship, SmApiSurfaceClosestPoint, SmApiFaceGetBoundaryLoops, SmApiFaceClosestPoint; entry points: SmApiBrepBoundingBox, SmApiBrepClosestPoint, SmApiBrepClosestPointAll, SmApiBrepDistance, SmApiBrepIsManifoldSolid, SmApiBrepRelationship, SmApiCurveClosestPoint, SmApiCurveClosestPointAll, SmApiEdgeBoundingBox, SmApiEdgeClassifyParameter, SmApiEdgeClosestPoint, SmApiEdgeParameterRange, SmApiEdgeTangent, SmApiFaceBoundingBox, SmApiFaceClassifyUV, SmApiFaceClosestPoint, SmApiFaceGetBoundaryLoops, SmApiFaceInternalPoint, SmApiFindEdge, SmApiFindFaces, SmApiGetClosestPoint, SmApiGetEdges, SmApiGetFaces, SmApiSurfaceClosestPoint, SmApiVertexGetPoint; 24 upstream test entry points reach this unit PORTED (PR #125): public query orchestration and structured results in query::api_queries, including the wired query.face_p2 classifier. Native SmApi* oracle on concrete lines, circles, ellipses, cubic/C0 B-splines, planes, patches, rational cylinders/spheres, analytic surfaces of revolution, boxes, vertex loops and holed faces. Difftest: 1203 cases (403 fixed + 800 fixed-seed generated), 587 pass bit-identical, 0 failed, 616 deferred: query.brep 335, query.face_p1 12, query.face_p3 45, surface.surface_point_solve_p3 61, topology.brep_p1 114, topology.brep_p2 42, topology.edgeuse_p3 7. No absolute floors; perturb detects 587/587. The 25 native null contracts are FFI tests, not synthetic Rust differential passes. Five FFI tests cover layout/constructor safety, null contracts and missing-curve guards; 396 isolated missing-curve probes finish without a crash or timeout. Two core tests cover GetPoint parameter advances and ignored ordinary evaluation failures. Face closest-point adapter builds caches after validating its face handle. Cases cover all five B-rep relationship classes, operand reversal, C0 left tangents, zero-edge loops, holes and 21 fully compared analytic seam/axis drops. Topology imports restore exact native types, upward face-use links, trim flags and ownership. Curve/B-rep solves retain SM_ZONE_TOL_3D; surface grouping uses the surface zone tolerance and caller Kernel. No incoming UNPORTED(query.api_queries) sites. Re-run after merging PR #106 (surface.surface_point_solve_p3 wired, 2026-10-15): 1203 cases, 646 pass, 557 deferred (query.brep 335, query.face_p1 12, query.face_p3 45, surface.surface_p8 2, topology.brep_p1 114, topology.brep_p2 42, topology.edgeuse_p3 7), 0 failed, max_rel_err 0. UPDATE after topology.brep_p1 (PR #145): SmBrep::GetVertices/GetEdges/GetFaces wired; the shim export now carries the B-rep's native face/edge/vertex list order and the runner imports it (SmApiGetEdges/GetFaces indices, the cause of the 14 permutation disagreements seen when wiring). Re-run 1203 cases, 731 pass (83 more than main's 648), 0 fail, 472 deferred (query.brep 335, query.face_p3 45, topology.brep_p2 42, curve.curve_p6 31: the FindEdge cases now reach geom.tools' own DropPoint stub, query.face_p1 12, topology.edgeuse_p3 7). Re-run in PR #238 (query.face_p1 wired into face_bounding_box; after merging main with #145): 1203 cases, 743 pass, 460 deferred (query.brep 335, query.face_p3 45, topology.brep_p2 42, curve.curve_p6 31, intersect.surface_drop_lib_p3 7), 0 failed. Re-run after merging query.face_p3 (PR #132: SmFace::CalculateTightBoundingBox wired, 2026-10-20): 1203 cases, 748 pass, 0 failed, 455 deferred (query.brep 335, topology.brep_p2 42, curve.curve_p6 31, intersect.surface_drop_lib_p3 28, curve.crv_on_surf 10, topology.face_p2 9), max_rel_err 0. UPDATE after topology.brep_p2 (PR #149) wired SmBrep::IsManifoldSolid: 1203 cases, 773 pass, 0 fail, 430 deferred (query.brep 335, query.face_p3 45, curve.curve_p6 31, query.face_p1 12, topology.edgeuse_p3 7), max_rel_err 0. Re-run in PR #149 (merge with main through 39ceb995, #283): 1203 cases, 785 pass, 0 fail, 418 deferred (query.brep 335, query.face_p3 45, curve.curve_p6 31, intersect.surface_drop_lib_p3 7): main's 42 topology.brep_p2 deferrals (SmBrep::IsManifoldSolid) pass. UPDATE 2026-10-23 (branch claude/edge-handles): the 110 curve.curve_p2 SmCurve::GetNaturalInterval deferrals (IdenticalSolutions in CcGlobalSolver / CpGlobalSolver on the runner's Object curve handles) resolve through the curve solvers' tree-owner ParameterDomains; most now stop at the next blocker: PARTIAL query.api_queries cases=1203 passed=988 failed=0 deferred=215 max_rel_err=0e0 with_values=988 no_values=0 vacuous=0 blocked_by=topology.edge(31),topology.edgeuse_p3(27),topology.face_p2(157). The 31 topology.edge are SmEdge::GetCurve through query::face::p2::WithMadeTrimCurves, which does not forward topology_entity (Codex-owned file). UPDATE (owning-face caches for the topology solver): closest point (ops 4-6), FindFaces and FaceClosestPoint solve on the B-rep mutably through LiveBrepObjects, whose surface context the point/face, curve/face and face/face solves now use (GlobalCurveSolve / GlobalSurfaceSolve with a context, solutions' operands resolved for IdenticalSolutions): PARTIAL query.api_queries cases=1203 passed=1066 failed=0 deferred=137 blocked_by=topology.edge(31),topology.face_p2(106). The 106 left are BrepRelationship / BrepDistance (ops 7, 8), which still run on the read-only view because the containment tests read the B-reps after the solve; with the mutable solve they compare, and 6 containment cases disagree (the target's Point3DClassify puts interior points in the void region), so they stay deferred until that is root-caused. UPDATE (BrepRelationship / BrepDistance on a live B-rep): ops 7 and 8 solve through the runner's live objects (brep_relationship_solve, then brep_relationship_classify on the B-reps). Two causes kept them from comparing: the runner cloned the second B-rep, and the shared-target point classification (BrepClassifier) fired its rays on a clone; Brep's Clone is the copy constructor, which resets every curve and surface owner, so the B-rep cache made from the clone held no curve or surface (build_trees keeps only geometry owned by its edge/face), the boundary solve found only vertex pairs and the ray fires hit nothing, so even the centre of a unit box classified into the void region. The classifier's copy is now Brep::clone_standing_for_self (exact geometry copies keeping their owners, surfaces sharing cache slots) and the runner passes the second B-rep mutably: PASS query.api_queries cases=1203 passed=1203 failed=0 deferred=0 max_rel_err=0e0 with_values=1203. UPDATE (2026-11-09, solidcore's own, no upstream counterpart): edge_plane_crossings, where an edge over its own interval meets a plane (points and stretches within the edge's tolerance, the edge's vertex named at its ends), through curve.curve_p4's plane solve (plane_global_curve_intersect, now pub(crate)); tested on analytic line, circle, ellipse, B-spline and rational edges.

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,399
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: curve.curve_p2 green geom.extent1d green geom.extent3d green geom.object green geom.solution_array green geom.tol green geom.vector2d green geom.vector3d green intersect.point_class green intersect.topology_solver_p2 green query.brep green query.edge green topology.brep_p1 green topology.edge green

Soft dependencies: curve.curve_p1 green geom.tools green query.face_p1 green query.face_p2 green query.face_p3 green surface.surface_p2 partial surface.surface_p5 green topology.brep_p2 green topology.edgeuse_p1 green topology.face_p2 partial topology.face_p4 green topology.loopuse green topology.shell green topology.vertex green

Dependents: audit.recursion green

Soft dependents: none

Upstream functions

Upstream functionDefined atLinesRust (from the file header)
SmApiGetClosestPointSmApiQueries.cpp:3634[get_closest_point], [brep_closest_point], [brep_closest_point_all]
sm_CountContainedSamplesSmApiQueries.cpp:7872count_contained_samples, edge_piece_points, point_in_solid, target_curve_crossings (private)
sm_PointInSolidSmApiQueries.cpp:15210count_contained_samples, edge_piece_points, point_in_solid, target_curve_crossings (private)
SmApiBrepRelationshipSmApiQueries.cpp:18671[brep_relationship], [brep_distance]
SmApiBrepDistanceSmApiQueries.cpp:26711[brep_relationship], [brep_distance]
SmApiGetEdgesSmApiQueries.cpp:28517[get_edges], [get_faces], [find_edge], [find_faces]
SmApiGetFacesSmApiQueries.cpp:30917[get_edges], [get_faces], [find_edge], [find_faces]
SmApiFaceGetBoundaryLoopsSmApiQueries.cpp:33859[face_get_boundary_loops]
SmApiFindEdgeSmApiQueries.cpp:40419[get_edges], [get_faces], [find_edge], [find_faces]
SmApiFindFacesSmApiQueries.cpp:43019[get_edges], [get_faces], [find_edge], [find_faces]
SmApiCurveClosestPointSmApiQueries.cpp:45738[curve_closest_point], [curve_closest_point_all]
SmApiCurveClosestPointAllSmApiQueries.cpp:50443[curve_closest_point], [curve_closest_point_all]
SmApiSurfaceClosestPointSmApiQueries.cpp:56170[surface_closest_point]
SmApiBrepClosestPointSmApiQueries.cpp:64035[get_closest_point], [brep_closest_point], [brep_closest_point_all]
SmApiBrepClosestPointAllSmApiQueries.cpp:68441[get_closest_point], [brep_closest_point], [brep_closest_point_all]
SmApiBrepIsManifoldSolidSmApiQueries.cpp:73614[brep_is_manifold_solid], [brep_bounding_box]
SmApiBrepBoundingBoxSmApiQueries.cpp:101724[brep_is_manifold_solid], [brep_bounding_box]
SmApiFaceBoundingBoxSmApiQueries.cpp:108424[face_bounding_box], [face_internal_point], [face_classify_uv], [face_closest_point], [face_closest_point_in_shape]
SmApiFaceInternalPointSmApiQueries.cpp:118014[face_bounding_box], [face_internal_point], [face_classify_uv], [face_closest_point], [face_closest_point_in_shape]
SmApiFaceClassifyUVSmApiQueries.cpp:120428[face_bounding_box], [face_internal_point], [face_classify_uv], [face_closest_point], [face_closest_point_in_shape]
SmApiFaceClosestPointSmApiQueries.cpp:124244[face_bounding_box], [face_internal_point], [face_classify_uv], [face_closest_point], [face_closest_point_in_shape]
SmApiEdgeBoundingBoxSmApiQueries.cpp:134424[edge_bounding_box], [edge_closest_point], [edge_parameter_range], [edge_classify_parameter], [edge_tangent]
SmApiEdgeClosestPointSmApiQueries.cpp:140727[edge_bounding_box], [edge_closest_point], [edge_parameter_range], [edge_classify_parameter], [edge_tangent]
SmApiEdgeParameterRangeSmApiQueries.cpp:144217[edge_bounding_box], [edge_closest_point], [edge_parameter_range], [edge_classify_parameter], [edge_tangent]
SmApiEdgeClassifyParameterSmApiQueries.cpp:146934[edge_bounding_box], [edge_closest_point], [edge_parameter_range], [edge_classify_parameter], [edge_tangent]
SmApiEdgeTangentSmApiQueries.cpp:151223[edge_bounding_box], [edge_closest_point], [edge_parameter_range], [edge_classify_parameter], [edge_tangent]
SmApiVertexGetPointSmApiQueries.cpp:154314[vertex_get_point]
Module file-header table (23 rows)
RustUpstream
[curve_closest_point], [curve_closest_point_all]SmApiCurveClosestPoint, SmApiCurveClosestPointAll
[surface_closest_point]SmApiSurfaceClosestPoint
[get_closest_point], [brep_closest_point], [brep_closest_point_all]SmApiGetClosestPoint, SmApiBrepClosestPoint, SmApiBrepClosestPointAll
[brep_relationship], [brep_distance]SmApiBrepRelationship, SmApiBrepDistance
[brep_relationship_solve], [brep_relationship_classify]the solve and the classification of SmApiBrepRelationship
[get_edges], [get_faces], [find_edge], [find_faces]SmApiGetEdges, SmApiGetFaces, SmApiFindEdge, SmApiFindFaces
[face_get_boundary_loops]SmApiFaceGetBoundaryLoops
[brep_is_manifold_solid], [brep_bounding_box]SmApiBrepIsManifoldSolid, SmApiBrepBoundingBox
[brep_material_census]SmApiBrepMaterialCensus
[face_bounding_box], [face_internal_point], [face_classify_uv], [face_closest_point], [face_closest_point_in_shape]SmApiFaceBoundingBox, SmApiFaceInternalPoint, SmApiFaceClassifyUV, SmApiFaceClosestPoint
[edge_bounding_box], [edge_closest_point], [edge_parameter_range], [edge_classify_parameter], [edge_tangent]SmApiEdgeBoundingBox, SmApiEdgeClosestPoint, SmApiEdgeParameterRange, SmApiEdgeClassifyParameter, SmApiEdgeTangent
[vertex_get_point]SmApiVertexGetPoint
[edge_plane_crossings]not upstream: where an edge, over its own interval, meets a plane
[edge_crossing_on_face]not upstream: where a curve meets an edge, solved on one of the edge's faces
[vertex_on_edge]not upstream: whether a vertex lies on an edge within the two's tolerances
[closest_to_members], [edge_curve_copy]not upstream: ShapeCurveSolve/ShapePointSolve minimum of a curve or point against faces and edges
[closest_between_faces]not upstream: selected-shape minimum on trimmed faces and their boundaries
[point_distance], [vertex_distance], [edge_face_gap_samples], [edgeuse_face_frame]not upstream: certified distances (the last on SmCrvSrfGapFunction's samples)
[FacePointCandidates]not upstream: cached kernel face boxes for narrowing point queries
[face_normal_at_point], [face_parameters_at_point], [face_normal_at_uv], [face_normal_at_clamped_uv], [face_normal_at_vertex]not upstream: trimmed-face membership and the normal in the chosen use's sense
[box_max_distance_to_point]not upstream: [Extent3d::max_distance_to_point] of a box given by two corners
count_contained_samples, edge_piece_points, point_in_solid, target_curve_crossings (private)sm_CountContainedSamples, sm_PointInSolid, its BrepCurveSolve
solution_point (private)SmSolution::GetPoint

Upstream tests reaching this unit

SM_API_test:TestSmIntersectCurveSurface, SM_API_test:TestSmGetClosestPoint, SM_API_test:TestSmGetEdges, SM_API_test:TestSmGetFaces, SM_API_test:TestSmFindFaces, SM_API_test:TestSmFindEdge