carlos / platform Public

Astra plan review round 2 on P1a: findings, unedited

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev e384a8d2d31ef0d10c2561166bc549743defc80a parent fd8d276
1 file changed, +158 −0
  • docs/superpowers/notes/reviews/ASTRA-FINDINGS-region-ha-p1a-plan-r2.md +158 −0

CI failed — run details

diff --git a/docs/superpowers/notes/reviews/ASTRA-FINDINGS-region-ha-p1a-plan-r2.md b/docs/superpowers/notes/reviews/ASTRA-FINDINGS-region-ha-p1a-plan-r2.md
new file mode 100644
index 000000000..9b33f5c94
--- /dev/null
+++ b/docs/superpowers/notes/reviews/ASTRA-FINDINGS-region-ha-p1a-plan-r2.md
@@ -0,0 +1,158 @@
+- **F1 — Partly, P1:** marker releases are specified, but existing direct-delete paths remain.
+- **F2 — Resolved:** `Fresh` no longer bypasses the migration gate.
+- **F3 — Partly, P1:** acquisition precedes validation, but incomplete baselines and stale inventories remain admissible.
+- **F4 — Partly, P1:** publication retries are covered; the admin-token gate targets a helper the claims-off launch paths bypass.
+- **F5 — Partly, P1:** shared helpers are preserved, but surviving tests still reference deleted code.
+- **F6 — Partly, P1:** migration signatures and adapters agree; the proposed fixture creates a test import cycle.
+- **F7 — Resolved:** the witness checks marker publication before acquisition and expects the new holder.
+- **F8 — Partly, P1:** sticky acquisition and reuse are specified, but rollback removes the capability used to refuse imports.
+- **F9 — Resolved:** publisher ownership and stop-and-join ordering are explicit.
+- **F10 — Partly, P2:** initialization is unconditional, but its proposed test bypasses agent wiring.
+- **F11 — Resolved:** simulation assertions now cover manifest writes, simultaneous runners and clean reuse.
+- **F12 — Resolved:** cross-box drills now require releases and specify their starting states.
+
+Reviewed `fd8d2769482697602bd608c452a5825eff8703b7` on `design-region-ha-no-claims`. Static review against the branch’s code and approved spec. No files changed, tests run, subagents spawned or dev actions taken.
+
+1. **P1 — Tasks 6–10: direct cleanup paths can still delete HA state.** Carries F1.
+
+ Task 10 changes `giveBack` and `finishStop`, but its instruction for `cleanupFailedWake` only adds `stopFiles`. That function separately calls `w.rep.Close`, which deletes the lock. Acquisition also has a raw `ReleaseLease` cleanup before returning a handle.
+
+ **Evidence:** [plan:602](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-no-claims/docs/superpowers/plans/2026-10-26-region-ha-p1a-first-slice.md:602), [maintenance.go:438](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-no-claims/internal/activator/maintenance.go:438), [lease.go:519](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-no-claims/internal/lease/lease.go:519), [lease.go:206](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-no-claims/internal/lease/lease.go:206).
+
+ **Failure:** an HA acquisition succeeds after its local safety deadline has elapsed. `rn.Err()` fails, and acquisition cleanup deletes the HA lock. The next box creates a non-HA lock and can reuse stale local state. A failed wake carrying a replicator has another deletion path.
+
+ **Fix:** explicitly route both cleanup paths through unclean marker release and obligation persistence; prevent `Replicator.Close` from deleting an HA lock. Add witnesses for delayed acquisition acknowledgement and cleanup after replication starts.
+
+ **Fault family:** I1/I2, durable HA state.
+
+2. **P1 — Tasks 12–13: migration still admits an incomplete or unproven baseline.** Carries F3.
+
+ The ordering fix is sound, but Task 13 writes a release marker even when `Final` reports an incomplete publication. Such a marker immediately makes the host HA-on and acquirable. Separately, inventory publication depends on `Config.Migrate`, which is wired only with the switch on; the gate accepts inventories without establishing that they still describe the box’s copies.
+
+ **Evidence:** [plan:819](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-no-claims/docs/superpowers/plans/2026-10-26-region-ha-p1a-first-slice.md:819), [plan:842](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-no-claims/docs/superpowers/plans/2026-10-26-region-ha-p1a-first-slice.md:842), [plan:765](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-no-claims/docs/superpowers/plans/2026-10-26-region-ha-p1a-first-slice.md:765), [spec:351](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-no-claims/docs/superpowers/specs/2026-10-26-region-ha-without-claims-design.md:351).
+
+ **Failure:** an unreadable baseline file produces an unclean first marker; the next wake sets aside the only complete local tree and restores the incomplete baseline. Alternatively, B publishes an empty inventory, disables migration, then wakes an unmigrated host and changes only its files. B releases without updating its inventory. A subsequently acquires, finds matching DB positions and B’s old empty inventory, and publishes A’s stale files as unique.
+
+ **Fix:** incomplete initial publication must leave the host unmigrated. Also require inventory evidence that remains valid across every unmigrated wake and release, including mixed switch states; otherwise migration must wait. Test both sequences.
+
+ **Fault family:** I2, current and unique migration baseline.
+
+3. **P1 — Task 11: the admin-token gate is placed on the wrong call path.** Carries F4.
+
+ The plan gates `ensureAdminTokenAt`, but that helper’s production caller is the claim snapshot path. Claims-off launches call `EnsureAdminToken` or `EnsureAdminTokenBeneath` directly. Adding `haSecretsReady` does not prevent those calls from minting: its stated behavior publishes a differing env file.
+
+ **Evidence:** [plan:696](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-no-claims/docs/superpowers/plans/2026-10-26-region-ha-p1a-first-slice.md:696), [admintoken.go:69](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-no-claims/internal/activator/admintoken.go:69), [prepare.go:83](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-no-claims/internal/activator/prepare.go:83), [backend_exec.go:1034](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-no-claims/internal/activator/backend_exec.go:1034).
+
+ **Failure:** a restored manifest contains an instance key but no admin token. Launch still mints a token, then publishes it instead of returning `ErrInstanceKeyDeferred`. The proposed witness fails.
+
+ **Fix:** route every named launch producer through a context-aware, backend-aware mint gate before either token-producing function runs. Keep acknowledged publication as the subsequent launch barrier.
+
+ **Fault family:** secret identity and durability, spec §7.3.
+
+4. **P1 — Tasks 2 and 4: the deletion list still leaves uncompilable and failing tests.** Carries F5.
+
+ Task 2 does not dispose of `joinmode_test.go` or `joinroot_test.go`, which use the deleted types. Task 4’s supposedly exhaustive list omits two `regionHA` assignments. The root dispatch test still expects `join` to exist.
+
+ **Evidence:** [plan:114](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-no-claims/docs/superpowers/plans/2026-10-26-region-ha-p1a-first-slice.md:114), [joinmode_test.go:42](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-no-claims/internal/host/joinmode_test.go:42), [joinroot_test.go:52](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-no-claims/internal/host/joinroot_test.go:52), [systemparticipation_test.go:169](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-no-claims/internal/host/systemparticipation_test.go:169), [systemparticipation_test.go:191](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-no-claims/internal/host/systemparticipation_test.go:191), [system_test.go:39](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-no-claims/system_test.go:39).
+
+ **Failure:** implementing the enumerated deletions leaves undefined types/fields and a contradictory dispatch assertion.
+
+ **Fix:** add explicit dispositions for these files and tests, preserving any surviving claims-off witnesses.
+
+ **Fault family:** build compatibility and deletion completeness.
+
+5. **P1 — Tasks 6–7 and 12: the shared fixture creates an import cycle.** Carries F6.
+
+ The new tests belong to `package lease` and import `internal/lease/leasetest`. That existing package already imports `internal/lease` in its ordinary source files.
+
+ **Evidence:** [plan:248](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-no-claims/docs/superpowers/plans/2026-10-26-region-ha-p1a-first-slice.md:248), [plan:340](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-no-claims/docs/superpowers/plans/2026-10-26-region-ha-p1a-first-slice.md:340), [leasetest/contract.go:11](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-no-claims/internal/lease/leasetest/contract.go:11).
+
+ **Failure:** compiling the tests produces `lease → leasetest → lease`.
+
+ **Fix:** put the HTTP lock fixture in a package that does not import `lease`, or keep these tests external and provide narrowly scoped access for the private checks.
+
+ **Fault family:** compile-time package dependencies.
+
+6. **P1 — Task 6: the legacy fallback re-reads without reclassifying HA state.**
+
+ `AcquireTTL` first classifies a GET result, then calls Litestream’s `AcquireLease` for a non-HA view. Litestream performs another GET and accepts any expired lock, including a newly published HA marker.
+
+ **Evidence:** [plan:304](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-no-claims/docs/superpowers/plans/2026-10-26-region-ha-p1a-first-slice.md:304), [Litestream leaser.go:90](/home/paulca/go/pkg/mod/github.com/benbjohnson/litestream@v0.5.14/s3/leaser.go:90), [Litestream leaser.go:108](/home/paulca/go/pkg/mod/github.com/benbjohnson/litestream@v0.5.14/s3/leaser.go:108).
+
+ **Failure:** A reads B’s unmigrated lock. B completes migration and writes its marker. A’s legacy fallback reads that marker and successfully replaces it with a non-HA owner. A then follows legacy reuse rules.
+
+ **Fix:** make both branches condition their write on the exact view classified. Every conflicting write or additional read must return through classification. Add this interleaving witness.
+
+ **Fault family:** I1/I2, acquisition race across the HA boundary.
+
+7. **P1 — Tasks 13–14: migration can release over a surviving process after restart.**
+
+ The migration pass directly acquires a legacy lease and publishes a marker. Task 14’s emptiness proof is installed through `ExecBackend.Acquire` and applied only to HA-on views. Migration bypasses both protections.
+
+ **Evidence:** [plan:839](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-no-claims/docs/superpowers/plans/2026-10-26-region-ha-p1a-first-slice.md:839), [plan:895](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-no-claims/docs/superpowers/plans/2026-10-26-region-ha-p1a-first-slice.md:895), [agent.go:592](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-no-claims/internal/host/agent.go:592), [activator.go:2288](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-no-claims/internal/activator/activator.go:2288).
+
+ **Failure:** A’s agent crashes while an unmigrated app survives. After restart, the app has no live activator entry and its legacy lease eventually expires. With matching DB positions and no other copy, migration publishes a release marker without stopping the surviving app. B acquires that marker and starts a second writer.
+
+ **Fix:** require a real process-stop and cgroup-empty proof before migration publishes a sleeping host’s first marker. Refuse layouts where that proof is unavailable. Test restart with a surviving, initially idle writer.
+
+ **Fault family:** I1, process ownership during migration.
+
+8. **P1 — Tasks 7, 10 and 13: the definition of “complete” omits skipped and inconsistent reads.**
+
+ The global predicate checks `TooLarge`, `NotRegular` and `Unreadable`, but `SyncStats` also has `Retry` and `Torn`. `Retry` means nothing was staged; `Torn` means the staged bytes may be inconsistent.
+
+ **Evidence:** [plan:40](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-no-claims/docs/superpowers/plans/2026-10-26-region-ha-p1a-first-slice.md:40), [sync.go:32](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-no-claims/internal/hostfiles/sync.go:32), [sync.go:136](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-no-claims/internal/hostfiles/sync.go:136).
+
+ **Failure:** a file is replaced between inspection and opening during `Final`. The publisher retains its old manifest entry and reports `Retry`. The proposed predicate nevertheless writes a clean marker and records the new local metadata, allowing reuse of a tree that differs from the published baseline.
+
+ **Fix:** settle `Retry` and `Torn` through another stable pass, or mark publication incomplete. Add deterministic witnesses using the existing read seams.
+
+ **Fault family:** I2, positive proof of complete publication.
+
+9. **P1 — Tasks 15 and 18: rollback removes the import refusal while hosts remain HA-on.** Carries F8.
+
+ The switch gates `region-ha-1`. Task 15 preserves withdrawal of the offline-move capability for migrated hosts, but imports check `region-ha-1` instead. Those are separate gates.
+
+ **Evidence:** [plan:43](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-no-claims/docs/superpowers/plans/2026-10-26-region-ha-p1a-first-slice.md:43), [plan:925](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-no-claims/docs/superpowers/plans/2026-10-26-region-ha-p1a-first-slice.md:925), [edgesfile.go:194](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-no-claims/internal/host/edgesfile.go:194), [seedfloor.go:88](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-no-claims/internal/console/seedfloor.go:88), [apiinstanceimport.go:135](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-no-claims/internal/console/apiinstanceimport.go:135).
+
+ **Failure:** on a one-box HA region, clearing the switch removes the HA capability. The region satisfies the import door’s one-box rule, so imports can proceed despite sticky HA hosts. The two-box dev drill would hide this behind its separate box-count refusal.
+
+ **Fix:** retain an HA refusal signal while any host remains migrated, and consume it in both doors. Test rollback with one box and an HA-on host.
+
+ **Fault family:** rollback across the HA/move/import boundary.
+
+10. **P2 — Task 5: the owner test does not exercise agent wiring.** Carries F10.
+
+ **Evidence:** [plan:228](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-no-claims/docs/superpowers/plans/2026-10-26-region-ha-p1a-first-slice.md:228).
+
+ **Failure:** removing the production startup call to `SetSelf` leaves this test passing because the test calls `SetSelf` itself.
+
+ **Fix:** exercise the startup wiring through an injectable runner and acquire inside that runner; removing production initialization must fail the test.
+
+ **Fault family:** identity-initialization regression coverage.
+
+11. **P2 — Tasks 9 and 13: empty-baseline admission has no production caller.**
+
+ The pure gate accepts `empty`, but the migration pass selects hosts with local copies, and the other specified migration call occurs at sleep. Unmigrated wakes explicitly retain today’s path.
+
+ **Evidence:** [plan:547](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-no-claims/docs/superpowers/plans/2026-10-26-region-ha-p1a-first-slice.md:547), [plan:772](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-no-claims/docs/superpowers/plans/2026-10-26-region-ha-p1a-first-slice.md:772), [plan:839](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-no-claims/docs/superpowers/plans/2026-10-26-region-ha-p1a-first-slice.md:839).
+
+ **Failure:** a newly created host’s first wake remains legacy rather than migrating an empty baseline before launch, as spec §8.4 requires.
+
+ **Fix:** specify the under-lease first-wake migration call and transition to HA handling. Add an integration witness, beyond the pure gate test.
+
+ **Fault family:** migration integration and first-wake behavior.
+
+12. **P2 — Tasks 6 and 18: the request budget disagrees with acquisition.**
+
+ **Evidence:** [plan:47](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-no-claims/docs/superpowers/plans/2026-10-26-region-ha-p1a-first-slice.md:47), [plan:304](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-no-claims/docs/superpowers/plans/2026-10-26-region-ha-p1a-first-slice.md:304).
+
+ **Failure:** every marker wake first attempts a create PUT, then GETs the marker and conditionally PUTs the held lease. That is three requests, not the two stated in the budget supplied for rollout approval.
+
+ **Fix:** reconcile the algorithm and budget, and assert request counts in the fixture.
+
+ **Fault family:** rollout cost and acceptance evidence.
+
+No P3 findings.
+
+**NOT READY**
\ No newline at end of file