review brief: nearest-region-a Task 2, round 2
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 file changed,
+97
−0
docs/superpowers/notes/reviews/CODEX-REVIEW-BRIEF-nearest-region-a-task2-R2.md+97 −0
CI failed — run details
diff --git a/docs/superpowers/notes/reviews/CODEX-REVIEW-BRIEF-nearest-region-a-task2-R2.md b/docs/superpowers/notes/reviews/CODEX-REVIEW-BRIEF-nearest-region-a-task2-R2.md| new file mode 100644 |
| index 000000000..618b7d7b5 |
| --- /dev/null |
| +++ b/docs/superpowers/notes/reviews/CODEX-REVIEW-BRIEF-nearest-region-a-task2-R2.md |
| @@ -0,0 +1,97 @@ |
| +# Review brief: nearest-region never-reuse, Task 2 (hostname history store, data-kind predicate, kind immutability), round 2 of 3 |
| + |
| +Repo carlos/platform, branch `nearest-region-a`, commit da9f765e (the brief's own commit follows it; review the code at that commit). |
| +Under review: Task 2's commits `b5660975` and `da9f765e` (the round 1 fix), that is: |
| +`internal/provision/hostsused.go` (new), `internal/provision/hostsused_test.go` (new), |
| +`internal/provision/record_sequence.go` (`WriteRecord`), and the census bookkeeping |
| +(`nearest_region_a_census_test.go`, `plan9_b8_census_test.go`, `testdata/plan14-root-reads-*`). |
| +Authorities: the accepted spec `docs/superpowers/specs/2026-10-26-nearest-region-without-claims-design.md` |
| +(rev 5, accepted by Paul 2026-10-26) and its plan `docs/superpowers/plans/2026-10-26-nearest-region-never-reuse.md`, |
| +Task 2. Both were reviewed and accepted on `design-nearest-region-199` and are carried unchanged on this |
| +branch (commit 9ceae022), so they land with this merge; treat them as fixed authorities, not as unmerged |
| +work. AGENTS.md on main ("Stopping rules", "The census"). |
| + |
| +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 (§1-§5, §3a): marks are create-only and never deleted; data kinds are every |
| + record whose `KindOrDefault()` is not `static` or `service`, plus sidecars; an absent `@mode` means |
| + `incomplete`; one console process per deployment. Report only mechanisms that fail to honour them. |
| +- This is merge A: nothing reads `@floor` yet and no door writes `@mode` yet (Tasks 5-10 are merge B). |
| + Do not report missing merge-B behaviour. |
| + |
| +## What to check |
| + |
| +1. `MarkHostUsed` is create-only (`Put` with `ifMatch ""`), maps only `release.ErrCASConflict` to |
| + `(false, nil)`, and passes every other store error through. Check `release.Store` implementations |
| + (`DirStore`, `S3Store`, any wrapper the console uses) answer a create-only conflict with |
| + `ErrCASConflict` and nothing else, so an outage can never read as "already marked". |
| +2. `HostsUsedKey` returns `""` for anything `controlname.ValidHostShape` refuses, and no valid hostname |
| + can collide with `@mode` or `@floor`, or escape the prefix. |
| +3. `ReadHostsMode`: absent is `incomplete`; an unreadable or unknown body is an error and never a |
| + default. `WriteHostsMode` refuses unknown modes. |
| +4. Kind immutability in `WriteRecord` (`checkKindUnchanged`): an in-place write that changes a record's |
| + kind is refused with `ErrKindChange`; a create from `{}` may be any kind; `""` and `instance` are one |
| + kind. The tombstone exemption: `provision.TombstoneBody` keeps no `kind`, so without the exemption |
| + retiring a static record would be refused. Check the exemption cannot be used to turn a live exempt |
| + record into a live data-kind record (is there any writer that writes a non-tombstone body over a |
| + tombstone in place?), and that every existing `WriteRecord` caller (console lifetimes, hostops, |
| + `accounts_record_sequence.go`, `provision` update paths, the nested prepared-record path for store |
| + wrappers) still works: none of them may now be refused for a write that keeps the kind. |
| +5. `Record.DataKind` matches the spec's exemptions exactly (addr-backed `instance` is a data kind). |
| +6. The record-write census entries (`nearest_region_a_census_test.go`) classify the new `Put` sites |
| + correctly (`nonrecord`), and nothing in the diff weakens a census. |
| + |
| +## Round 2 |
| + |
| +Earlier rounds: round 1, `docs/superpowers/notes/reviews/ASTRA-FINDINGS-nearest-region-a-task2-r1.md` |
| +(one P1, no P2). The round number counts every earlier review of this change, under any file name |
| +or reviewer. |
| + |
| +First give one line per P1 and P2 from round 1: 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 fix: `checkKindUnchanged` now decodes `before` |
| +and the exact bytes about to be written with `json.Unmarshal` into a struct tagged like `Record` |
| +(the rules `DecodeRecord` uses), after any sequence re-encoding, immediately before the `Put`. A |
| +body that does not decode is refused unless it is byte-identical to `before`. Regression test: |
| +`TestWriteRecordKindReadsAsReadersDo`. Fault family of round 1: an exempt record must never become a |
| +live data-kind record in place. A second finding in that family stops the review (AGENTS.md |
| +stopping rule 2), so name the family beside each finding. |
| + |
| +Commit `da9f765e` also leaves the root-read census overlay as it was at `b5660975`; the census is |
| +re-proposed once for the whole branch at its end. Do not report that. |
| + |
| +## 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. |