carlos / platform Public

reviews: brief for the G6 fence branch review, round 2

claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 8115130696bc728576ad9fe08e6c79c8e42c270c parent 43a021d
1 file changed, +89 −0
  • docs/superpowers/reviews/REVIEW-BRIEF-G6-FENCE-BRANCH-R2.md +89 −0

CI cancelled — superseded by a newer push — run details

Intent

Attributed to this commit: 14.4 g CO₂e (1,817,090 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on g6-fence, never backward from it. A turn that produced more than one commit books all of its tokens to the last one, and a concurrent session on this branch can add to the same figure. Some of it was priced using the shared default rate, because no model-specific factor row exists yet for at least one model involved. The Carbon view has the repo total, which is never derived from this attribution.

diff --git a/docs/superpowers/reviews/REVIEW-BRIEF-G6-FENCE-BRANCH-R2.md b/docs/superpowers/reviews/REVIEW-BRIEF-G6-FENCE-BRANCH-R2.md
new file mode 100644
index 000000000..0a7bf23cc
--- /dev/null
+++ b/docs/superpowers/reviews/REVIEW-BRIEF-G6-FENCE-BRANCH-R2.md
@@ -0,0 +1,89 @@
+# Review brief: G6 write fence branch (fallback A) and its census card, round 2 of 3
+
+Repo carlos/platform, branch `g6-fence`, commit named in the reviewer's prompt.
+Under review: the diff `ab4d773b..<tip>` (`git diff ab4d773b5bea4ed13aa823adb17af42d8961a1e7..<tip>`), which is the
+branch against main after main was merged in. Also the census card
+`docs/superpowers/notes/census-proposal-g6-fence.md` and overlay `internal/provision/testdata/plan14-root-reads-g6-fence.tsv`.
+Authorities: the spec `docs/superpowers/specs/2026-11-11-g6-write-fence-design.md` AS CHANGED ON THIS BRANCH (rev 4,
+fallback A; rev 3.1 is on main), the plan `docs/superpowers/plans/2026-11-12-g6-write-fence.md` (rev 3), the region HA
+spec `docs/superpowers/specs/2026-10-26-region-ha-without-claims-design.md` (main has the unclean-marker wait, §5.2,
+§9.8), AGENTS.md (census section, stopping rules).
+
+You are an independent reviewer. Read the spec and plan, then the diff and the code it touches (internal/lease,
+internal/activator, cli.go, and litestream v0.5.14 in the module cache), 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 + Retry-After) and
+ releases unclean. Fallback A, by the agent manager 2026-11-12 after two plan rounds: no root fence; the activator
+ begins the ordinary lease-lost stop. Bound: 503 at once; lost acknowledged writes are those committed from 32 s before
+ the fence line plus requests already running; processes dead within 30 s (common) / 110 s (worst bounded).
+- Copy: the operator rail string is a COPY-PENDING placeholder until Paul approves it (plan Task 6, not yet done).
+- Residuals the spec states (capture race at fence.go:86, rolled-back spill at :105, first sync unreachable within 30 s).
+- Accepted (controller ruling, ledger): wake-state import and the registry's remote dispatch can carry a non-stream class
+ onto an existing HA route; such a route is simply unfenced (spec §3.3).
+
+## What to check
+
+1. **Release and storage safety.** After the fence trips, no upload starts after the release marker PUT; the
+ finalization's own attempt is not refused or hung by the gate; an ordinary finalize blocked behind a hung upload
+ reaches an unclean marker or an owed release within its budget; the owed marker lands later. Interaction with main's
+ unclean-marker wait (the successor waits a lease term; a fenced release must never look clean or settled).
+2. **The fence algorithm** (internal/lease/fence.go, fencerun.go): never discharges an obligation without proof
+ (coverage via WAL header >= 32 bytes, salts, frame at end; R high-water; TXID zero), idle never trips except the
+ stated residuals, 1 s tick and 30 s limit with the seam only in tests.
+3. **Termination and admission** (internal/activator writefence.go and its callers): exactly one stop owner and one
+ release in every interleaving (request vs watcher, waking vs awake, the doWake-to-awake window, earlier lease loss,
+ clean hibernation); 503 with Retry-After 10 and X-Carlos-Holder none at once from the fence line, never an empty 200;
+ no goroutine leak; seams nil in production.
+4. **The rail** (cli.go): batched/daily refused on HA routes; stream and non-HA unchanged.
+5. **The merge with main** (b3760fb2 and after): main's unclean-marker and files-only changes still hold with the fence.
+6. **Census (AGENTS.md "The census: the reviewer decides").** Give a verdict for EVERY unit and envelope on the card,
+ citing the lines you read. Reject, as a finding, if the change lets root open, run, query or follow anything it did
+ not before from a path or input a tenant, an app or a box agent can create, write or name; if it weakens a check,
+ refusal, validation, argument or environment root relies on; if a new disposition is wrong for the unit's reads; or
+ if the diff cannot settle any of these. Otherwise approve.
+7. **Tests prove the change**: each termination, refusal and storage test would fail on a broken implementation.
+
+Deferred minors from the task reviews (triage: must any be fixed before merge?): see the lines starting
+"Task <N>: minor" in `.superpowers/sdd/2026-11-12-g6-write-fence/progress.md` (the reviewer prompt names the path).
+
+## Round 2
+
+Earlier round: `docs/superpowers/reviews/CODEX-FINDINGS-G6-FENCE-BRANCH-R1.md` (Astra: NOT READY, P1 fence vs
+finalization race, P2 finalize deadline behind a hung upload, P2 cancelled wake forgets its refusal; census approved)
+and `docs/superpowers/reviews/FABLE-FINDINGS-G6-FENCE-BRANCH-R1.md` (Fable: READY AFTER FIXES, four P2s). The fix
+wave is `2782edcd..43a021d3` (pre-packaged diff named in the prompt). Controller rulings (deferred Astra P2-3 as a
+follow-up; Fable P2-2 documented as residual (d); Fable P2-1 and P2-3 real fixes) are in the ledger.
+
+First give one line per R1 P1 and P2 from BOTH files: resolved, partly, not, or deferred-by-ruling (judge whether the
+ruling is acceptable). Then new findings in the fix wave only. Check especially the NEWLY CHANGED production-storage
+behaviour: (a) the state lock ordering fence vs finalization (no I/O under it, cannot block cancellation, both orders
+correct, marker flags); (b) finalization cancelling the monitor's replica work at its start (clean releases stay
+clean and fast; nothing lost that finalize's own sync does not cover; G5 held-request handover unaffected); (c) the
+fence-initiated sync (at most one in flight, gate-admitted, non-finalization, only when the oldest obligation is >5 s
+and something captured is unstored; cost under outage; cannot race finalization); (d) uncommitted frames past the
+captured end counted as covered (commit-frame scan bounded by WAL size; a committed frame always not covered; salts).
+Census: re-approve or reject the changed unit `readCoverage` (and any other unit whose body changed in the wave),
+citing lines; seal a4d50694.
+
+## 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 file:line, the problem, the evidence (verified), the failure scenario, a
+concrete fix and the invariant or trust boundary it breaks (its fault family). Then the census verdict table (unit or
+envelope, approve/reject, lines read). 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 subagents of your own. Do not run the full test suites.