Skip to content

sdk: trap-injection harness proving reconcile converges from every torn write prefix - #612

Merged
mfw78 merged 1 commit into
dev/m1from
feat/609-trap-harness
Jul 25, 2026
Merged

sdk: trap-injection harness proving reconcile converges from every torn write prefix#612
mfw78 merged 1 commit into
dev/m1from
feat/609-trap-harness

Conversation

@mfw78

@mfw78 mfw78 commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

What

Adds the ADR-0014 crash-consistency harness for the reserve/commit/reconcile design: TrapStore in nexum-sdk-test, a LocalStoreHost wrapper that counts set/delete calls and, once armed, traps after the nth write and faults every later operation until disarmed, so nothing past the trap executes; plus a keeper test sweeping the accepted-submit tick through every torn write prefix (trap after 0, 1, and 2 of its 3 writes: reserve set, commit set, refusal-marker delete) and holding the next sweep to convergence from each one - the journal ends COMMITTED, the venue holds exactly one order via the re-POST idempotency backstop (AlreadyHeld folding to Accepted), no reservation stays stranded, and a further tick is a pure idempotent skip. The review rule the sweep enforces is documented next to the harness: no in-store invariant may span two set calls unless the intermediate state is self-healing or the writes ride the atomic apply batch verb.

Why

The reconcile-not-release contract (#583-#587) claims convergence from any crash point between the reserve and the marker clear; until now only single hand-picked fault sites (the FlakyCommit commit fault, the w1/w2/w3 scenarios) were tested. Sweeping every torn prefix turns that claim into an enforced invariant and gives future flows a reusable trap-injection primitive, per issue nullislabs/nexum-runtime#11.

Production Journal/keeper/reconcile code is untouched; this is test-kit plus tests only.

Part of nullislabs/nexum-runtime#11.

Testing

nix develop --command just ci green (fmt, clippy -D warnings, rustdoc, module wasms, full workspace test suite), plus just check-venue-agnostic and just check-cow-orderbook-only both passing at the tip.

AI Assistance

Implemented with an AI coding agent, reviewed and directed by the author.

…rn write prefix

nexum-sdk-test grows TrapStore, a LocalStoreHost wrapper that counts set and delete calls and, once armed, traps after the nth write and faults every later operation until disarmed, so nothing past the trap executes.

The keeper tests sweep the accepted-submit tick through every torn write prefix (trap after 0, 1, and 2 of its 3 writes: reserve set, commit set, refusal-marker delete) and hold the next sweep to convergence: the journal ends COMMITTED, the venue holds exactly one order via the re-POST idempotency backstop, no reservation stays stranded, and a further tick is a pure idempotent skip.

The review rule the sweep enforces sits next to the harness: no in-store invariant may span two set calls unless the intermediate state is self-healing or the writes ride the atomic apply batch verb (#609).
@mfw78
mfw78 merged commit 17afbf3 into dev/m1 Jul 25, 2026
7 checks passed
@mfw78
mfw78 deleted the feat/609-trap-harness branch July 25, 2026 07:10
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