Skip to content

Persist predict_physics claims: physics_specs + receipt re-verification - #525

Merged
ecto merged 3 commits into
claude/tech-tree-2026-progress-54603efrom
claude/festive-swirles-71e2e0
Jul 12, 2026
Merged

ecto merged 3 commits into
claude/tech-tree-2026-progress-54603efrom
claude/festive-swirles-71e2e0

Conversation

@ecto

@ecto ecto commented Jul 11, 2026

Copy link
Copy Markdown
Owner

Mirrors the clearance-claim persistence pattern (check_clearance) for predict_physics, so structural limits re-verify via build_receipt / verify_receipt instead of rotting as one-off checks.

Stacked on #524 (needs ClaimBasis + predict_physics). Base will be retargeted to main once #524 merges.

What

  • IR: PhysicsSpec (label, part/domain_box, loads, supports, material props, limits, fidelity) + Document.physics_specs, ts-rs exported (npm run ir:gen regenerated; gen-ir-types.mjs marks the field wire-optional like clearance_specs).
  • predict_physics label arg: upserts the spec on the document; the part is persisted by resolved root id so it survives renames. Requires document_id and at least one limit.
  • physicsReceiptClaims: re-solves each spec at its stored fidelity, emitting physics.static.<label>.{displacement,stress} claims with basis: predicted|verified (ClaimBasis from Verified design loop, Acts I–III: claim basis, trust boundary, predict_physics, macro library #524) and a re-runnable StoredPhysicsClaim payload in details.
  • verifyPhysicsClaims: re-solves per claim and classifies Holds (identical result), Stale (geometry changed, limit still holds), Violated (limit exceeded). One solve per spec via cache when a spec carries both limits.
  • Fail-closed: unresolvable part, load region off the structure, non-converged solve, or a tampered/missing details payload → unverifiable claim at build time, Violated at verify time. Never a silent pass.
  • Wiring: build_receipt emits physics claims in both the mechanical-only and PCB branches; verify_receipt re-verifies them and folds into the worst-status rollup. Drive-by fix: the verify_receipt tool handler never passed the engine, so clearance re-verification via the live tool always errored — now passes ctx.engine.

Tests

  • New physics-claims.test.ts: persistence/upsert, labeled claim emission with basis, Holds/Stale/Violated transitions, fail-closed paths (10 tests).
  • Full @vcad/mcp suite: 805 passed. cargo test -p vcad-ir, workspace clippy -D warnings clean. Tool-surface fixture regenerated.
  • No WASM artifacts committed (rebuilt locally for tests only).

🤖 Generated with Claude Code

Mirror the clearance-claim persistence loop for static-physics assertions:

- vcad-ir: PhysicsSpec (label, part/domain_box, loads, supports, material
  props, limits, fidelity) + Document.physics_specs, ts-rs exported
- predict_physics gains `label`: upserts the spec on the document (part
  persisted by resolved root id); requires document_id + at least one limit
- physicsReceiptClaims re-solves each spec at its stored fidelity and emits
  physics.static.<label>.{displacement,stress} claims with basis
  predicted/verified and a re-runnable StoredPhysicsClaim in details
- verifyPhysicsClaims re-solves and classifies Holds/Stale/Violated;
  fail-closed: unresolvable part, non-converged solve, or missing payload
  is Violated (unverifiable at build time), never a silent pass
- build_receipt/verify_receipt wired; verify_receipt tool handler now
  passes the engine (clearance re-verification via the live tool needed it
  too)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@vercel

vercel Bot commented Jul 11, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
vcad-mcp Building Building Preview, Comment Jul 12, 2026 7:15pm
3 Skipped Deployments
Project Deployment Actions Updated (UTC)
mecheval Ignored Ignored Jul 12, 2026 7:15pm
vcad Ignored Ignored Jul 12, 2026 7:15pm
vcad-docs Ignored Ignored Jul 12, 2026 7:15pm

Request Review

@chojiai

chojiai Bot commented Jul 11, 2026 •

Copy link
Copy Markdown

Choji live review — Looks good — no findings

Choji review — Looks good

This delta addresses both prior findings: STALE_REL_EPS is now 1e-6 with an explanatory comment, and the epsilon-based stale classification is no longer a concern. The new changes wire physicsReceiptClaims into the place_order gate alongside clearanceReceiptClaims, add two gate tests (violated and holds paths), and fix the no-specs guard to check both clearance_specs and physics_specs. The logic is correct: the gate correctly refuses on failing or unverifiable physics claims, the no-specs path is properly updated, and the test fixtures look sound. No blockers found in the delta.

No findings — looks good.


Verified by Choji

Choji ran your change live — checks failed.

3 checks.

Claim Result Evidence
npm run test Unverified — environment sandbox failure, not your PR
npm run typecheck Unverified — environment sandbox failure, not your PR
cargo check Unverified — environment sandbox failure, not your PR

Checks marked environment failed in Choji's sandbox, not against your PR. They never block.

The ticket asked for persisted predict_physics claims (physics_specs + receipt re-verification); the PR implements exactly that — PhysicsSpec IR types, label-based upsert on the document, physicsReceiptClaims for build_receipt, verifyPhysicsClaims for verify_receipt, and the verify_receipt engine-pass fix. No live preview was run (this is an MCP/server-side change with no browser UI). Both npm test and npm typecheck failed solely because wasm-pack is absent in the environment (vcad-kernel-wasm#build: spawnSync wasm-pack ENOENT), which cascades through Turborepo and prevents downstream packages from running. The cargo check failure is also environmental: the tang crate path is missing from the sandbox. Neither failure reflects a defect in this PR's code. Tool-surface fixture is updated, changelog entry is present, and the gen-ir-types.mjs FORCE_OPTIONAL list is updated for physics_specs — all consistent with the stated intent.

No issues found in the running app.


Was this review useful? Rate the findings → — your thumbs up or down trains Choji on what's worth flagging.

Reviewed 215fcb8 · Choji keeps this comment up to date as you push.

chojiai[bot]
chojiai Bot previously approved these changes Jul 11, 2026
M4 gate 2 now re-solves doc.physics_specs (via physicsReceiptClaims)
alongside clearance specs before money moves: a failing or unverifiable
physics.static claim refuses the debit fail-closed, and the no-specs
"unverified" path only applies when the document carries neither kind
of spec.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@ecto

ecto commented Jul 11, 2026

Copy link
Copy Markdown
Owner Author

Added e0eec02: the place_order M4 receipt gate now also re-solves persisted physics specs — failing/unverifiable physics.static claims refuse the debit fail-closed, and the no-specs 'unverified' path requires neither clearance nor physics specs. Two new gate tests; full mcp suite 807 passed.

- The two new place-order gate tests hit vitest's 5 s default on CI
  runners (two mesh FEA solves each): solve at resolution 12 — the gate
  semantics don't need FEA accuracy — and allow 30 s.
- STALE_REL_EPS 1e-9 → 1e-6 (review feedback): PCG converges to a
  tolerance, not bit-identical results, so the Holds/Stale boundary now
  sits above iterative-solver noise.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@ecto

ecto commented Jul 12, 2026

Copy link
Copy Markdown
Owner Author

Pushed 215fcb8: the two new order-gate tests timed out at vitest's 5 s default on CI (two mesh FEA solves each) — they now solve at resolution 12 with a 30 s allowance. Also took Choji's epsilon finding: STALE_REL_EPS raised 1e-9 → 1e-6 with a comment explaining that PCG converges to a tolerance, not bit-identical results.

🤖 Addressed by Claude Code

@chojiai
chojiai Bot dismissed their stale review July 12, 2026 19:16

Dismissing prior approval to re-evaluate 215fcb8.

@ecto
ecto merged commit b995cb3 into claude/tech-tree-2026-progress-54603e Jul 12, 2026
14 checks passed

This branch was successfully deployed

1 active deployment
Preview – vcad-mcp — 215fcb8f Deployed Jul 12, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant