carlos / platform Public

nearest-region-b: whole-branch review brief, round 2

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev c8ef8d9eedd79e1a20daa472eb1511e47832b9a4 parent 35a6146
1 file changed, +127 −0
  • docs/superpowers/notes/reviews/CODEX-REVIEW-BRIEF-nearest-region-b-branch-R2.md +127 −0

CI passed — run details

diff --git a/docs/superpowers/notes/reviews/CODEX-REVIEW-BRIEF-nearest-region-b-branch-R2.md b/docs/superpowers/notes/reviews/CODEX-REVIEW-BRIEF-nearest-region-b-branch-R2.md
new file mode 100644
index 000000000..b3cf00e5b
--- /dev/null
+++ b/docs/superpowers/notes/reviews/CODEX-REVIEW-BRIEF-nearest-region-b-branch-R2.md
@@ -0,0 +1,127 @@
+# Review brief: nearest-region never-reuse, merge B whole branch (offline activation), round 2 of 3
+
+Repo carlos/platform, branch `nearest-region-b`, at the commit named in your prompt (the brief's own commit; review the code there).
+Under review: the diff `origin/main...HEAD`, with the round 1 fixes in `bfdb7368` and the merge of main in `35a61466`.
+Authorities, on main: the spec `docs/superpowers/specs/2026-10-26-nearest-region-without-claims-design.md`, the plan
+`docs/superpowers/plans/2026-10-26-nearest-region-never-reuse.md`, the approved copy
+`docs/superpowers/notes/copy/nearest-region-never-reuse.md`. On this branch: the spec's §3b (its last paragraph records
+round 1's fixes and Paul's rulings), the plan's "Rework" section, and the approved copy
+`docs/superpowers/notes/copy/nearest-region-never-reuse-b.md` (with the rework list and the round 1 fixes list appended).
+
+You are an independent reviewer. Read the document, then the code it
+names, and check every claim against that code.
+
+## Round history
+
+Before the cut: Task 5 r1-r3, Task 6 r1-r2, Task 7 r1-r2, Task 8 r1, Task 10 r1, all NOT READY
+(`docs/superpowers/notes/reviews/ASTRA-FINDINGS-nearest-region-b-*.md`). Paul then cut the live window: activation and
+invalidation run offline with the console stopped (#404). Whole-branch round 1
+(`docs/superpowers/notes/reviews/ASTRA-FINDINGS-nearest-region-b-branch-r1.md`): NOT READY, five P1 and three P2, census
+APPROVE. Stopping rule 2 fired (Task 10's and Task 6's families again), and Paul ruled on #404. This is round 2 of 3.
+
+## Fixed: do not re-argue
+
+- The offline-activation design (Paul's cut on #404). Report only mechanisms that fail to honour it.
+- Paul's rulings after round 1 (#404): `carlos accounts migrate` never creates a data-kind record, in any mode, and
+ refuses such a plan before writing (no legacy app with data remains); once active, a fleet the history recorded
+ (examined or closed) refuses add-box and reactivation, and growing it means invalidating, adding the box and
+ completing the history again.
+- The coordinator accepted for now: a box that joins a scanned region (from infra, which the console cannot refuse)
+ blocks data-kind creates in that region until the history is completed again. An "empty new box" admission is a
+ later feature with region autoscaling.
+- Kept from before: merge A's marking; S1-S4; the `apps place` cut; the start-up gate; a fleet's target set fixed once
+ recorded; static and service records exempt (`Record.DataKind()`); three modes; pools are no separate target.
+- Stated limits (README "three limits"): one console process per deployment; a region or fleet added after completion,
+ or a region a new box joins, takes no new instances until the history is completed again.
+- Task 11 and Task 12 (roll-script floor) are out of this merge.
+- Approved copy is applied verbatim; do not rewrite strings. Report a string only if it states something the code does
+ not do. Reused existing strings are listed at the end of the copy note.
+
+## Round 2
+
+First give one line per P1 and P2 from round 1 (`ASTRA-FINDINGS-nearest-region-b-branch-r1.md`): resolved, partly, or
+not. Carry every unresolved or partly resolved finding forward at its current severity, then add new findings. The
+verdict covers everything outstanding, earlier rounds included. The round 1 fixes, for reference:
+
+1. Serve lock: `cmd/console/servelock_unix.go` makes the database directory first; `main.go` `serve()` refuses on any
+ lock error; the Windows stub refuses. Tests through the built binary: `cmd/console/servelock_test.go`.
+2. Migration: `accounts_hostsused.go` (`beforeRecord`, `refuseDataRecords`, `copyMigrationRecord`, `checkMigrationFloor`)
+ and `accounts.go` `runAccountsMigrate`; the history's mode is no longer read.
+3. Fleet coverage: `internal/console/hostsused.go` `fleetGrowthRefusal` at `fleets.go` `handleAPIFleetAddBox`, and
+ `hostsCoverageRefusal` (a fleet's or region's targets now must all be recorded) inside `gateDataCreate`, which every
+ data-kind create writer calls before its mark (`createRecordMarked`, `createSidecarMarked`,
+ `lifetimes_create.go` `createRecordWithLifetimeLocked`). Roster helpers `rosterRegions`/`rosterFleet` in
+ `hostsused_activate.go` are shared with activation.
+4. Placement: `fleets.go` `placeAppTarget` refuses when the mode cannot be read.
+5. Box mapper: `internal/layout/hostsused.go` `flatNameHosts` marks every host-like prefix of a platform-suffixed
+ name's stem.
+6. `roster` takes the serve lock (`cmd/console/hostsused.go`).
+7. Witnesses: `internal/console/hostsused_coverage_test.go` (every door, seed and import included, lifetimes off and
+ on), `fleets_place_cut_test.go`, `hostsused_activate_test.go` (`TestActivateMarksAnAuxiliaryLeftover`),
+ `accounts_record_sequence_test.go`, `cmd/console/servelock_test.go`.
+8. Status help: `system.go` (E3).
+
+## What to check
+
+1. Each round 1 finding, against the fix above, and whether the fix opens a new path: a data-kind create writer that
+ does not reach `gateDataCreate`; a lock path where `serve` or an offline verb proceeds without the lock; a migrate
+ path that writes a data-kind record.
+2. `hostsCoverageRefusal`: compares the same target names activation recorded (`rosterRegions`, `rosterFleet`, and
+ `Activate`'s `RegionTargets`/`FleetTargets`); refuses (S5) when the edges files or the registry cannot be read; the
+ home region (`""`) is covered. Request budget: one edges snapshot read (a list plus a GET per edges file), or one
+ registry read for a fleet, per data-kind create while active; say if that is wrong.
+3. `fleetGrowthRefusal`: AddFleetBox both adds and reactivates; is there another path that makes a fleet box active?
+4. The merge of main (`35a61466`) brought region HA P1a (born-HA hosts, moves/imports/placement refusing HA hosts) and
+ P0's removal of claim code. Check the history's doors still hold on the merged tree, in particular any new or changed
+ create path P1a added.
+5. Tests: the new tests would fail without the fixes and drive the real doors.
+
+## Census
+
+The census moved, so this review also gives the census verdict (AGENTS.md, "The census: the reviewer decides"; under
+C2 the reviewer decides every class). Card: `docs/superpowers/notes/census-proposal-nearest-region-b.md`. Give a verdict,
+approve or reject with a finding, for:
+
+1. the unit `accounts.go` `runAccountsMigrate` (change: body), against its recorded disposition and basis on the card;
+2. each re-pinned envelope: `.`, `internal/layout`, `internal/provision`;
+3. the record-write census overlay `nearestRegionBWriteCensusInventory`
+ (`internal/provision/nearest_region_b_census_test.go`, now layered on main's `regionHAP1aWriteCensusInventory`), in
+ particular the re-pinned `Server.createRecordMarked`, `Server.createSidecarMarked`,
+ `Server.createRecordWithLifetimeLocked`, `Server.placeAppTarget`, and the new `beforeRecord` and `refuseDataRecords`;
+4. the console authority site `cmd/console/hostsused.go` `runHostsUsed` `os.Open(*listingsPath)` in
+ `internal/console/testdata/claim-authority-sites.txt` (resolved against main's removal of the enrolment-pass sites).
+
+Reject only with a concrete finding: root opening, running, querying or following something new from a path or input a
+tenant, an app or a box agent can create, write or name; or a weakened check, refusal, validation, argument or
+environment the basis relies on. Cite lines. End the census part with APPROVE (all) or REJECT (listed).
+
+## 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 section or task, the problem,
+the evidence (file:line, verified), the failure scenario, a concrete
+fix and the invariant or trust boundary it breaks (that is 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.
+
+Then the census verdict, APPROVE or REJECT, as above.
+
+Do not edit files. Do not spawn Anthropic-model reviewers or subagents of
+your own. Do not run the full test suites.