carlos / platform Public

P1a whole-branch review brief, round 1, and the build ledger's rulings and deferred minors

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev 73c2a08286b597c0a654e10b63590f22957b5555 parent 1b72a2c
2 files changed, +85 −0
  • docs/superpowers/notes/reviews/CODEX-REVIEW-BRIEF-region-ha-p1a-branch-R1.md +40 −0
  • docs/superpowers/notes/reviews/region-ha-p1a-build-ledger-excerpt.md +45 −0

CI failed — run details

diff --git a/docs/superpowers/notes/reviews/CODEX-REVIEW-BRIEF-region-ha-p1a-branch-R1.md b/docs/superpowers/notes/reviews/CODEX-REVIEW-BRIEF-region-ha-p1a-branch-R1.md
new file mode 100644
index 000000000..cb887bee3
--- /dev/null
+++ b/docs/superpowers/notes/reviews/CODEX-REVIEW-BRIEF-region-ha-p1a-branch-R1.md
@@ -0,0 +1,40 @@
+# Review brief: region HA P1a, whole branch, round 1 of 3
+
+Repo carlos/platform, branch `design-region-ha-no-claims`, the commit named in the reviewer's prompt.
+Under review: the diff `f7644a9c..<that commit>` (merge-base with origin/main to the tip): Go code, tests and the simulation. Docs under docs/superpowers are context, not under review.
+Authorities: the approved spec `docs/superpowers/specs/2026-10-26-region-ha-without-claims-design.md` (rev 6.1) and the approved plan `docs/superpowers/plans/2026-10-26-region-ha-p1a-first-slice.md` (rev 4), both on this branch; main's code. Do not review against other unmerged branches.
+
+You are an independent reviewer. Every task touching leases, markers, keep, files, wake, secrets or same-box recovery already had its own Astra task review (clean). Your job is the WHOLE-BRANCH view: cross-task integration, the invariants end to end, and what per-task reviews could not see.
+
+## Fixed: do not re-argue
+
+- Paul's rulings in spec §2.1 (H1 to N-HA7). N-HA7: P1a gives HA only to hosts born HA (record stamped `ha:true` at create for regions in CONSOLE_HA_REGIONS); no existing host is migrated.
+- The controller's rulings in `docs/superpowers/notes/reviews/region-ha-p1a-build-ledger-excerpt.md` ("Ruling:" lines), including two scope cuts: platform-file publication may wait behind one in-flight app object PUT (Task 10); the reused-hostname legacy-wake gap is a known gap gated on #199 never-reuse before the first carloku.com region (Task 14). Raise one only with new evidence that it breaks I1 or I2.
+
+## What to check
+
+1. I1 single writer end to end: no path (acquire, classify, takeover, release, failed wake, reaper, agent crash and same-box recovery, staged starts, sidecars) lets two processes run or write one HA host, or writes after the marker.
+2. I2 no stale serving end to end: local reuse only via the keep decision on a clean, complete marker naming this box and lifetime; restores land in a clean tree; secrets are never minted twice for an HA host.
+3. Legacy (non-HA) hosts behave exactly as before: acquire, release, wake, restore, staging, sidecars, flat layout.
+4. The P0 removals (join mode, enrolment pass, claim arm of beginExecutableChange) remove nothing a claims-off box still uses.
+5. Cross-task contracts: the deferred-minor list in the ledger excerpt; triage which must be fixed before merge.
+6. Budgets: requests per wake/sleep against spec §18 and the plan's Global Constraints; no new periodic S3 poll.
+7. Build hygiene: linux-only syscalls behind build tags (including test files), no em dashes in user-facing strings, only the approved copy RHA-P1a-C1/C2.
+
+## 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.
+- **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 area, the problem, the evidence (file:line, verified), the failure scenario, a concrete fix and the invariant or trust boundary it breaks (its fault family). Then a triage line for each deferred minor (fix before merge / follow-up). 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. Leave GOCACHE unset.
diff --git a/docs/superpowers/notes/reviews/region-ha-p1a-build-ledger-excerpt.md b/docs/superpowers/notes/reviews/region-ha-p1a-build-ledger-excerpt.md
new file mode 100644
index 000000000..8b5e74f6b
--- /dev/null
+++ b/docs/superpowers/notes/reviews/region-ha-p1a-build-ledger-excerpt.md
@@ -0,0 +1,45 @@
+Ruling: per-task review only for [own review] tasks (4,6,7,8,9,10,12,14); others covered by the whole-branch review — Paul's AGENTS.md stopping rule 3 overrides the skill's every-task review — cost if wrong: a defect in an unreviewed task surfaces at the final review instead.
+Ruling: reviewers are Astra (codex gpt-6-astra) because the session model is Opus (Paul's standing rule); re-reviews too — cost if wrong: slower loops.
+Ruling: Task 15 (dev rollout) is not executed without Paul's explicit go — it touches shared dev boxes.
+- Ruling: Tasks 1-3 (P0 deletions) go as one batched dispatch; Task 4 alone (own review) — same-shape deletions — cost if wrong: one larger diff for the final review.
+- Ruling: Tasks 6 and 7 go as ONE dispatch (both internal/lease; T6 tests need T7's obligation store and releaseWithMarker; T6 AcquireHA tests set an obligation store) — P2/P4/P5/S6 — cost: bigger own-review diff.
+- Ruling: leasetest.NewLockFixture is created in Task 5 (moved from T6), outside package lease's import graph — P2/S5.
+- Ruling: Task 2 removes agentEntry's gate parameter with the smallest signature change; Task 5 updates agententry_test.go — P1/S2.
+- Ruling: Config.Self is a func() string returning the current owner, so a late IID is picked up — P3.
+- Ruling: Held.View() returns the exact view classified before the take; DecideKeep consumes it — P6.
+- Ruling: the Task 10 helper returning a slice is named lockWriteLog; Task 9 keeps lockWrites — P12.
+- Ruling: Task 9 defines the same-box hook (SetSameBoxProof; nil = refuse same-box); Task 12 implements sameBoxEmpty and owns acquiredHere/markAcquiredHere — P13/S12.
+- Ruling: a no-marker restore's setAside removes the stale <host>.env along with DB and files (clean tree) — P15.
+- Ruling: the host-side HA signal is a registry.Route field HA populated by reconcile from Record.HA, built in Task 9 (classification lives in ONE function; host calls it, no duplicate) — P16/G9.
+- Ruling: Task 9 logs "restored (<reason>)" for every restore reason including no-marker — P21.
+- Ruling: retireUnits lives in retiredunits.go; Task 2 corrects the census table — P23.
+- Ruling: implementers create missing test helpers (S1 fixedAddresses etc., S7, S9 leaseBody via leasetest) and make every test red-before-green at its task position; a test that cannot fail before the change is a defect (S4).
+- Ruling: AcquireHA and takeLegacy share one classify-and-take loop — G10.
+- Ruling: added tests: T8 TestDecideKeep covers no-marker/no-record/files-gen/no-db (G4); T13 tests all four move/place doors (G5); T9 tests LifetimeIndex and MarkHA stickiness (G6); T11 tests fillScheduledToken (G7); T7 tests RetryPending backoff and T10 the 1 s stream cadence wiring, not just the setter (G8/G11); T13 tests seeds/sidecars never stamped (G12); first-wake and sleep request counts asserted in T6/T10 fixtures (G3).
+- Ruling: mutate.sh receives the test binary path (S14).
+- Ruling: Task 15's unclean-marker drill uses a fault seam (Torn/Retry), not mode 000 (root can read it) — S15.
+- Ruling: binary ceiling (53000000 bytes, linux/arm64) and the census (card, CLAIMS, propose, cross-model approval) run once on the whole branch before merge, not per task — G1/G2 — cost: a late surprise at the end.
+- Ruling: merged origin/main at e90989a4 before Task 1 (instance-policy b85bbf8 touched activator/cgroup); plan line anchors may have shifted — implementers locate by symbol, not line — cost: none.
+Task 1-3: minor (deferred): the hosting latch has no setter until P1b/P2; LB health answers 503 with CARLOS_REGION_HA on (HA off everywhere today)
+Task 1-3: minor (deferred): retireUnits runs only on live bootstrap; boxes with carlos-system-join.path keep it until then (inert)
+Task 1-3: minor (deferred): hostactors.AutoEnroller/MembershipReader orphaned; go.mod still requires the Auto Scaling SDK (removal needs a census overlay)
+Task 1-3: Ruling: the capacity-metric start stays in the RegionHA branch (spec moves it to console start in P2, not P1a) — cost if wrong: none in P1a
+- Ruling: the next implementer may start while the previous task's Astra review runs when their files don't overlap; a fix round then goes to the original implementer after the current one commits — reviews take ~15-20 min — cost: a possible rebase of a fix onto later commits.
+Task 4: minor (deferred): hostfloor.Disk.BeginParticipation has no production caller; promotedAt param unused; behaviour change: with participation required and no armed floor, .hostexec records no longer defer updates (intended)
+Task 5: Ruling: the lock fixture is internal/lease/locktest (NewLockFixture), not leasetest — leasetest imports lease (cycle) — cost: name differs from plan text only.
+Task 5: minor (deferred): RunAgent closure (haSelfNow + minute retry) untested; off-EC2 boxes retry IMDS every minute for the process lifetime.
+Task 6-7: minor (deferred): acquire lock writes keep SDK retries; a landed-then-retried write strands the lock until expiry (legacy behaviour too); unreadable obligation file fails every HA acquire on the box (Task 9 must surface it); an HA lock deleted outside lease leaves its obligation 404-ing forever (needs un-HA follow-up)
+Task 8: Ruling: readLocalNow errors mean restore, never a failed wake (Task 9) — cost if wrong: an extra restore.
+Task 8: minor (deferred): in nested layouts a tenant could forge its own release record; effect limited to reusing its own stale copy on the releasing box (no cross-tenant or I1 effect); ctime granularity edge after final sync.
+Task 9: Ruling: Config.Self is func() hafresh.Self (not func() string) via lease.CurrentSelf — DecideKeep needs Self; supersedes pre-flight P3 wording — cost: none.
+Task 9: Ruling: haContained uses nestedReady (rootfs rows admitted) — nestedGate refuses all rootfs — cost: rootfs born-HA hosts admitted on nested proof.
+Task 13: implemented adfce91f; Ruling: stamp HA only on instance-kind records (not static/replica/role) — non-instance kinds are legacy on boxes and would wrongly block moves — cost: none; fix dispatched
+Task 13: minor (deferred): brief's test helper names didn't exist (real fixtures used)
+- Ruling: Task 10 builds the files store through ONE builder that honours CARLOS_S3_ENDPOINT, shared with Task 9's restore (Task 9 concern) — cost: none.
+Task 9: minor (deferred): restored replication class reaches the wake only via an optional backend capability (wrappers other than Exec/Split would drop it; none in production); HA tests leave lease process-globals (self, obligation dir) set for later tests in the package; marked-only hosts cost one record GET per wake until indexed
+Task 10: Ruling: snapshot/1 s cadence contention is CUT for P1a (stopping rule 2, two rounds): platform publication may wait behind one in-flight app object PUT; final publish at release still requires a complete pass so clean markers are unaffected; documented in code; follow-up separates uploads — cost if wrong: H6 trio loss window grows by one large upload on a crash mid-upload.
+Task 11: minor (deferred): ErrInstanceKeyDeferred log text reads oddly with the gate's reason appended; lease TTL has no test hook (crash witness rewrites lock expiry)
+Task 10: minor (deferred): failed-wake/reaper unclean markers don't read the host slice (S3 safe; local leftover not covered); missing host slice counts as empty; two tests ~20 s (fixed stop timeout); publisher mutex held across app object PUT (cut, follow-up)
+Task 12: minor (deferred): hasamebox_test crash helper leaves old agent's renewer/replication/publisher running and lacks teardown for the replacement service (flake risk); no paging hook for the "refused same-box" ALERT log; throttle untested; assumption that every unit start follows an acquire by this process
+Task 14: NOTE for final review: real-code gap — stale negative index entry (previous lifetime of a reused hostname) + absent lock => acquireClassified takes legacy lease.Acquire, runs the born-HA host uncontained, legacy sleep deletes the lock, HA boxes then refuse it forever. Single writer holds. Removed by #199 never-reuse (unmerged).
+Task 14: Ruling: the reused-hostname legacy-wake gap is a KNOWN GAP in P1a: model it faithfully as an explicit witness (I1 holds, host stranded); the default sweep assumes no hostname reuse (#199 never-reuse); production unchanged in P1a. GATE: G3 (first carloku.com region) requires #199 never-reuse merged; dev rollout uses fresh hostnames — cost if wrong: a reused hostname on dev could strand one host (no data corruption).