carlos / platform Public

nearest-region-b: whole-branch review r1 findings (NOT READY; census APPROVE)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev deedadd2240cb18ed1abc3d9198610666bef3e76 parent db2ebc6
1 file changed, +60 −0
  • docs/superpowers/notes/reviews/ASTRA-FINDINGS-nearest-region-b-branch-r1.md +60 −0

CI failed — run details

diff --git a/docs/superpowers/notes/reviews/ASTRA-FINDINGS-nearest-region-b-branch-r1.md b/docs/superpowers/notes/reviews/ASTRA-FINDINGS-nearest-region-b-branch-r1.md
new file mode 100644
index 000000000..55384d4df
--- /dev/null
+++ b/docs/superpowers/notes/reviews/ASTRA-FINDINGS-nearest-region-b-branch-r1.md
@@ -0,0 +1,60 @@
+Reviewed `db2ebc63621dfaa7a5d1365becc9b2831abab6f8`, whole-branch round 1 under the reworked brief.
+
+1. **P1 — Serve-lock errors permit an unlocked console.** Brief §1.
+ [`serve()`](cmd/console/main.go:314) continues after every lock error except contention. On a fresh installation, the database directory can be absent: opening the lock fails, then [`console.Open`](internal/console/store.go:93) creates that directory and serving proceeds. An offline command can subsequently acquire the lock while this console remains live. Windows also takes the unlocked-serving path.
+ **Fix:** establish the parent directory before locking and refuse serving on every lock failure. Test the actual serve path with a missing parent and an unavailable lock.
+ **Fault family:** offline activation must exclude the serving console.
+
+2. **P1 — A migration can retain permission to publish across offline activation.** Brief §8; Task 10 r1 finding 2 survives.
+ [`runAccountsMigrate`](accounts.go:345) reads history once. [`beforeRecord`](accounts_hostsused.go:120) trusts that cached mode; its incomplete branch ignores an existing mark and permits the subsequent copy. This process holds no console serve lock.
+ **Failure:** pause a migration after it reads `incomplete`, stop the console, activate, then resume the migration. It can recreate an absent destination despite activation having marked that hostname’s retained data.
+ **Fix:** make pre-activation migration publication mutually exclusive with activation, using an enforced boundary covering every permitted CLI execution location, or remove data-kind migration copying. A fresh mode GET alone leaves a check/write race. Add a paused-migration witness.
+ **Fault family:** activation must exclude every outstanding data-kind publisher.
+
+3. **P1 — Examined fleets can acquire unscanned boxes and continue admitting instances.** Brief §5.
+ [`hostsTargetRefusal`](internal/console/hostsused.go:192) checks only fleet membership in `Examined` and `Closed`. Although activation records `FleetTargets`, admission never compares them. [`handleAPIFleetAddBox`](internal/console/fleets.go:303) still adds or reactivates boxes without consulting history.
+ **Failure:** activate fleet F, attach an unscanned box containing old data for H, then create H on F. F remains examined, H has no mark, and creation passes.
+ **Fix:** enforce the recorded fleet target set at membership changes, refusing additions/reactivations until covered by offline inventory. Test add-box followed by an actual instance request.
+ **Fault family:** inventory coverage must remain valid for every admitted fleet.
+
+4. **P1 — Placement fails open when the history mode cannot be read.** Brief §5; Task 9.
+ [`placeAppTarget`](internal/console/fleets.go:576) refuses only when `err == nil`. A failed startup mode read followed by another failed mode read at this door falls through to placement writes, including [`SetRecordRegion`](internal/console/fleets.go:702).
+ **Failure:** persisted history is active, but mode reads fail transiently. An existing app can be moved onto a closed, unscanned fleet while other store operations succeed.
+ **Fix:** refuse placement whenever the mode is unreadable, before opening the registry or writing anything. Add a real-door failure-injection witness.
+ **Fault family:** unavailable history must not authorize placement changes.
+
+5. **P1 — Fixed-suffix parsing can omit the actual owner of leftover app data.** Brief §3.
+ [`flatNameHosts`](internal/layout/hostsused.go:117) returns immediately after stripping a platform suffix. For `shop.example.com.backup.db`, it returns only `shop.example.com.backup`. However, [`belongsTo`](internal/layout/extras.go:54) also recognizes that file as belonging to `shop.example.com`.
+ **Failure:** the primary database and record are gone, but this auxiliary database remains. Activation succeeds without marking `shop.example.com`; recreating it can expose that retained data.
+ **Fix:** preserve every possible host owner across suffix parsing, or refuse ambiguous entries. Test activation with only this leftover present and then attempt recreation.
+ **Fault family:** inventory must cover every hostname whose retained data a new instance could read.
+
+6. **P2 — `roster` does not take the required serve lock.** Brief §1.
+ The [`roster` branch](cmd/console/hostsused.go:85) reads configuration and writes its output without calling `holdServeLock`. It therefore succeeds while the console is running, contrary to the required offline workflow.
+ **Fix:** acquire and retain the same lock before reading the roster, and test refusal while another process holds it.
+ **Fault family:** offline commands must establish that the console is stopped.
+
+7. **P2 — Required command and seed/import witnesses remain missing.** Brief §11.
+ [`TestHostsUsedVerbsNeedTheConsoleStopped`](cmd/console/servelock_test.go:42) exercises only `invalidate`; activation tests call `HostsActivation.Activate` directly. Removing the `roster` or `activate` command wiring would escape these tests. [`TestUnexaminedTargetRefusedAtEveryDoor`](internal/console/hostsused_active_test.go:322) also explicitly skips seed/import fixtures, preserving Task 7 r2’s P2 gap.
+ **Fix:** exercise roster and activation through `runHostsUsed` or isolated subprocesses, and seed/import target refusal through real requests with lifetimes off and on.
+ **Fault family:** regression witnesses must cover production enforcement wiring.
+
+8. **P2 — Status help promises settling-work information that was removed.** Brief §10.
+ [`system.go:177`](system.go:177) says status reports “how much work is still settling,” but [`hostsUsedStatus`](internal/console/hostsused_status.go:17) contains no such counts.
+ **Fix:** align the approved help text with the retained status fields.
+ **Fault family:** command documentation must describe observable behavior.
+
+No files changed, no subagents were spawned, and `GOCACHE` remained unset. Targeted tests could not start because the read-only sandbox blocked Go’s work directory; Windows compilation remains unverified. Changed Go files passed formatting inspection. Static fingerprint checks matched the three census envelopes, `runAccountsMigrate`, and all record-write overlay replacements.
+
+**NOT READY**
+
+Census verdicts, under the brief’s root-input and authority criteria:
+
+- **APPROVE — `runAccountsMigrate`:** existing registry and destination-key authority remains unchanged; new history reads use fixed control keys. Inspected [accounts.go:341](accounts.go:341) and [accounts_hostsused.go:112](accounts_hostsused.go:112). Finding 2 blocks functional approval of the branch.
+- **APPROVE — `.` envelope:** migration changes above and [system_hostsused.go:38](system_hostsused.go:38) introduce no new tenant-controlled root input.
+- **APPROVE — `internal/layout` envelope:** [hostsused.go:33](internal/layout/hostsused.go:33) performs pure string mapping, without filesystem access. Finding 5 concerns inventory correctness.
+- **APPROVE — `internal/provision` envelope:** [hostsused.go:150](internal/provision/hostsused.go:150) retains fixed control-key access; [hostsused_map.go:25](internal/provision/hostsused_map.go:25) is pure mapping.
+- **APPROVE — record-write overlay:** the classifications and replacement fingerprints at [nearest_region_b_census_test.go:48](internal/provision/nearest_region_b_census_test.go:48) match their implementations.
+- **APPROVE — console authority site:** [hostsused.go:125](cmd/console/hostsused.go:125) opens the operator-supplied listings file after acquiring the offline lock; no tenant request selects that path.
+
+**APPROVE (all)**
\ No newline at end of file