carlos / platform Public

Brief the scoped team recovery storage check

codex agent, operated by paul@keymail.dev pushed by claude agent, operated by paul@keymail.dev cb280f78152020fb854e4689ee232453eb70b440 parent c44ec92
1 file changed, +85 −0
  • docs/superpowers/reviews/CODEX-REVIEW-BRIEF-team-service-prototype-R3-storage.md +85 −0

CI passed — run details

diff --git a/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-team-service-prototype-R3-storage.md b/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-team-service-prototype-R3-storage.md
new file mode 100644
index 000000000..4b4772033
--- /dev/null
+++ b/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-team-service-prototype-R3-storage.md
@@ -0,0 +1,85 @@
+# Review brief: team prototype storage fix, check 3 of 3
+
+Repo carlos/platform, branch `team-service-prototype`.
+Under review: `e2112ac54be6f400e8456c2d7e2eb5a757f40275` to
+`c44ec92b7adc6de80a0d16a492e88044efa2574a`.
+The review brief is the only later change. Main base remains
+`65420a4d9e0d919743ea2e95e20b1a649605db3d`.
+Authorities: the 2026-11-01 team-service design and implementation plan,
+merged in main at `21738194`, and Paul's explicit choice below.
+
+You are the independent Opus reviewer for the required storage-behaviour
+check of the R2 P2-A fix. Read its changed code and tests. Do not conduct
+another broad branch review. No edits, shell commands, network, credentials
+or subagents. Do not run the full suites.
+
+## Round history and fixed scope
+
+The design received two Fable rounds and was accepted. Implementation R1
+(Opus) was NOT READY: one P1, seven P2. Implementation R2 (Opus) resolved
+all eight and returned READY AFTER FIXES with P2-A: marker-before-commit
+made an ordinary process crash permanently quarantine the whole store.
+R2 had no P1, so broad review stopped. Both findings are on discussion 512;
+the full R2 text is supplied in the prompt. This is check 3 within the same
+maximum-three-round budget, not a restarted review.
+
+The repeated startup-recovery family triggered AGENTS' scope decision.
+Paul explicitly selected: "Fix the recovery ordering with one guard and a
+crash-boundary test (recommended)." Do not ask for that choice again.
+
+The slice remains an offline library and test workflow for trusted local
+control-plane callers. No live adapters, worker network API, UI, deployment
+or host-loss durability claim. Missing/rolled-back history stays quarantined;
+an operator restore override remains unimplemented. R1/R2 P3 follow-ups
+remain on the branch. Do not reopen them without new evidence in this diff.
+
+## Invariant and implementation
+
+A successful operation commits SQL and then publishes the same transaction
+position in the external witness while holding one process-shared file lock.
+No adapter executes inside this guard. A write/commit failure poisons that
+Store handle; it cannot advance the database again. Existing handles check
+both incarnation and witness equality before each transaction.
+
+On Open, exactly one database commit ahead of the witness is an interrupted
+commit: same incarnation for ordinary operations, next incarnation for an
+interrupted Open. Startup repairs that gap before committing its own next
+position, so repeated crashes cannot accumulate a larger gap. An empty
+database gets an empty predecessor witness before its first tracked commit.
+Rollback, missing history and other mismatches keep the sticky quarantine.
+The next incarnation exceeds both the database and the readable witness.
+
+The common guard opens a fresh lock descriptor per operation and never
+unlinks the lock. Unix uses flock; Windows uses a one-byte LockFileEx lock;
+unsupported systems refuse. Relative/symlink paths resolve to the same
+database/lock path. Hard-linked databases and restoring the witness alongside
+the database are explicitly unsupported. Files live in trusted local storage.
+
+## What to check
+
+1. Give a disposition for R2 P2-A: resolved, partly resolved or unresolved.
+2. Trace before-commit, after-commit/before-witness and witness-write-error
+ paths, including first Open, repeated failed Opens and clean Close.
+3. Verify competing handles/processes cannot interleave between commit and
+ witness publication, or continue after an unpublished commit failure.
+4. Confirm the new guard does not turn rollback into recoverable history,
+ release uncertain reservations or re-enable admitted action replay.
+5. Check the tests exercise these claims and the new platform helper builds.
+
+Parent validation: the crash witness failed against the old ordering in both
+ordinary transactions and startup. The fixed ordinary/race package tests
+pass. Separate package cross-builds passed for Windows amd64, macOS arm64
+and Linux arm64. Full repository CI is rerunning. The changed package is
+not a dependency of the root binary, so no census unit changed.
+
+## Severity and output
+
+P1 means unsafe within this slice, a compile/test failure, or a contract
+that does not work. P2 is wrong or missing. P3 is follow-up only. Give a
+verified file:line, concrete scenario, minimal fix and fault family for
+each finding. Do not inflate severity to prolong review.
+
+End with READY (no P1/P2), READY AFTER FIXES (P2 only), or NOT READY (P1s
+listed). A fourth check requires Paul's explicit go; do not request one
+for polish. If NOT READY, say whether the findings share one invariant and
+whether refusing a case or cutting a feature would remove them.