carlos / platform Public

review briefs: nearest-region-b Task 7 round 2, Task 8 and Task 10 round 1

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev 8d72418668b3886b476d304f846c0b3aea84a937 parent 9c56fdb
3 files changed, +240 −0
  • docs/superpowers/notes/reviews/CODEX-REVIEW-BRIEF-nearest-region-b-task10.md +72 −0
  • docs/superpowers/notes/reviews/CODEX-REVIEW-BRIEF-nearest-region-b-task7-R2.md +95 −0
  • docs/superpowers/notes/reviews/CODEX-REVIEW-BRIEF-nearest-region-b-task8.md +73 −0

CI failed — run details

diff --git a/docs/superpowers/notes/reviews/CODEX-REVIEW-BRIEF-nearest-region-b-task10.md b/docs/superpowers/notes/reviews/CODEX-REVIEW-BRIEF-nearest-region-b-task10.md
new file mode 100644
index 000000000..92aab4573
--- /dev/null
+++ b/docs/superpowers/notes/reviews/CODEX-REVIEW-BRIEF-nearest-region-b-task10.md
@@ -0,0 +1,72 @@
+# Review brief: nearest-region never-reuse, Task 10 (accounts migrate resurrection cut, and the CLI floor), 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).
+Authorities, on main: the spec `docs/superpowers/specs/2026-10-26-nearest-region-without-claims-design.md`
+(rev 5), 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 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.
+
+Under review: Task 10 in commit `e457d865`: `accounts_hostsused.go` (`readMigrationHistory`, `buildMeetsFloor`,
+`migrationRecordHost`, `beforeRecord`), the two call sites in `accounts.go` (`runAccountsMigrate`), and the new
+tests in `accounts_record_sequence_test.go`. Spec §2 (the migrate row) and §4 (the floor), plan Task 10.
+
+## Fixed: do not re-argue
+
+- Paul's rulings in the spec: after activation `carlos accounts migrate` refuses to create a data-kind record
+ at an absent destination (S6); an identical present destination and unrelated objects still migrate; the
+ verb keeps its sources, so a re-run would otherwise resurrect a record; the floor covers the console and
+ this verb, and from this release the CLI reads `@floor` and refuses below it (B10).
+- Design choices, with reasons: the S6 check applies in every mode but `incomplete` (activating and
+ invalidated included: the verb is not admitted into the window's drain). A different present destination
+ is left to the verb's existing "different content" refusal. A build meets the floor when both are release
+ tags and it is not older, or when it is the floor's own commit; a dev build or bare commit refuses.
+- The roll-script floor (Task 12) lives in another repo.
+- Census: approved once for the branch; do not report it.
+
+## What to check
+
+1. The floor is checked before any write, including in `--dry-run` paths that could write, and its version
+ comparison is right for release tags (`release.ParseSemVer` via `newerVersion`).
+2. Before the window, a data-kind record's copy marks its hostname first (create-only; an existing mark
+ passes); exempt kinds and other objects do not mark; a sidecar uses the host in its body.
+3. From the window on, no data-kind record (instance or sidecar) is created at an absent destination; the
+ copy of a present one is unchanged. Is there any other path in the verb that writes a record (the pointer
+ converge branch, the legacy-source path, the registry rewrite) that could create a data-kind record?
+4. The tests would fail without the implementation, and exercise the verb's record step as `runAccountsMigrate`
+ does.
+
+## 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-R2.md b/docs/superpowers/notes/reviews/CODEX-REVIEW-BRIEF-nearest-region-b-task7-R2.md
new file mode 100644
index 000000000..f6ccb5e63
--- /dev/null
+++ b/docs/superpowers/notes/reviews/CODEX-REVIEW-BRIEF-nearest-region-b-task7-R2.md
@@ -0,0 +1,95 @@
+# Review brief: nearest-region never-reuse, Task 7 (enforcement once active), 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 7 in commit `b052cd8b` with the round 1 fixes in `9c56fdbd`: `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.
+
+## Round 2
+
+Earlier rounds: round 1, `docs/superpowers/notes/reviews/ASTRA-FINDINGS-nearest-region-b-task7-r1.md` (one P1,
+one P2). First give one line per P1 and P2 from round 1: resolved, partly, or not, then new findings with
+their fault families. Round 1's: a detected breach must keep data-kind creates refused until re-inventory
+(P1); enforcement witnessed at the publishing doors (P2). A second finding in round 1's P1 family stops the
+review (stopping rule 2).
+
+The fixes: `invalidateHosts` pages whether or not its write lands; a failed write latches invalidated in the
+process (`hostsHistory.latched`; `loadHostsLocked` overrides a stale active read) and `persistInvalidation`
+writes it again until it lands or the store leaves active; any landed mode write clears the latch.
+Witnesses: `TestFailedInvalidationStillRefuses`, `TestUnexaminedTargetRefusedAtEveryDoor`,
+`TestAutomaticRegionNeedsTheHistory`.
+
+## 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-task8.md b/docs/superpowers/notes/reviews/CODEX-REVIEW-BRIEF-nearest-region-b-task8.md
new file mode 100644
index 000000000..906386116
--- /dev/null
+++ b/docs/superpowers/notes/reviews/CODEX-REVIEW-BRIEF-nearest-region-b-task8.md
@@ -0,0 +1,73 @@
+# Review brief: nearest-region never-reuse, Task 8 (tripwire, invalidation and restore), 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).
+Authorities, on main: the spec `docs/superpowers/specs/2026-10-26-nearest-region-without-claims-design.md`
+(rev 5), 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 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.
+
+Under review: Task 8 in commit `e457d865`: `internal/console/hostsused_tripwire.go` (the start-time tripwire,
+`RunHostsTripwire`, the invalidate door), the call from `LoadHostsMode` (`hostsused.go`), the CLI verb
+`invalidate` (`system_hostsused.go`), the route registration, and `hostsused_tripwire_test.go`. Spec §4
+(Tripwire, Restores) and plan Task 8. `invalidateHosts` itself was changed for Task 7 in `9c56fdbd`
+(latching a failed write); read it as context.
+
+## Fixed: do not re-argue
+
+- Paul's rulings in the spec (§4): the tripwire runs at each console start with the history active; its cost
+ is two listings plus a GET per unmarked record; any restore that may have dropped marks enters invalidated;
+ leaving invalidated needs a fresh inventory and `complete`.
+- A store error during the start's tripwire is not a breach: it is retried in the background and never
+ invalidates by itself.
+- Census: approved once for the branch; do not report it.
+
+## What to check
+
+1. Every record a box could serve as a data kind and that no mark covers is found at start: instance keys
+ (by the key's host), sidecar keys (by the body's host), undecodable bodies, any app or account; exempt
+ bodies are skipped. Could a dropped mark for a data-kind record escape the check?
+2. Invalidation from the tripwire, recovery or the operator door leaves data-kind creates refused (S5) and
+ the nearest-region switch off, across a restart, until begin/complete; an operator can re-inventory from
+ invalidated (`TestReinventoryLeavesInvalidated`).
+3. The invalidate door: operators only, closed to service credentials, C11 under claims or Phase 1, C12 when
+ not active, D4 as the reason; the CLI prints B9.
+4. Start behaviour: the tripwire runs before the console serves where it can (`LoadHostsMode`), and when it
+ cannot finish, the retry loop runs until it does. Is there a window in which an uncovered record lets a
+ create through that the tripwire would have refused?
+5. The tests go through real entry points 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.