Persist durable, isolated, idempotently resumable control instances - #244
Merged
Conversation
The kernel Store is now an explicit multi-instance persistence contract: atomic Create that cannot overwrite, Load returning the atomic instance record (state plus complete ordered receipt history), and per-instance revision CAS, locking, recovery, and history. Apply reconciles an exact committed retry to its original durable receipt with zero side effects, keeps uncommitted attempts recovery-required, and fails closed on fabricated, misrouted, duplicated, reordered, or truncated history. A reusable InstanceStoreConformance suite proves the law for the integer memory store, the settlement register store, and the reviewer's on-disk file store, with white-box counterexamples rejecting dishonest stores.
`boatstack-reviewer status` no longer fails on a branch whose control instance has not been provisioned. It reports the deterministic initial state the first mutating command will create, marked provisioned=false, without persisting anything, so read-only observers like the self-review workflow keep working while provisioning stays explicit and mutating.
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.
Boundary
The change crosses the kernel's durable persistence boundary: the
Storeport every control instance lives behind. That boundary previously exposed a single implicit instance whose state could be loaded without its committed history, so nothing proved that instances are created explicitly, isolated from each other, or able to return an already-committed result after the caller lost the response. Every store method now names its exact control instance, and loading returns the atomic instance record — current control state plus the complete ordered committed receipt history — so the boundary itself carries the evidence needed to trust or refuse what it stores.Transition
Before: a missing instance could be silently manufactured from a constructor-supplied initial state; state and receipt history loaded separately; revisions, compare-and-swap, locking, and recovery were effectively global to the one instance a store was built around; and retrying an Apply whose transition had already committed was refused as stale, so a lost successful response was unrecoverable without re-executing the effect. After: instances are provisioned explicitly and atomically (concurrent creation yields one winner and one typed instance-exists loser; a missing instance is a typed not-found result); two independent objectives occupy two durable instances in one store with per-instance revisions, CAS, locks, recovery, and append-only history; retrying an exactly-committed prescription returns the original durable receipt with no new observation, execution, verification, state mutation, receipt, or revision, while a failed attempt without a committed receipt stays recovery-required and is never reported successful; and every loaded record fails closed on fabricated, misrouted, duplicated, reordered, or truncated history. The reviewer CLI provisions its instance at mutating command boundaries only; read-only status now reports an unprovisioned instance's deterministic initial state without persisting anything.
Evidence
A new domain-neutral
InstanceStoreConformancesuite proves the laws — create/load/restart, duplicate and concurrent creation, two-instance isolation, per-instance CAS and locking, atomic state-plus-receipt commit, append-only history, exact committed retry returning the original receipt with zero side effects (including retry of an earlier, non-latest prescription), failed-attempt retries staying recovery-required, cross-instance replay rejection, concurrent retries returning one durable result, corrupted-history fail-closure, and restart reconstruction — and runs against all three in-tree stores: the integer memory store, the settlement register store, and the reviewer's on-disk file store with a real reopen. Seven dishonest white-box stores prove the suite rejects a singleton store that ignores the requested instance, torn state-receipt commits, blind global CAS, latest-receipt lookup, replaced history, truncated history, and synthetic success after an unresolved attempt. A regression test proves read-only status never persists an unprovisioned instance. Full verification:go build ./...andgo vet ./...clean,go test ./... -racegreen, the canonical sharded runner passes 652/652 tests, the repository-contract unittests pass 69/69, and release-note validate/preflight pass. The exact-tree self-review converged with blocking measure 0 and its attestation is sealed for this head.Commits
Self-review attestation
975232189c6c9be401c457c38fa72e489d6a9b533ca3397ff275d89bdb6d5c934b86b51d3cbdfab0ee628c47fe94d1d4f5767155