carlos / platform Public

Astra plan review round 1 on P1a: findings, unedited

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

CI failed — run details

diff --git a/docs/superpowers/notes/reviews/ASTRA-FINDINGS-region-ha-p1a-plan-r1.md b/docs/superpowers/notes/reviews/ASTRA-FINDINGS-region-ha-p1a-plan-r1.md
new file mode 100644
index 000000000..f680724d2
--- /dev/null
+++ b/docs/superpowers/notes/reviews/ASTRA-FINDINGS-region-ha-p1a-plan-r1.md
@@ -0,0 +1,153 @@
+Reviewed `36e490fc63558a244561f868c1bbfedea755ec13` on `design-region-ha-no-claims` against the approved rev-6 spec and this branch’s code. Static review only; no files changed, subagents spawned, tests run, or dev actions taken.
+
+1. **P1 — Tasks 7–10: failed wakes erase the host’s HA state.**
+
+ The HA indicator exists only in the lock’s marker or `;ha=1` owner. Task 10 changes normal sleep release, but failed wakes still call `giveBack`, through `execLease.Release`, which deletes the lock.
+
+ **Evidence:** [plan:25](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-no-claims/docs/superpowers/plans/2026-10-26-region-ha-p1a-first-slice.md:25), [activator.go:2321](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-no-claims/internal/activator/activator.go:2321), [backend_exec.go:779](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-no-claims/internal/activator/backend_exec.go:779), [lease.go:285](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-no-claims/internal/lease/lease.go:285).
+
+ **Failure:** A takes an HA marker, then restoration fails. Cleanup deletes the lock. B has an older local DB, so `Fresh` is false; its acquisition writes a non-HA owner and its wake takes the legacy warm-cache path.
+
+ **Fix:** Preserve HA status through every release path, including failures before replication starts. Add a held-handle marker release and persistent retry path, with an unclean marker where appropriate. Test failed restore followed by a wake on a box with stale local data.
+
+ **Fault family:** I2, durable HA state and positive-proof reuse.
+
+2. **P1 — Task 9: `Fresh` bypasses migration’s uniqueness proof.**
+
+ Local DB absence plus `!HasReplica` does not establish that this is a newly created host with no copy elsewhere.
+
+ **Evidence:** [plan:473](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-no-claims/docs/superpowers/plans/2026-10-26-region-ha-p1a-first-slice.md:473), versus the inventory refusal at [plan:658](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-no-claims/docs/superpowers/plans/2026-10-26-region-ha-p1a-first-slice.md:658). [HasReplica](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-no-claims/internal/lease/check.go:154) checks remote LTX objects only.
+
+ **Failure:** An existing host has a local copy on B but never completed replication. A has no local DB and finds no replica, so it marks the host HA-on and starts an empty baseline without consulting B’s inventory. The migration gate would have refused A.
+
+ **Fix:** Route empty-baseline admission through the migration gate, or provide positive evidence that the host was created after activation and cannot have an earlier copy. Test the pre-existing, remote-empty host on another box.
+
+ **Fault family:** I2, migration authority.
+
+3. **P1 — Tasks 12–13: migration validates before acquiring its exclusion.**
+
+ Task 13 says a sleeping host first passes the gate, then takes the lease and publishes. The gate’s replica-head and inventory observations can become obsolete before acquisition.
+
+ **Evidence:** [plan:652](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-no-claims/docs/superpowers/plans/2026-10-26-region-ha-p1a-first-slice.md:652), [plan:722](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-no-claims/docs/superpowers/plans/2026-10-26-region-ha-p1a-first-slice.md:722). Existing wake ordering deliberately acquires before restoration: [activator.go:2263](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-no-claims/internal/activator/activator.go:2263).
+
+ **Failure:** A validates local TXID 7 against remote 7. Before A acquires, B wakes through the unmigrated path, writes TXID 8, and releases. A then acquires and publishes its old files and a clean TXID-7 marker.
+
+ **Fix:** Acquire first, then collect and validate migration evidence while retaining ownership through publication. Define inventory publication ordering so a completed intervening wake cannot leave an apparently empty inventory. Refuse partial baseline publication; Task 13 must consume `Final`’s `complete` result rather than unconditionally writing “clean.” Add an interleaving witness.
+
+ **Fault family:** I2, current and unique migration baseline.
+
+4. **P1 — Task 11: the secret-publication gate misses admin tokens and retries.**
+
+ The task gates instance-key minting, but existing launch paths mint the admin token first. It also requires publication only “after a mint,” leaving retries with an already-written key unspecified.
+
+ **Evidence:** [plan:592](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-no-claims/docs/superpowers/plans/2026-10-26-region-ha-p1a-first-slice.md:592), [prepare.go:83](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-no-claims/internal/activator/prepare.go:83), [backend_exec.go:2130](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-no-claims/internal/activator/backend_exec.go:2130), and the existing-key return at [instancekey.go:493](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-no-claims/internal/activator/instancekey.go:493).
+
+ **Failure:** A restored env contains an instance key but lacks an admin token. Launch mints a token despite an existing manifest, then sees an existing instance key and can skip publication. Similarly, a failed publish after mint leaves a local key; the next attempt sees “present” and can launch without acknowledged publication.
+
+ **Fix:** Give both token producers the manifest-absence gate and require acknowledged publication of pending secret changes before every HA launch, including retries. Add both witnesses.
+
+ **Fault family:** Secret identity and durability; spec §7.3.
+
+5. **P1 — Tasks 1–4: the deletion instructions leave shared code and surviving tests unresolved.**
+
+ `edgesclaims.go` contains the ordinary publication scheduler wrapper, including asset-cache scheduling. `joining.go` contains unconditional group-reference initialization. Task 4 removes a field still referenced by existing tests.
+
+ **Evidence:** [edgesclaims.go:252](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-no-claims/internal/host/edgesclaims.go:252), its surviving caller at [edgesfile.go:1001](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-no-claims/internal/host/edgesfile.go:1001), [joining.go:264](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-no-claims/internal/host/joining.go:264), and [systemparticipation_test.go:50](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-no-claims/internal/host/systemparticipation_test.go:50).
+
+ **Failure:** Literal deletion either leaves undefined symbols or removes initialization used with claims off. Removing `systemApplier.regionHA` leaves existing tests uncompilable; several also assert the behavior being deliberately removed.
+
+ **Fix:** Explicitly relocate the non-claim scheduler and group-reference startup helpers, preserving their witnesses. Enumerate surviving test updates, including address/lifetime tests using `edgesClaims` and participation tests using `regionHA`.
+
+ **Fault family:** Build compatibility and claims-off behavior.
+
+6. **P1 — Tasks 6–7, 9–10, 13: the interfaces do not connect as written.**
+
+ There are concrete mismatches:
+
+ - `Config.Migrate` takes only a host; `haMigrator.Decide` also takes a context, yet Task 13 assigns the method directly.
+ - Task 10 calls `SetMonitorInterval` at a site where the value is an `activator.Lease`; that interface has no such method.
+ - The proposed lease tests use private package functions and `tombFixture`, but the existing fixture belongs to `package lease_test`.
+
+ **Evidence:** [plan:444](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-no-claims/docs/superpowers/plans/2026-10-26-region-ha-p1a-first-slice.md:444), [plan:704](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-no-claims/docs/superpowers/plans/2026-10-26-region-ha-p1a-first-slice.md:704), [plan:716](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-no-claims/docs/superpowers/plans/2026-10-26-region-ha-p1a-first-slice.md:716), [activator.go:368](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-no-claims/internal/activator/activator.go:368), [tombstone_test.go:1](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-no-claims/internal/lease/tombstone_test.go:1).
+
+ **Failure:** These assignments, calls, and test references do not compile.
+
+ **Fix:** Make the migration signatures agree; specify the lease/replicator adapters and optional interfaces; split internal and external tests or move reusable fixture support into `leasetest`.
+
+ **Fault family:** Compile-time interface contracts.
+
+7. **P1 — Task 10: the owed-marker witness rejects correct acquisition.**
+
+ After a successful `Acquire`, the test requires the current lock still to contain a release marker.
+
+ **Evidence:** [plan:574–575](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-no-claims/docs/superpowers/plans/2026-10-26-region-ha-p1a-first-slice.md:574), versus Task 6’s replacement PUT at [plan:261](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-no-claims/docs/superpowers/plans/2026-10-26-region-ha-p1a-first-slice.md:261).
+
+ **Failure:** Correct acquisition replaces the marker with a held `box/v1;…;ha=1` lease, so this test fails.
+
+ **Fix:** Assert the request sequence: owed-marker PUT succeeds before acquisition PUT. Afterwards assert that the owed file is gone and the lock names the new HA holder. Alternatively, inspect the pre-acquisition view returned by the lease API.
+
+ **Fault family:** Retry-order test oracle.
+
+8. **P1 — Task 18: the proposed rollback re-enables stale-copy reuse.**
+
+ “Unset it and restart the agent” is unsafe once hosts have moved between the two boxes.
+
+ **Evidence:** [plan:905](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-no-claims/docs/superpowers/plans/2026-10-26-region-ha-p1a-first-slice.md:905), legacy acquisition at [lease.go:193](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-no-claims/internal/lease/lease.go:193), and unconditional local reuse at [backend_exec.go:819](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-no-claims/internal/activator/backend_exec.go:819).
+
+ **Failure:** A retains an old copy; B writes newer data and sleeps. Rollback disables HA on A. A takes B’s expired release marker through legacy acquisition and serves its old local DB. With a hung holder, legacy expiry takeover also restores the second-writer hazard.
+
+ **Fix:** Specify a coordinated rollback that prevents tenant wakes, settles holders and obligations, and establishes authoritative local state before enabling legacy behavior. Alternatively, retain HA enforcement for already-migrated hosts during rollback. Rehearse the chosen procedure.
+
+ **Fault family:** I1/I2, rollback across the durable HA boundary.
+
+9. **P2 — Task 10: define the files publisher’s lifetime and shutdown barrier.**
+
+ The plan starts `hostFiles.Run` in the wake path but specifies neither its owning context nor cancellation and joining before marker release.
+
+ **Evidence:** [plan:522](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-no-claims/docs/superpowers/plans/2026-10-26-region-ha-p1a-first-slice.md:522), [plan:548](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-no-claims/docs/superpowers/plans/2026-10-26-region-ha-p1a-first-slice.md:548). The existing wake context is cancelled when `wake` returns: [activator.go:1769](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-no-claims/internal/activator/activator.go:1769).
+
+ **Failure:** Using that context stops publication immediately after waking; using an unmanaged background context permits publication after release.
+
+ **Fix:** Specify an entry-owned publisher lifecycle, stop-and-join before final publication, and cleanup on failed wakes and lease loss. Test that no writes occur after the marker.
+
+ **Fault family:** I1, publisher ownership.
+
+10. **P2 — Tasks 5 and 13: unconditional owner identity has conditional initialization.**
+
+ Task 5 makes the owner format unconditional, but Task 13 places `lease.SetSelf` inside the HA-enabled branch.
+
+ **Evidence:** [plan:153](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-no-claims/docs/superpowers/plans/2026-10-26-region-ha-p1a-first-slice.md:153), [plan:704](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-no-claims/docs/superpowers/plans/2026-10-26-region-ha-p1a-first-slice.md:704).
+
+ **Failure:** An HA-off agent follows Task 13’s wiring without initializing the identity consumed by `currentOwner`.
+
+ **Fix:** Initialize the box reference unconditionally before acquisition; make IID discovery and retry behavior explicit. Test HA-off acquisition through agent wiring.
+
+ **Fault family:** Lease-owner identity.
+
+11. **P2 — Task 17: the simulation’s assertions omit part of the required safety property.**
+
+ I1 checks replica writes but not manifest writes or simultaneous running instances. The stated I2 reuse exception does not explicitly require a clean, complete publication.
+
+ **Evidence:** [plan:876–881](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-no-claims/docs/superpowers/plans/2026-10-26-region-ha-p1a-first-slice.md:876), compared with [spec:123–124](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-no-claims/docs/superpowers/specs/2026-10-26-region-ha-without-claims-design.md:123).
+
+ **Failure:** A stale publisher can write a manifest without violating the stated I1 assertion. A matching but unclean marker can satisfy the written I2 exception, weakening the `keep-unclean` mutation check.
+
+ **Fix:** Assert ownership for both replica and manifest writes, running-instance exclusivity, and clean/complete publication for every reuse. Add deterministic witnesses that exercise those assertions.
+
+ **Fault family:** Invariant-test coverage.
+
+12. **P2 — Task 18: the per-host drill omits releases between boxes.**
+
+ After step 2, A is awake. Step 3 immediately expects B to acquire and restore; after that, step 4 immediately expects A to do the same.
+
+ **Evidence:** [plan:913–917](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-no-claims/docs/superpowers/plans/2026-10-26-region-ha-p1a-first-slice.md:913), versus the held-lease refusal at [plan:253](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/region-ha-no-claims/docs/superpowers/plans/2026-10-26-region-ha-p1a-first-slice.md:253).
+
+ **Failure:** Correct acquisition refuses B while A holds the lease. Also, migration has already written a marker, so the first expected `no-marker` reason needs a separately prepared fixture.
+
+ **Fix:** Explicitly sleep the current holder and verify marker publication before each cross-box wake. Specify the starting state that produces each expected reason.
+
+ **Fault family:** Rollout acceptance evidence.
+
+No P3 findings.
+
+**NOT READY**
\ No newline at end of file