Repository navigation
feat(immune): inert Lane A dry-run thread (precommit -> receipt -> would-write) [D-145] - #1513
Conversation
…uld-write) [D-145]
Threads the existing, unjoined Lane A pieces end to end as an inert dry-run:
work-statement precommit hash -> multi-criterion acceptance -> versioned
default-OFF collapse to the receipt's binary verdict -> combined trust receipt
(signed + independently verified) -> the would-write experimental shadow row.
Writes nothing; moves no money / RepID / on-chain state.
The receipt is bound to the contract via experiment_id = contractId (a transitive
bind to the immutable work_statement_hash on service_contracts); the signed public
combined receipt is NOT changed. Same-controller throughout — never claims
independence. 5/5 jest; the test caught a Number('')===0 threshold bug, fixed.
Grok co-signed the scope (D-054). Promoting work_statement_hash to a first-class
bound receipt field, the activation flags, and the real testnet USDC payment +
ERC-8004 / EAS writes remain Sean's MAJOR gates.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Strix Security Review✅ No open security findings. PR summary: Adds `src/immune/lane-a-dryrun.ts` plus a test: an inert dry-run harness that threads a precommit work-statement hash through multi-criterion acceptance, a versioned threshold collapse, a signed (non-authoritative) settlement receipt, and a would-write experimental shadow row, writing nothing. Review summaryReviewed both changed files in full and traced every leg of the new Lane A thread into the modules it joins ( Ruled out (4)
Review 1 on this PR · Reviewed by Strix |
There was a problem hiding this comment.
Reviewed both changed files in full and traced every leg of the new Lane A thread into the modules it joins (work-statement-spec, trusted-settler, experimental-settlement), including a runtime check of the side effects. No security vulnerability is introduced by this PR: the new module is inert and uncalled. runLaneAJDryRun has no non-test callers, settleImmuneReceipt rejects its receipt at the non-attestation gate before the mode, enabled and store gates, no store is injected, buildImmuneExperimentalRow is a pure constructor, and nothing touches canonical RepID, USDC, ERC-8004/EAS or the DB — confirmed with all env flags opened and a hostile injected store. The acceptance parser is sound (out-of-set criteria, non-boolean met and missing criteria are all refused; denominator is the spec's criteria count), and the threshold default genuinely fails closed to 1.0. Four suspicions raised during the deeper analysis — a signed receipt asserting execution/containment that never occurred against a constant-expectation fixture oracle, a LANE_A_ACCEPT_THRESHOLD=0 accept-anything knob, an unvalidated caller-supplied contractId with an unenforced work_statement_hash bind, and a 4-decimal score rounding that can reach 1.0 with one criterion unmet — were each independently validated and rejected as inert, operator-controlled, caller-self-harming, or pre-existing in unchanged code. They remain worthwhile design notes before Lane A is wired to any producer or credit path.
Reviewed by Strix
Configure security review settings
What
Stands up Lane A (one real economic E2E) as an inert dry-run thread. New file
src/immune/lane-a-dryrun.ts+ test. Writes nothing; moves no money / RepID / on-chain state.The pieces already existed and are (partly) live, but nothing joined them:
runTrustedSettlement+settleImmuneReceipthave zero non-test callers, and the precommit world (multi-criterion acceptance,work_statement_hash) and the receipt world (single binary verdict,experiment_id) are two unlinked subsystems. This threads them:work-statementprecommit hash →parseCriterionRatingssatisfaction → versioned, default-OFF collapse to the receipt's binary verdict (LANE_A_ACCEPT_THRESHOLD, default 1.0 = all criteria met) →runTrustedSettlement(dry-run, signed + independently verified) → the would-write experimental shadow row.Deliberately small join (Grok co-signed, D-054)
experiment_id = contractId— a transitive bind to the immutablework_statement_hashonservice_contracts. The signed public combined receipt is NOT changed.same_controller_measured. This is not independent commerce.Owner (MAJOR) gates — all left undone
authoritative receipt (engine origin auth) ·
EXPERIMENTAL_REPID_MODE+IMMUNE_SETTLE_ENABLEDto move even shadow credit · real testnet USDC payment + ERC-8004 / EAS writes · promotingwork_statement_hashto a first-class bound receipt field · any canonical credit.Tests
5/5 jest. The test caught a real
Number('')===0bug that collapsed the default threshold to 0 (accept-anything); fixed. Existing 57 immune-lane tests remain green.🤖 Generated with Claude Code