sdk: trap-injection harness proving reconcile converges from every torn write prefix - #612
Merged
Conversation
…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).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds the ADR-0014 crash-consistency harness for the reserve/commit/reconcile design:
TrapStorein nexum-sdk-test, aLocalStoreHostwrapper that countsset/deletecalls 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 twosetcalls unless the intermediate state is self-healing or the writes ride the atomicapplybatch 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 cigreen (fmt, clippy-D warnings, rustdoc, module wasms, full workspace test suite), plusjust check-venue-agnosticandjust check-cow-orderbook-onlyboth passing at the tip.AI Assistance
Implemented with an AI coding agent, reviewed and directed by the author.