carlos / platform Public

review brief: nearest-region-b Task 5, round 1

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

CI failed — run details

diff --git a/docs/superpowers/notes/reviews/CODEX-REVIEW-BRIEF-nearest-region-b-task5.md b/docs/superpowers/notes/reviews/CODEX-REVIEW-BRIEF-nearest-region-b-task5.md
new file mode 100644
index 000000000..7ec6a7a9d
--- /dev/null
+++ b/docs/superpowers/notes/reviews/CODEX-REVIEW-BRIEF-nearest-region-b-task5.md
@@ -0,0 +1,83 @@
+# Review brief: nearest-region never-reuse, Task 5 (the activation window: modes, admissions, drain), 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: commit `58873885` (`git show 58873885`): `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.
+
+## 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.