feat(retained): native SMLib driver, shape-only publication and corpus comparison (M1-D, #7955)

Merged
LO
1mo ago
+3611-42

Refs #7955. This is M1 PR D of the CLI retained-mode plan, on top of the executor (#8180). It is the first PR where the retained path produces geometry and has it measured against exact on real models.

What it adds (opt-in, behind retained-runtime):

  • rust/retained-native, a new crate with publish = false. It contains the native SMLib runtime for the executor's traits (a NativeWorker newtype and a crate-local receipt), plus the small geometry-runtime additions it needs (PlacedResult, RetainedBooleanIdentity, same_domain).
  • ifc-lite-processing stays publishable. It still has no dependency on geometry-runtime; this is checked with cargo package --list.
  • Shape-only publication (publish_shape). It is atomic: every part of a product is published, or the product is refused. Each part carries a mesh and a placement, and is marked PresentationObligationsUnmet. Products that are unplaced, or whose final value is affine-only, refuse as incomplete before any kernel call.
  • Whole-model native driver (run_model_native). It (through NativeModelDriver, which the harness builds once) reuses one qualified worker across models and gives typed refusals. There is no fallback to exact. It restarts a worker at most 3 times; contract faults keep the worker.
  • Comparison harness (examples/retained_compare.rs) and coverage manifest (tests/manifests/cli-retained-coverage.tsv).
    • The authority is the source-derived check: retained, in full f64, is compared with values computed from the IFC source, using tolerances pre-registered before any run.
    • The comparison with exact is made in exact's own f32 storage frame.
    • A missing engine aborts the run; it does not produce a summary.
  • CI: SMLib-free tests and an oracle witness on the PR lane. Real-kernel tests and the comparison gate run in the non-required geometry-platform lane.

First real-kernel corpus result (SMLib c9c5979, 12 committed models, release build, Pop fleet worker, gate exit 0):

Products published91 / 119 (76.5 %), all closed
Source-derived checksvolume 90/90, bbox 86/86 pass at the committed tolerances
Refusals19 operation_unsupported, 7 opening_strategy, 1 material_layer_strategy, 1 incomplete
Violations, product-list mismatches, skips0
Timingworker startup and qualification 3.96 s (once); all product work 0.84 s; exact 0.12 s

On a georeferenced model (ISSUE_098), retained matched the source-derived volumes to about 1e-9. Exact was 1e-5 to 5e-5 off, because the native exact path stores absolute f32 positions about 100 m from origin. For that reason exact is compared at its own precision, and the source check is the gate. No tolerance was widened.

Default path: exact output is unchanged. Processing gains only the feature-gated retained_jobs and publication code. There are no new non-test panics.

Validation at 171ae52498, rebased on main, on the Pop fleet worker, exit 0:

  • workspace clippy, default and with the feature;
  • geometry, processing and retained-native tests;
  • revert oracle OBSERVED;
  • all guards;
  • package boundary (no geometry-runtime).

The real-kernel run and the gate ran at the equivalent code commit 889a4173f8 before the rebase.

Review: one independent review of the driver, one root-cause review of the first corpus run, and a further pass after the fixes. Every finding is addressed. Deferred to a follow-up: porting about 30 private-state executor tests, which need a narrow test facade, and orphan type-product geometry, which is reported separately as exact-only.

Closes the native half of M1. Next: wasm retainedModel (E), then the CLI --kernel retained (F).

šŸ¤– Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Added an experimental native workflow for processing IFC models and publishing supported geometry with clear outcomes when products cannot be processed.
    • Added reusable native-worker processing, configurable per-product limits, and geometry comparison reports.
    • Added optional corpus comparisons and gated comparison runs.
  • Bug Fixes
    • Improved handling of incomplete shapes, unsupported geometry, and worker failures to prevent partial results from being published.
  • Tests
    • Added regression coverage for geometry, worker reuse and recovery, refusals, and comparisons.
  • Documentation
    • Added guidance for enabling and running the experimental native workflow.