carlos / platform Public

reviews: Astra brief for the G6 write fence plan, round 1

claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 041a7317f9a47ac9076c4d5d08cb043ac1a235f8 parent aa319b0
1 file changed, +67 −0
  • docs/superpowers/reviews/CODEX-REVIEW-BRIEF-G6-FENCE-PLAN.md +67 −0

CI failed — run details

diff --git a/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-G6-FENCE-PLAN.md b/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-G6-FENCE-PLAN.md
new file mode 100644
index 000000000..a75125bcc
--- /dev/null
+++ b/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-G6-FENCE-PLAN.md
@@ -0,0 +1,67 @@
+# Review brief: G6 write fence implementation plan, round 1 of 3
+
+Repo carlos/platform, branch `g6-fence`, commit named in the reviewer's prompt.
+Under review: `docs/superpowers/plans/2026-11-12-g6-write-fence.md`.
+Authorities (MERGED on main, 8660f95a): `docs/superpowers/specs/2026-11-11-g6-write-fence-design.md` (rev 3.1),
+`docs/superpowers/reviews/FABLE-SPOTCHECK-G6-FENCE.md`, `CODEX-FINDINGS-G6-R1.md`, `CODEX-FINDINGS-G6-R2.md` (fence
+items), and `docs/superpowers/specs/2026-10-26-region-ha-without-claims-design.md` (§5.2, §5.3, §5.5, §9.8).
+Litestream is github.com/benbjohnson/litestream v0.5.14 in the module cache (`go env GOMODCACHE`).
+
+You are an independent reviewer. Read the plan, then the code it names (platform AND litestream/ltx sources), and check
+every claim against that code.
+
+## Fixed: do not re-argue
+
+- Paul's ruling 2026-11-11: a holder whose replica sync fails for about 30 s stops serving (503 with Retry-After) and
+ releases unclean. Late flush, storage fencing, batched/daily in a pool stay deferred.
+- Spec §3-§4 design: obligation queue, 1 s check, 30 s limit, root-side host fence covering all seven roles, slice
+ SIGKILL, unclean release, rail refusing batched/daily on HA routes. Report only mechanisms in the plan that fail to
+ honour the spec or would not work.
+- Copy: user/operator strings are COPY-PENDING placeholders until Paul approves them (Task 7). Do not review wording.
+- Another branch (ha-unclean-marker-waits) makes an unclean marker wait for lease expiry; it is out of scope here.
+
+## What to check
+
+1. **The plan departs from the spec in one mechanism** (plan "Spec corrections" 4): instead of
+ `Replica.MonitorEnabled = false` + `Replica.Stop(true)` at the latch it puts a gate on the replica client that cancels
+ in-flight replica calls and refuses later ones except those tagged as inside the finalization. Is that sound against
+ litestream v0.5.14 (every path that uploads: replica monitor, DB.init's Start, compaction and snapshot monitors,
+ SyncAndWait, DB.Close's syncReplicaWithRetry)? Can any upload still start after the marker PUT? Can the finalization's
+ own final attempt be refused or hang? Can the context tag leak to a non-finalize caller? Does an ordinary finalize
+ blocked in SyncAndWait behind a hung upload unblock within its release budget (G6-2.3)? Deadlocks: rn.mu, finMu,
+ syncMu, db.mu.
+2. **Obligation queue (Task 1).** Is the transcribed algorithm correct against litestream's capture (DB.Pos, LTX header
+ WAL offset/size/salts, WAL restart, checkpoints)? Bound 32 s; same-run write (Fable F2); slow-then-hung (G6-1.2);
+ capture blocked with continuous writes (G6-2.1); delayed capture then hung upload; missing -wal; idle never trips.
+ Are the stated residuals (plan corrections 8) the only ones, and is any of them worse than the spec accepted?
+3. **Root fence (Task 3).** `fenceMu` + `startInSlice` + refusal at handler entry: can any start in the host slice
+ bypass the mark (all seven roles, every start site, restart/respawn paths, rootfs and gvisor variants)? Is the AST
+ guard test strong enough? Kill + wait-for-in-flight + kill + wait-empty: correct and bounded? Marks in memory: what
+ happens if instance control restarts mid-fence? Is the new /fence /unfence endpoint reachable only by the agent's
+ trusted caller (socket permissions, authn), and can a tenant trigger it or unfence?
+4. **Activator (Task 4).** One watcher per HA stream entry; stop only from awake; request vs watcher both seeing the
+ fence -> exactly one stop and one release; stop already blocked in each of its waits; clean hibernation ends the
+ watcher; e.writeFenced fast path; Unfence at the HA acquire (best effort: what if it fails, is the host then
+ permanently refused starts?).
+5. **Rail (Task 5)** covers every door that sets replication on an HA route (CLI, console, record fields).
+6. **Tests prove the change**: each refusal / termination test would fail if the mechanism were missing; census scope.
+
+## Severity
+
+- **P1**: unsafe, would not compile, a test fails, or it would not work. Blocks merge.
+- **P2**: wrong or missing. Fixed without reopening this review. (The census, and review of any newly changed security,
+ root, termination or production-storage behaviour, still check the fix; see AGENTS.md, "Stopping rules".)
+- **P3**: clarity or polish. Goes on a follow-up list; never a reason for another round.
+
+A P1 states its failure scenario and the evidence (file:line). Do not raise a P2 to P1 to keep the review open.
+
+## Output
+
+Findings ranked P1, P2, P3. Each gives the task, the problem, the evidence (file:line, verified), the failure scenario,
+a concrete fix and the invariant or trust boundary it breaks (its fault family). End with exactly one verdict:
+
+- **READY**: no P1 and no P2.
+- **READY AFTER FIXES**: no P1. The listed P2s are fixed without another round.
+- **NOT READY**: one or more P1s, listed.
+
+Do not edit files. Do not spawn Anthropic-model reviewers or subagents of your own. Do not run the full test suites.