feat(geometry): private retained construction contracts and receipt/resource authority (#7955)

Closed
LO
1mo ago
+9067-96

What

Slice 1 of the stack replacing draft PR #8124. Squashes the S1-S3 series
(f6032f7ec3..c76f9a1a1b) into one reviewable change:

  • S1: a private retained construction controller that admits plans only when
    every obligation is checked, refuses incomplete plans, validates skipped
    item references, reads structure through EXPRESS schema slots, and keeps
    admission stops and test-ownership attribution intact.
  • S2: mapped, affine and Boolean consumers restacked on the contained S1
    contract, with direction/scale/origin/determinant refusal witnesses.
  • S3: private receipt and resource authority (captured resource/model
    ownership, outcome annotations, owned detach with save/clear/restore of the
    stop observer across nested waits and unwind).

The new surface is private and either #[cfg(test)] or behind the new
default-off retained-runtime feature; default output is meant to stay
byte-identical (the PR carries the identity evidence).

The CI mutation-oracle patches this slice's test.yml dispatches are included
under tests/evidence/; slice 3 replaces them with context-adjusted copies.
All other historical evidence stays on wip/geometry-platform-integration.
The revert-oracle --base pins inherited from the integration branch
pointed at commits on the old main (cf892ea4cf); reverting to them on
today's main would also revert main's newer commits. They now point at
rebased equivalents (each integration commit merged with main), published
on branch stack/7955-oracle-bases, and the old-main pin points at main.
RetainedContextError keeps its *Source variant names (the S3 oracle patch
context) under a scoped clippy::enum_variant_names allow until slice 3
renames them.

Second commit: test(processing): raise styling-parity scanned floor to the measured tree (#7955)

The retained geometry stack takes the rust/ + apps/ walk to 2391 .rs files,
past twice the old floor of 1184, which assert_walk_is_live refuses as a
stale floor. Following the guard's own instruction, set SCANNED_FLOOR to
about two thirds of the measured count (1590) and record the measurement.
Main alone (2248) stays inside [floor, 2 * floor].

Restack additions (hosted-CI blockers)

  • perf(geometry): keep retained branches out of the default wasm engine: the mapping and Boolean controllers hold retained state in a RetainedSlot (boxed as before natively and in retained-browser; on the default wasm engine the zero-sized uninhabited Absent, a constant None), and the remaining hooks test retained::ENABLED. Native code and every retained build are unchanged; tests/perf-ratchets/bundle.json is untouched.
  • ci: shard the revert-oracle lane with a coverage-checked verdict: revert-oracle-plan runs the oracle step's own script in numbering-only mode; revert-oracle is a fixed inline 32-shard matrix (the review-signal gate derives check names from that list), run_oracle numbers every invocation and shard k of 32 runs invocation i when (i - 1) % 32 == k - 1; revert-oracle-verdict keeps the check name "Changed tests observe production" and fails unless the plan and every shard succeeded and each numbered oracle ran exactly once in its assigned shard (scripts/ci-revert-oracle-shards.mjs, tested by executing the real step script as every shard). Per-case timeouts unchanged; a shard holds at most 4 cases and the plan refuses more than 128. Idle shards skip toolchain/build setup.
  • test(evidence): follow the retained slot reborrow in two H2a2 oracle contexts: context line only; mutations unchanged.
  • ci: install the pinned toolchain cleanly for revert-oracle runners: a hosted image carried a partial pinned toolchain (detected conflict: bin/cargo-clippy), same remedy as docs.yml (#6808).

Place in the stack

Slice 1 of 8 replacing the oversized draft #8124 (kept open as a draft umbrella). Review and merge bottom-up; each PR's base is the previous slice.

  1. #8143 stack/7955-1-construction-contracts (base main): feat(geometry): private retained construction contracts and receipt/resource authority (#7955) (this PR)
  2. #8144 stack/7955-2-contract-validators (base stack/7955-1-construction-contracts): feat: private retained contract validators, wire format and generated contracts (#7955)
  3. #8145 stack/7955-3-failure-origins (base stack/7955-2-contract-validators): feat(geometry): typed retained failure origins for structure, mapping, Boolean and frames (#7955)
  4. #8146 stack/7955-4-coverage-census (base stack/7955-3-failure-origins): feat(processing): read-only retained coverage census example (#7955)
  5. #8147 stack/7955-5-source-inspection (base stack/7955-4-coverage-census): feat(retained): bounded source inspection through the private controller (#7955)
  6. #8148 stack/7955-6-native-diagnostic (base stack/7955-5-source-inspection): feat(processing): private native retained diagnostic driver and numerical oracles (#7955)
  7. #8149 stack/7955-7-wasm-inspection (base stack/7955-6-native-diagnostic): feat(wasm): development-only source inspection build isolated from shipped APIs (#7955)
  8. #8150 stack/7955-8-package-graph (base stack/7955-7-wasm-inspection): build(runtime): source-only package graph for the native geometry runtime (#7955)

Validation

Head 370a2667f255a0b4d901214f91ab13522c55e263 (base main 568a078ef5; hosted CI tests the merge with current main 14bcd0ce9d).

  • Hosted CI (run 40285294668 and siblings): all required checks green (Build + WASM + Rust + Node, PR review signal, Issue queue, parity (in-tree fixtures, committed reference)). "Changed tests observe production": plan numbered the selected oracles, 32/32 shards passed (11-24 min each, previously one 85-minute step that timed out after 12 oracles), verdict passed. Perf ratchet ceilings passed: engine brotli 2,403,752 B vs allowed 2,408,428 B (main 14bcd0ce9d measures 2,402,208 B in its own run). Non-required native-adapter fails on packages/wasm/pkg-retained/ifc-lite.d.ts missing main's new planSectionExport (main #8006 did not regenerate that file); unrelated to this PR.
  • Default engine size A/B (Pop, scripts/build-wasm.sh, brotli-11, nightly-2025-11-15, before the quiet window): main 568a078ef5 2,386,188 B; this slice 2,386,345 B (+157 B; the pre-restack head was +12 KB). Per-function attribution was done on unstripped wasm32 builds.
  • Workspace validation (fleet, pc-wsl, job 29448286-b264-42bf-8938-4eab2e9aaea2, commit 722a4f7136; Rust inputs identical to this head): cargo test --workspace --locked pass, the same with --features ifc-lite-processing/retained-runtime pass, strict clippy default and retained-runtime pass. check-module-size failed only against the PC checkout's stale origin/main (row inherited from main); the catch-all failures are PC environment (deploy credentials, packed dist/), and the review-signal ones were the dynamic-matrix issue fixed in this head.
  • Node gates (fleet, pc-wsl, commit d591474618): ci-revert-oracle-shards tests and plan, revert-oracle fixture/topology tests, aggregate/path/workflow-report coverage, test wiring, source-text gates, API surface, license headers pass; the review-signal tripwire fix landed after that run and passed in hosted CI.
  • Locally on Pop (before the quiet window): cargo clippy -p ifc-lite-wasm --features retained-browser --all-targets -- -D warnings (CI's form) pass; default wasm32 cargo check adds no warning beyond main's existing closed_or_hairline dead-code warning.

Refs #7955

šŸ¤– Generated with Claude Code