review briefs: nearest-region-b Task 5 round 3, Task 6 round 2, Task 7 round 1
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
3 files changed,
+294
−0
docs/superpowers/notes/reviews/CODEX-REVIEW-BRIEF-nearest-region-b-task5-R3.md+103 −0docs/superpowers/notes/reviews/CODEX-REVIEW-BRIEF-nearest-region-b-task6-R2.md+110 −0docs/superpowers/notes/reviews/CODEX-REVIEW-BRIEF-nearest-region-b-task7.md+81 −0
CI failed — run details
diff --git a/docs/superpowers/notes/reviews/CODEX-REVIEW-BRIEF-nearest-region-b-task5-R3.md b/docs/superpowers/notes/reviews/CODEX-REVIEW-BRIEF-nearest-region-b-task5-R3.md| new file mode 100644 |
| index 000000000..45e57d56b |
| --- /dev/null |
| +++ b/docs/superpowers/notes/reviews/CODEX-REVIEW-BRIEF-nearest-region-b-task5-R3.md |
| @@ -0,0 +1,103 @@ |
| +# Review brief: nearest-region never-reuse, Task 5 (the activation window: modes, admissions, drain), round 3 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: Task 5 as of commits `58873885`, the round 1 fixes in `416e0a89` and the round 2 fix in `eb54407b` (which also carries Task 6; Task 6's import, close-fleet and complete code is reviewed separately and is out of scope here, except where it changes Task 5's drain or transitions): `internal/provision/hostsused.go` (HostsState), |
| +`internal/console/hostsused.go` (state, transitions, admissions), `internal/console/hostsused_window.go` |
| +(status, begin, cancel doors), the admission call sites in `apiinstances.go`, `apisidecars.go`, |
| +`apiinstancemove.go`, `apiinstancemove_offline.go`, `fleets.go` (`placeAppTarget`), `cmd/console/main.go` |
| +(the start-time read), the CLI verbs in `system_hostsused.go`, their tests, and census bookkeeping. |
| +Authorities, all on main: the spec `docs/superpowers/specs/2026-10-26-nearest-region-without-claims-design.md` |
| +(rev 5, §3a and §4), the plan `docs/superpowers/plans/2026-10-26-nearest-region-never-reuse.md` (Task 5), the |
| +approved copy `docs/superpowers/notes/copy/nearest-region-never-reuse.md` (S1-S8) and, on this branch, |
| +`docs/superpowers/notes/copy/nearest-region-never-reuse-b.md` (approved). Merge A (Tasks 2-4) is merged |
| +(70d37672) and closed. |
| + |
| +You are an independent reviewer. Read the document, then the code it |
| +names, and check every claim against that code. |
| + |
| +## Fixed: do not re-argue |
| + |
| +- Paul's rulings in the spec, including one console process per deployment that reads `@mode` once at start. |
| +- An accepted deviation (coordinator, 2026-10-26; noted in spec §3a item 5): `cancel` returns to the mode |
| + `begin` started from, so a window opened from invalidated goes back to invalidated. |
| +- Out of scope here, later tasks on this branch: the roster, import, close-fleet and complete (Task 6), the |
| + examined-target refusals, recovery marking and the nearest-region switch gate (Task 7), the tripwire and |
| + invalidate door (Task 8), `apps place` in active (Task 9), `accounts migrate` (Task 10), README (Task 13). |
| + `HostsState` already has fields for them; their writers come later. |
| +- Approved strings are applied verbatim; report wording only if it misstates what the code does. |
| + |
| +## What to check |
| + |
| +1. While the window is open, every data-kind create door refuses with S8 (instance in every placement, |
| + seed, import, sidecar), and every admission of new data movement refuses with S7: offline start and |
| + stage, the move request (both the Phase 1 handler and the legacy one), and `placeAppTarget` (all three |
| + of its callers). Exempt kinds and every other door keep working, including the offline seal, flip, |
| + open, finish and abort doors and move cut and abort, which admitted moves need in order to finish. |
| + Look for an admission door that is missing (any other way to start moving data, or to create a data-kind |
| + record), and for any refusal that comes before the caller's gate (a non-member must still get the 404). |
| +2. The drain: every admitted create, move and placement is counted from admission until its handler |
| + returns, on every return path; nothing admitted can persist a record or start a move without having |
| + been counted; `pending_allocations`, `pending_retirements` and `unfinished_moves` cover the rest of |
| + §3a item 2. Check whether a seed's detached copy, or any other work continuing after its handler |
| + returns, can create or move data that none of the counts see. |
| +3. Mode transitions: `hostsTransition` writes the store and the process together on the held ETag; a |
| + lost race or a failed write leaves no divergence that could let a create through; the start-time read |
| + happens before the console serves; an unreadable mode refuses rather than defaulting. |
| +4. `begin` refuses under host claims or Phase 1 (C11), from active (C1) and when already open (C2); |
| + `cancel` refuses with no window open (C3). Operators only; closed to every service credential. |
| +5. Request budget: no per-request GET; `unfinished_moves` (one listing plus a GET per record) is read |
| + only by the status door and only while the window is open. |
| +6. The tests go through the real doors and would fail without the implementation. |
| + |
| +## Round 3 (the last) |
| + |
| +Earlier rounds: `ASTRA-FINDINGS-nearest-region-b-task5-r1.md` (two P1s, one P2) and `-r2.md` (one P1 in |
| +round 1's drain-completeness family, which triggered stopping rule 2). Paul chose option 1 (recorded on |
| +#404): one in-process counter that every background seed copy or upload holds until its last write, |
| +counted by the drain, plus a guard test that fails if any background writer skips it. That is the fault |
| +family's single enforcement point, and this round checks it. |
| + |
| +The fix: `goSeedWorker` (`internal/console/hostsused.go`) is the one way a seed copy (`runFrom`) or import |
| +upload (`runImportUpload`) runs detached; it holds `seedCopies` and the drain count from before the |
| +goroutine starts until the worker returns. `TestEverySeedWorkerIsCounted` scans the seed and import |
| +files for any other goroutine or `seedCopies.Add`. Witness: `TestDrainHoldsADetachedUploadPastItsAbort`. |
| + |
| +First give one line per P1 and P2 from rounds 1 and 2: resolved, partly, or not. Check above all that the |
| +enforcement point is complete: every detached writer of seed or import data (and any other background |
| +work a create starts that writes data a box could later read for its hostname) goes through it, the guard |
| +would catch a new one, and nothing writes after the count is released. A NOT READY in this round also |
| +says whether the P1s share one cause, and whether refusing the case up front or cutting the feature would |
| +remove them. |
| + |
| +## 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. |
| + |
| +In round 3, a NOT READY also says whether the P1s share one cause, and |
| +whether refusing the case up front or cutting the feature would remove |
| +them. |
| + |
| +Do not edit files. Do not spawn Anthropic-model reviewers or subagents of |
| +your own. Do not run the full test suites. |
diff --git a/docs/superpowers/notes/reviews/CODEX-REVIEW-BRIEF-nearest-region-b-task6-R2.md b/docs/superpowers/notes/reviews/CODEX-REVIEW-BRIEF-nearest-region-b-task6-R2.md| new file mode 100644 |
| index 000000000..58eb428a9 |
| --- /dev/null |
| +++ b/docs/superpowers/notes/reviews/CODEX-REVIEW-BRIEF-nearest-region-b-task6-R2.md |
| @@ -0,0 +1,110 @@ |
| +# Review brief: nearest-region never-reuse, Task 6 (inventory, import and complete), 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: Task 6 in commit `416e0a89` with the round 1 fixes in `eb54407b`: `internal/provision/hostsused_map.go` (bucket listings to hostnames, `TargetListing`), `internal/layout/hostsused.go` (box listings, moved there in round 1), `internal/console/hostsused_inventory.go` (roster, import, close-fleet, complete), |
| +`internal/console/hostsused_listings.go` (listings in the control bucket), `internal/console/hostsused_store.go` |
| +(`LifetimeHosts`), the window's roster and status additions in `hostsused_window.go`, the CLI verbs in |
| +`system_hostsused.go`, and their tests. The same commit also carries Task 5's round 1 fixes, which have |
| +their own review; treat Task 5 as given. |
| +Authorities, on main: the spec `docs/superpowers/specs/2026-10-26-nearest-region-without-claims-design.md` |
| +(rev 5, §3 and §3a), the plan `docs/superpowers/plans/2026-10-26-nearest-region-never-reuse.md` (Task 6, and |
| +Review Focus items 2, 4 and 5), the approved copy `docs/superpowers/notes/copy/nearest-region-never-reuse.md`; |
| +on this branch, the approved `docs/superpowers/notes/copy/nearest-region-never-reuse-b.md`. |
| + |
| +You are an independent reviewer. Read the document, then the code it |
| +names, and check every claim against that code. |
| + |
| +## Fixed: do not re-argue |
| + |
| +- Paul's rulings in the spec: deleted history and noncurrent versions are not sources (§1); regions and |
| + pools cannot be closed, fleets can (§3); marks are never deleted and over-marking is the accepted cost. |
| +- The adapter (scan script, Task 11) and the roll-script floor (Task 12) are outside this repo's branch. |
| +- Out of scope, later tasks: enforcement of the examined set and closed fleets at create, and recovery |
| + marking (Task 7); the tripwire (Task 8); `apps place` and `accounts migrate` (Tasks 9, 10). |
| +- Design choices made here, with reasons: listings live in the control bucket beside the history |
| + (`control/hosts-used-window/`), not in console SQLite, so a database restore cannot drop them and no new |
| + table is needed. Each fleet's listing targets are fixed in the state at `begin`. A flat box entry marks |
| + every host-like prefix ending at "." or "-" (an app may name its files from its database path); a name |
| + carrying one of the platform's own suffixes is read exactly, so the box's own files are nobody's. |
| +- The root-read census has three new units awaiting the census owner's decision on #280; do not report |
| + the census as failing. Paul has ruled that the cross-model reviewer approves or rejects every census |
| + class; that is done once for the branch, not here. |
| +- Pools are not a separate target (round 1 P2's fix): their boxes are on the roster through their edges |
| + files, and S4 checks region codes and fleets. |
| + |
| +## What to check |
| + |
| +1. Hazard-completeness of the sources (spec §3): every place a box could read an earlier record's data |
| + for a hostname maps to that hostname, or is reported unmapped so `complete` refuses. Check the bucket |
| + roots (`<replicaPrefix>/`, `moves/`, `moves/@offline/`, `seeds/`; `moves/@lanes/` skipped) against the |
| + code that writes them (`activator.HibernatePrefix`, `activator.MovesPrefix`, `moves.StagingPrefix`, |
| + `moves` offline keys, `seeds`), and the box shapes (flat, nested `instances/<InstanceID>`, |
| + `.instances/`, hashed ids, `.offline-moves/`) against `provision.InstanceID`, `internal/layout` and the |
| + offline move code. Review Focus 2 (suffix hosts stay distinct) and 5 (no normalisation; invalid shapes |
| + unmapped). |
| +2. Source 1 reads raw keys under `apps/` whatever their app or account; only a body decoding to static or |
| + service is skipped; an undecodable instance body is marked by its key; an undecodable sidecar body |
| + refuses. Source 4 includes every row of the three lifetime tables, any state, any writer version. |
| +3. `complete` refuses exactly as the plan lists: not activating, any drain count non-zero (in-flight, |
| + pending allocations and retirements, unfinished moves and seeds), a roster target with no listing and |
| + not excused by a closed fleet, a failed listing, any unmapped entry, a roster change since `begin`, |
| + host claims or Phase 1 on. On success it writes every mark, then the floor, then `active` with the |
| + examined set; check the ordering leaves no state where `active` holds with marks missing, and that a |
| + failure part-way can be retried. |
| +4. The roster: edges files read completely or refused; fleets and their boxes from the registry; |
| + `region:<placement code>` is the vocabulary a record's Region uses; detached fleet boxes are left out. |
| + Check whether any box or bucket that can hold data is missing from the roster. |
| +5. `import` refuses a target off the roster before storing anything; a re-import replaces; `close-fleet` |
| + refuses anything but a roster fleet (C5). Operators only; closed to service credentials. |
| +6. Approved strings are used verbatim (C4-C11, B4-B8, A10-A13). |
| +7. The witnesses go through the real doors and would fail without the implementation. |
| + |
| +## Round 2 |
| + |
| +Earlier rounds: round 1, `docs/superpowers/notes/reviews/ASTRA-FINDINGS-nearest-region-b-task6-r1.md` |
| +(three P1s, two P2s). First give one line per P1 and P2 from round 1: resolved, partly, or not. Carry |
| +every unresolved or partly resolved finding forward, then add new findings, each with its fault family. |
| +Round 1's families: fleet closure waiving an open target's inventory (P1 1); activation using one |
| +uninterrupted window (P1 2); raw instance-directory ownership (P1 3); invalid names failing closed (P2 4); |
| +examined targets from the frozen roster (P2 5). A second finding in the same family as a round 1 P1 stops |
| +the review (stopping rule 2). |
| + |
| +The fixes: `closedTargets` excuses a target only when no region (`RegionTargets`, fixed at begin) and no |
| +open fleet uses it; `begin` gives the window an id (`HostsState.Window`), listings carry it, and |
| +`complete`'s transition requires the same window; `HostsFromBoxListing` moved to `internal/layout`; |
| +malformed dotted flat names are unmapped and hidden entries mark host-like segments; pools left the |
| +examined set. Witnesses: `TestClosingAFleetKeepsASharedBucket`, `TestStaleCompleteCannotActivateANewWindow`, |
| +`TestBoxListingNormalisation`, `TestBoxListingHiddenEntries`, `TestCompleteRefusesUnmappable`. |
| + |
| +## 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. |
| + |
| +In round 3, a NOT READY also says whether the P1s share one cause, and |
| +whether refusing the case up front or cutting the feature would remove |
| +them. |
| + |
| +Do not edit files. Do not spawn Anthropic-model reviewers or subagents of |
| +your own. Do not run the full test suites. |
diff --git a/docs/superpowers/notes/reviews/CODEX-REVIEW-BRIEF-nearest-region-b-task7.md b/docs/superpowers/notes/reviews/CODEX-REVIEW-BRIEF-nearest-region-b-task7.md| new file mode 100644 |
| index 000000000..9f164dd6b |
| --- /dev/null |
| +++ b/docs/superpowers/notes/reviews/CODEX-REVIEW-BRIEF-nearest-region-b-task7.md |
| @@ -0,0 +1,81 @@ |
| +# Review brief: nearest-region never-reuse, Task 7 (enforcement once active), round 1 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: Task 7 in commit `b052cd8b` (`git show b052cd8b`): `recoveryMark`, `hostsTargetRefusal`, |
| +`regionExamined`, `invalidateHosts` and `LoadHostsMode` in `internal/console/hostsused.go`; `allocRecordLocked` |
| +and `allocationDataKind` in `lifetimes_create.go`; the recovery call sites in `lifetimes_recovery.go`; |
| +`appRegionsOn` (`regionconfig.go`); `regionCands` (`regioncandidates.go`); the S4 call sites in |
| +`apiinstances.go`, `apisidecars.go` and `apicli.go` (app create with a placement); their tests in |
| +`hostsused_active_test.go`, and the test-fixture changes that hold the history active where app regions are |
| +on. Later commits on the branch belong to Tasks 5 and 6; read them only as context. |
| +Authorities, on main: the spec `docs/superpowers/specs/2026-10-26-nearest-region-without-claims-design.md` |
| +(rev 5, §2-§4), the plan `docs/superpowers/plans/2026-10-26-nearest-region-never-reuse.md` (Task 7 and Review |
| +Focus 1-3), `docs/superpowers/notes/copy/nearest-region-never-reuse.md` (S4, S5); on this branch, the approved |
| +`docs/superpowers/notes/copy/nearest-region-never-reuse-b.md` (D1, D3). |
| + |
| +You are an independent reviewer. Read the document, then the code it |
| +names, and check every claim against that code. |
| + |
| +## Fixed: do not re-argue |
| + |
| +- Paul's rulings in the spec: in `active` a mark conflict is S1 whoever wrote it; an absent mark at |
| + publication invalidates the history; the switch has no effect until active. |
| +- Pools are no separate target: S4 checks region codes and fleets (pool boxes are on the roster through |
| + their edges files). The home region ("" in records) is always examined. |
| +- An unexamined region drops out of the automatic choices by being marked ineligible in `regionCands`; |
| + an explicit create there reaches the door's S4. A stored app region there gets the existing |
| + app-region refusal (it fails eligibility), not S4. |
| +- Census: approved once for the branch by the cross-model reviewer; do not report it. |
| + |
| +## What to check |
| + |
| +1. Recovery (spec §2 row 2): every replay branch that publishes a record goes through the mark step for a |
| + data kind; in `incomplete` and `activating` it marks create-only; in `active` and `invalidated` it |
| + publishes only with the mark present; an absent mark in `active` invalidates (store and process) and |
| + pages, and the allocation stays pending; a read or write error leaves it pending. The door's own |
| + allocation (marked before `BeginAllocation`) skips the step without a second PUT. Exempt kinds never |
| + mark. Is there any other path that publishes a data-kind record without a mark? |
| +2. Two creates of one new hostname (Review Focus 1-3 and the plan's `TestConcurrentCreatesOneWins`): |
| + exactly one publishes, lifetimes off and on. |
| +3. `appRegionsOn` is false unless the history is active, and nothing assigns a new non-home region while |
| + incomplete; an app's already stored non-home region still works as today (spec §4). |
| +4. S4: a data-kind create (instance in every placement, seed, import, sidecar) on an unexamined region or |
| + fleet, or a closed fleet, is refused once active, after the caller gates; app creation with a placement |
| + on one is refused; nothing is refused before activation; exempt kinds pass. |
| +5. `invalidateHosts` and the D1/D3 texts are verbatim; a failed invalidation write leaves no state where |
| + creates proceed unrefused. |
| +6. The tests go through real doors or recovery passes, lifetimes off and on where the plan says, and would |
| + fail without the implementation. |
| + |
| +## 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. |
| + |
| +In round 3, a NOT READY also says whether the P1s share one cause, and |
| +whether refusing the case up front or cutting the feature would remove |
| +them. |
| + |
| +Do not edit files. Do not spawn Anthropic-model reviewers or subagents of |
| +your own. Do not run the full test suites. |