carlos / platform Public

plan: apply Astra plan R1 corrections; two rulings owed

Astra R1 (one round, NOT READY, 7 P1s, 4 P2s) is committed unedited.
Each finding is applied as a corrections block at the top of its task.
Finding 3 (ha_floor is not a hard gate) adds Task 13, an enforced
generations floor; finding 6 (old CLI reads) refuses unbound door reads
of generations hosts. Both wait on Paul's rulings A and B.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 73c5fe3d53351e79bef5f76cd4717db5cbe5fa67 parent 224a013
2 files changed, +171 −3
  • docs/superpowers/plans/2026-11-17-region-ha-storage-generations.md +48 −3
  • docs/superpowers/reviews/ASTRA-FINDINGS-ha-generations-plan-R1.md +123 −0

CI cancelled — superseded by a newer push — run details

diff --git a/docs/superpowers/plans/2026-11-17-region-ha-storage-generations.md b/docs/superpowers/plans/2026-11-17-region-ha-storage-generations.md
index 09611cc0f..86f178e8e 100644
--- a/docs/superpowers/plans/2026-11-17-region-ha-storage-generations.md
+++ b/docs/superpowers/plans/2026-11-17-region-ha-storage-generations.md
@@ -17,7 +17,7 @@
- head.json: `<loc>/head.json`, fields exactly as spec §3.1 (`v`=1, `generation`, `created_by{lock_generation,box,iid,lifetime,at}`, `start_txid`, `predecessor`, `history[]{generation,start_txid,created_at,ended_at}`). No version ids anywhere in it.
- Lock fields: held generations lock carries `carlos_generation` (the holder's generation name); a generations release marker is owner `released/v1;ref=<box>;iid=<iid>;gen=1` with record field `carlos_release_g` (never `carlos_release`).
- Capability: `replica-generations-1` (published by every box at this release). Switch: box env `CARLOS_HA_GENERATIONS` = unset/`0` (off), `on` (generations; acquire table unchanged), `fast` (generations plus the slice-4 table change). Set per group by the release manager (8a3d302); never set by this branch on any live pool.
-- The gate (spec §9) uses machinery that exists rather than a new per-pool check: the group's `ha_floor` (`grouproll.Floor`, floor.go:57) is raised to the release carrying Task 12 before any box's switch is set, so the group roll places no box below it; slice 0 makes any box at or above Task 0's release refuse a generations lock (a mixed roll fails such a wake, never corrupts it); the capability makes the floor visible in every edges file. No new placement filter.
+- The gate (spec §9), corrected after Astra plan R1 finding 3 (pending Paul's ruling A): `ha_floor` is **not** a hard gate (`grouproll.Floor` reports a below-floor release as DR-4, floor.go:164,186, and a lock-free member rolls on, dr4.go:76). Task 13 adds an enforced generations floor: group config `generations_floor` (a release); while it is set, `Floor` and the roll's candidate check **refuse** (never DR-4) a roll or replacement to a release below it, and any present edges file without `replica-generations-1`. Slice 0 still makes any box at or above Task 0's release refuse a generations lock.
- Restore window and history: 7 days (`SnapshotRetention`, lease.go:96). Abandoned prefixes are retired after 1 day.
- Copies: `VersionedStore.CopyVersion(..., createOnly=true)` (versioned.go:219), at most 8 in parallel. A planned file over 5 GiB refuses the take (single-part copy limit; multipart is a follow-up).
- Request budget (state it in the branch description and test it): **steady state adds zero requests per box per day** (no poll, no timer). Per take: 1 GET head.json, 1+ ListObjectVersions pages of G, one CopyObject per planned file, 1 PUT head.json, 1 PUT manifest (files fence), 1 ListDirs for retirement plus the deletes of retired generations. Per reader: 1 GET head.json per resolution (a bound GET carrying a generation reads no head).
@@ -28,9 +28,9 @@
## Review Focus
1. **A lock renewal drops `carlos_generation`.** `renewLease` (createlease.go:68) and `putLock` (legacytake.go:152) marshal a bare `litestream.Lease`; after the first renewal an old binary would see an ordinary HA lock. Task 1 pins it: a renewed generations lock still carries the field.
-2. **The switch turned off, or a mixed pool, after a host has head.json.** A slice-1 box with the switch off must still take a host that has head.json as a generations host (and stamp its lock); a slice-0-only box refuses. Task 5 test: switch off, head present, take goes to a new generation and the lock is re-stamped before any copy.
+2. **The switch turned off, or a mixed pool, after a host has head.json.** Generations mode is sticky in the lock (Task 1), so a later take stays in it whatever the switch says; a non-generations lock over a host with head.json refuses the wake (Task 5); a slice-0-only box refuses a generations lock; Task 13 keeps below-floor binaries out of the group.
3. **A wake that dies between copy and switch.** `g-N` is left unreferenced; the next take starts again from G (head unchanged), and retirement deletes `g-N` only after a day and only if `N` is below the current holder's generation. Tasks 4 and 9 test it.
-4. **An old CLI's door read across a head switch.** A CLI that sends no generation on GET resolves the current head per request. Task 8 test: a GET with a stale `gen` reads the bound generation; a list after a switch returns the new name and the new CLI restarts the read.
+4. **An old CLI's door read across a head switch.** Refused for generations hosts (409), never resolved per request (Astra plan R1 finding 6). Task 8 tests the old request sequence.
5. **A take whose copy outlives the lease.** Large plans copy for seconds to minutes. Task 4 test: `Held.Err()` non-nil before the switch makes the switch refuse and write nothing.
---
@@ -59,6 +59,12 @@
## Task 1: Lock and marker formats for generations hosts
+> **Corrections (Astra plan R1, findings 4 and 5; replace the Interfaces below where they differ):**
+> - Do not add a second marker field to `Lock`. `DecodeLock` maps `carlos_release_g` into the existing `Lock.Release` and sets `Marker.Gen bool \`json:"-"\``; `MarkerOwner(m)` appends `;gen=1` when `m.Gen`; `MarkerBody` writes `carlos_release_g` and the gen owner when `m.Gen`. Every consumer of `Lock.Release` and `MarkerOwner` then works unchanged. Inventory them anyway and test each with both formats: `activator/haduties.go:66,315,326`, `handover.go:460`, `haadopt.go:66,196,245,269,274`, `poolwithdrawal.go:190,196`, `host/hadepartures_scan.go:46,59,305`, `haplacement.go:66`, `hacache.go:421`, `haleaseloss.go:250`, `hasuspectholder.go:54`, `haforward.go:248`, `hawake.go:547` (grep `Lock.Release` repo-wide again before starting).
+> - Generations mode is **sticky and derived inside each CAS round** of `classifyAndTake`: the next lock carries `carlos_generation = replicagen.Name(next generation)` when the classified view is a generations lock (`GenName != ""` or `Release.Gen`) **or** the switch is on; never from an optional caller argument. Renewal, transfer, release and late-acquire cleanup preserve it. Adoption (`haadopt.go:322,368`) gets it for free; test adoption and a crash right after acquire, before any head read.
+> - Drop `StampGenerations`. A lock without generations mode over a host whose head.json exists is refused (Task 5), never stamped.
+
+
**Files:**
- Modify: `internal/hafresh/lock.go` (`Lock` :67, `MarkerOwner` :95, `MarkerBody` :107, `HAOn` :132), `internal/hafresh/acquire.go`, `internal/hafresh/keep.go`
- Modify: `internal/lease/legacytake.go` (`putLock` :152, `classifyAndTake` :93), `internal/lease/createlease.go` (`renewLease` :68), `internal/lease/release.go` (`releaseWithMarker` :58, `putMarker` :88), `internal/lease/lease.go` (`Held` :142), `internal/lease/ha.go` (`acquireHARestricted` :75)
@@ -83,6 +89,9 @@
## Task 2: Generation names, the shared prefix helper and head.json
+> **Corrections (Astra plan R1, findings 2 and 7):** `Valid(name)` is strict (`@root` or `^g-[0-9]{20}$`) and is what head.json, the resolver and the door use. Claim compatibility is a separate `ValidClaim(gen string)` that keeps today's component checks (`hostbox/writer.go:82`, `genselect/select.go:109`), so claim generation `"42"` still works. `Prefix` returns the slash-terminated **object** prefix; add `ClientPath(loc, name string) string` returning the slashless path a Litestream client's `Path` takes (`loc` for `@root`, `loc+"/"+name` otherwise), because Litestream joins with `/` itself (`s3/replica_client.go:655,703`).
+
+
**Files:**
- Create: `internal/replicagen/replicagen.go`, `internal/replicagen/replicagen_test.go`
- Create: `internal/lease/head.go`, `internal/lease/head_test.go`
@@ -106,6 +115,9 @@
## Task 3: The start plan and the copy (spec §4 steps 3-4)
+> **Corrections (Astra plan R1, findings 7 and 10):** the snapshot-above-L0 fixture is L9 `[1..9]`, L9 `[1..12]`, L0 `[10..10]` (a base is needed; without one the plan correctly fails with `ErrTxNotAvailable`). The immunity test overwrites the source **between the listing and the copy** and asserts the copied bytes are the listed version's; a request log asserts every CopyObject carries `?versionId=` (the fake falls back to the current version without one, `leasetest/s3server.go:435`). Add `TestPlanStartRefusesFileOver5GiB` (size from the listing, zero copies) and `TestPlanStartFailsOnAFailedPage` (`FailListAfterPages`: an error, not a refusal, zero copies).
+
+
**Files:**
- Create: `internal/lease/genstart.go`, `internal/lease/genstart_test.go`
@@ -131,6 +143,13 @@ Rules (spec §4, written once here): list G's current versions (`IsLatest && !De
## Task 4: The take on Held, the confined writer and the witness (spec §4, §5.1)
+> **Corrections (Astra plan R1, findings 1, 2 and 10):**
+> - `Replicate` spends the Held (`lease.go:423,450`; `Held.Err()` then returns `ErrSpent`). The writer's health check is the transferred renewer's (`rn.Err()`), the same one the Replicator carries, not `Held.Err()`. Test a write, a compaction and the final sync **after** `Replicate` returns, then refusal after the lease is lost.
+> - The inner client's `Path` is `replicagen.ClientPath(loc, gen)` (slashless). Test exact S3 keys through the real `lss3` client against the fake: copies at `g-N/0000/…`, writes at `g-N/0000/…`, never `g-N//`.
+> - Retention: Litestream deletes with `DeleteObjects` (`s3/replica_client.go:1083`), which the fake lacks. Add a `POST ?delete` handler to `leasetest/s3server.go` (bare-key deletes per object, delete markers as S3 does) and assert in `TestGenerationWriterRunsRetention` that the objects are gone.
+> - `Switch` checks the renewer's health before the PUT (Review Focus 5).
+
+
**Files:**
- Create: `internal/lease/gentake.go`, `internal/lease/gentake_test.go`
- Modify: `internal/lease/claimgeneration.go` (`generationClient` :90), `internal/lease/lease.go` (`newStore` :460-495)
@@ -158,6 +177,9 @@ Behaviour: step 0 (`First`) puts head.json for an empty `g-N` create-only and re
## Task 5: Wake wiring, the switch, the files fence and refusals (spec §4, §7, §9)
+> **Corrections (Astra plan R1, findings 5 and 7):** step (a) becomes: if the lock is not in generations mode (Task 1), GET head.json once; absent → today's path; present → refuse the wake (`ha_generation_refused reason=lock_not_generations`, page): a host with head.json is only ever taken in generations mode. That GET is the one added request for a switch-off HA wake; `TestHAWakeSwitchOffNoHeadUnchanged` asserts exactly one added GET, and `StartGeneration` reuses the head (body and ETag) read here rather than reading it again. Rename `TestHAWakeSwitchOffHeadPresentStampsFirst` to `TestHAWakeNonGenerationsLockWithHeadRefuses` (zero copies, head unchanged, one page).
+
+
**Files:**
- Modify: `internal/activator/hawake.go` (`haWake` :181, `acquireClassified` :334-432, `restoreHA` :510-575, `restoreFilesClean` :732), `internal/activator/activator.go` (`doWake` :2611), `internal/activator/hasuspectholder.go`, `internal/activator/hafiles.go` (`stageWakeFiles` :212)
- Modify: `internal/hostfiles/manifest.go` (`Manifest` :64), `internal/hostfiles/publisher.go` (`OpenBaseline` :168)
@@ -187,6 +209,9 @@ Wake order inside `restoreHA`: (a) if the switch is off and the lock has no `Gen
## Task 6: The resolver and the box-side readers (spec §6.1, §6.2)
+> **Corrections (Astra plan R1, findings 9 and 11):** the G4 guard resolves imports by package path (any alias of `litestream/s3`), fails on `lss3.NewReplicaClient`, on a composite literal of `lss3.ReplicaClient`, and on `newReplicaClientForUID` or `newReplicaClient` outside the allowlist; it ships with negative fixtures (testdata Go files, one per prohibited form) that the guard must flag. `HasReplica` answers true whenever `HeadFound`, whatever the generation holds; false only when head is absent and the root holds no LTX file. Tests: empty first generation → true; unexpectedly empty non-first generation → true.
+
+
**Files:**
- Create: `internal/lease/resolve.go`, `internal/lease/resolve_test.go`, `internal/lease/readers_guard_test.go`
- Modify: `internal/lease/endpoint.go` (remove `ReadReplicaClient` :165), `internal/lease/lease.go` (`Restore` :989), `internal/lease/check.go` (`HasReplica` :405, `VerifyReplicaAt` :248)
@@ -227,6 +252,12 @@ Wake order inside `restoreHA`: (a) if the switch is off and the lock has no `Gen
## Task 8: Console readers and the bound door (spec §6.1, §6.2)
+> **Corrections (Astra plan R1, findings 6 and 7; pending Paul's ruling B):**
+> - A list or GET for a host with head.json that carries **no** `gen` (an old CLI) is refused with 409 and a short reason; a root-layout host keeps today's unbound protocol. Test the old CLI's exact request sequence (`dbdoor/client.go:101,143`) across a head switch: refused, never mixed.
+> - Bound listings and GETs stay on the bound generation even after head moves (that is the point). Replace `TestDoorListAfterSwitchRestartsTheRead` with `TestDoorBoundListStaysOnG1AfterSwitch`. The one restart condition is a bound generation that is gone (retired: list empty or GET 404 on a generation not in head or history) → `ErrGenerationGone` → `restoreAt` restarts once unbound-then-bound.
+> - The 409 reason is user-facing: its string goes through copy review before this task lands.
+
+
**Files:**
- Modify: `internal/console/apidb.go` (`dbGate` :112-171, `handleAPIDBList` :301, `handleAPIDBGet` :343, `cachedReadReplica` :496-503), `internal/console/server.go:2103`, `internal/console/backups.go` (`readBackups` :279-301), `internal/console/apiinstanceseed.go` (`beginFrom` :257-286), `internal/console/createleftovers.go` (`replicaPrefixesHoldData` :79-81)
- Modify: `internal/dbdoor/` (the `Client` list/get requests; `restoreAt` :151 restart on a generation change)
@@ -250,6 +281,9 @@ Wake order inside `restoreHA`: (a) if the switch is off and the lock has no `Gen
## Task 9: Retirement (spec §8)
+> **Corrections (Astra plan R1, finding 8):** retire with **bare-key deletes** (a delete marker, so every version becomes noncurrent and the bucket's 7-day noncurrent rule expires it), not `DeleteVersion` of the current version (which resurrects an older version). The pre-trim history is an explicit parameter `left []HeadHistory`. Tests add: a key with three versions is gone from a current listing after retirement; a partial failure leaves the rest for the next take, which finishes it.
+
+
**Files:**
- Create: `internal/lease/genretire.go`, `internal/lease/genretire_test.go`
- Modify: `internal/activator/hawake.go` (start retirement after the replicator is running)
@@ -306,6 +340,17 @@ Rules: `ListDirs(<loc>/)`; for each `g-<M>/`: keep if it is the current generati
---
+## Task 13: Enforced generations floor (Astra plan R1 finding 3; pending Paul's ruling A)
+
+**Files:** Modify `internal/grouproll/floor.go` (`Floor` :57), `internal/grouproll/roll.go` (candidate check :780, :943), the group config type that holds `HAFloor`. Test `internal/grouproll/floor_test.go`.
+
+**Interfaces:** `GenerationsFloor *string \`json:"generations_floor,omitempty"\`` on the group config. While set: a candidate release below it, or any present edges file whose `capabilities` lacks `replica-generations-1`, makes `Floor` return `refuse("floor_generations")` (journaled `floor-error`), never `dr4`.
+
+- [ ] **Step 1: Write the failing tests**: `TestFloorRefusesBelowGenerationsFloor` (a lock-free member, candidate below the floor: refused, not DR-4); `TestFloorRefusesMemberWithoutGenerationsCapability`; unset → today's behaviour (existing tests green).
+- [ ] **Step 2: Run** `go test ./internal/grouproll/ -run 'GenerationsFloor|GenerationsCapability' -count=1` → FAIL.
+- [ ] **Step 3: Implement.** **Step 4: Run** → PASS, plus `go test ./internal/grouproll/ -count=1`.
+- [ ] **Step 5: Commit** `grouproll: an enforced generations floor`.
+
## Task 12: Whole-branch review, census, CI, merge
- [ ] Astra and Fable whole-branch review from `REVIEW-BRIEF-TEMPLATE.md` (round budget three, stopping rules apply); findings committed under `docs/superpowers/reviews/`.
diff --git a/docs/superpowers/reviews/ASTRA-FINDINGS-ha-generations-plan-R1.md b/docs/superpowers/reviews/ASTRA-FINDINGS-ha-generations-plan-R1.md
new file mode 100644
index 000000000..43adf42d1
--- /dev/null
+++ b/docs/superpowers/reviews/ASTRA-FINDINGS-ha-generations-plan-R1.md
@@ -0,0 +1,123 @@
+Reviewed the [plan](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/ha-generations/docs/superpowers/plans/2026-11-17-region-ha-storage-generations.md), rev-4 spec, referenced code and witness at `224a0133c215ca617f0161d91af2818bd24d5ea1`. No files changed, subagents spawned or tests run. References below were verified against the requested sources.
+
+1. **P1 — Task 4: the writer’s health check stops working after `Replicate`.**
+
+ Plan:143 requires every generation-client request to check `h.Err()`. But `Replicate` transfers ownership and spends `Held` before returning (`internal/lease/lease.go:423`, `:450`); `Held.Err()` then returns `ErrSpent` (`:261`).
+
+ **Failure:** subsequent uploads, compaction, retention and final synchronization fail despite a healthy lease.
+
+ **Fix:** give the writer a health check tied to the transferred lease/renewer, preserving the public spent-handle restriction. Test a write and final synchronization **after** `Replicate` returns, followed by refusal after lease loss.
+
+ **Invariant:** §5.1’s confined writer remains usable throughout its ownership.
+
+2. **P1 — Tasks 2 and 4: the prescribed client path introduces a double slash.**
+
+ `Prefix` returns `<loc>/<generation>/` (plan:92), and Task 4 requires the inner client’s `Path` to equal that prefix (plan:143). `newReplicaClientForUID` assigns the supplied path unchanged (`internal/lease/endpoint.go:145`). Litestream appends `/` when opening and writing files (`litestream@v0.5.14/s3/replica_client.go:655`, `:703`).
+
+ **Failure:** copies reside at `g-N/0000/...`, while the client accesses `g-N//0000/...`. The copied start becomes invisible to that client, defeating restore/continuation.
+
+ **Fix:** distinguish the slash-terminated object prefix from the slashless replica-client path. Check the normalized path and test exact S3 keys through the real client.
+
+ **Invariant:** G3, the restored and replicated positions start from the copied history.
+
+3. **P1 — Global Constraints / Task 12: `ha_floor` is not the claimed hard rollout gate.**
+
+ Plan:20 assumes raising `ha_floor` prevents a group roll below it. In fact, `grouproll.Floor` records a below-floor release as a reason (`internal/grouproll/floor.go:164`) and returns `dr4`, without an error (`:186`). The roll proceeds on a nil error (`internal/grouproll/roll.go:780`); DR-4 permits a lock-free member to proceed (`internal/grouproll/dr4.go:76`).
+
+ **Failure:** a lock-free member can roll below slice 0, return to service, and later take an expired generations lock using the old HA table. That binary ignores `carlos_generation` and restores root history.
+
+ **Fix:** add an enforced generations floor that refuses such rolls/replacements and covers every serving member. Test a lock-free below-floor candidate. Publishing a capability alone does not enforce admission.
+
+ **Boundary:** §9’s old-binary fence. Deviation (a) is unsafe as currently justified.
+
+4. **P1 — Task 1: the marker-consumer migration misses operational readers.**
+
+ Plan:78 limits the `Lock.Release` replacement to `hafresh` and `lease`. Other consumers remain dependent on that field:
+
+ - `internal/activator/haduties.go:66`: a released host’s scheduled duty becomes `Defer`.
+ - `internal/activator/handover.go:460`: a generations release is refused.
+ - `internal/activator/haadopt.go:66` and `internal/host/hadepartures_scan.go:46`: release identity is unrecognized.
+ - `internal/activator/poolwithdrawal.go:190`: release confirmation fails.
+
+ Several also compare the owner with `MarkerOwner(m)` exactly, so replacing the field access alone still rejects `;gen=1`.
+
+ **Failure:** normal generations releases strand duties, adoption or withdrawal.
+
+ **Fix:** inventory marker consumers repository-wide; centralize format-aware marker/owner validation; test duties, departure adoption, handover and withdrawal with both formats.
+
+ **Invariant:** additive lock formats preserve existing HA lifecycle behavior.
+
+5. **P1 — Tasks 1 and 5: generations format is not made sticky across every acquire.**
+
+ Plan:69 makes `GenName` an optional acquire argument; plan:171 allows acquiring without it and stamping later. The unchanged adoption caller acquires and releases without going through `restoreHA` (`internal/activator/haadopt.go:322`, `:368`).
+
+ **Failure:** an ordinary take can temporarily—or an adoption permanently—replace a generations lock with a plain HA lock/marker. A crash before `StampGenerations` leaves that downgrade visible. A slice-0 binary can then acquire it and restore root data.
+
+ **Fix:** derive generations mode from the classified lock inside **each CAS round**, independently of the switch and optional caller arguments. Derive the new name from that round’s next lock generation. Preserve the mode through renewal, transfer, release and late-acquire cleanup. Test adoption and a crash immediately after acquire, before any head read.
+
+ **Boundary:** §9’s old-binary fence must survive every lock write.
+
+6. **P1 — Task 8 / Review Focus 4: old CLI reads can mix generations.**
+
+ Plan:33 explicitly permits an unbound GET to resolve the current head per request; plan:236 implements that fallback. Existing clients send coordinate-only list and GET requests (`internal/dbdoor/client.go:101`, `:143`) and ignore an added JSON field.
+
+ **Failure:** an old client lists one generation, head switches, and a later listing or download reads another. The protocol provides neither binding nor a generation-change refusal. The stale-`gen` test exercises only upgraded clients.
+
+ **Fix:** refuse unbound downloads of generations hosts and require a binding-capable protocol. Preserve legacy behavior for root-layout hosts. Test the actual old request sequence across a switch.
+
+ **Invariant:** G4, one reader uses one generation. The old-CLI case is not acceptable as written.
+
+7. **P1 — Tasks 2, 3, 5 and 8: several prescribed tests conflict with the prescribed behavior.**
+
+ These are test-contract failures, not additional production-safety findings:
+
+ - **Task 2, plan:92/96:** `Valid` accepts claim-generation names accepted by the existing helpers, but must reject `g-42`. Claim generation `"42"` passes today’s component checks (`internal/hostbox/writer.go:82`, `internal/genselect/select.go:109`). **Fix:** separate strict HA-name validation from claim compatibility. **Invariant:** unchanged claim-prefix behavior.
+ - **Task 3, plan:119:** L9 `[1..12]` plus L0 `[10..10]` cannot restore to 10 after excluding L9. `CalcRestorePlan` requires a contiguous start and returns `ErrTxNotAvailable` (`litestream@v0.5.14/replica.go:1549`, `:1589`). **Fix:** add a base such as L9 `[1..9]`, then verify replication continues at `T+1`. **Invariant:** G3.
+ - **Task 5, plan:171/176:** the switch-off path explicitly GETs head, while its test requires zero added requests. **Fix:** account for that GET, and reuse its result instead of reading head again in `StartGeneration`. **Invariant:** accurate request accounting.
+ - **Task 8, plan:236/241:** later listings send the bound generation, and `dbReplica` then calls `BindReplica` without reading head. A head switch therefore cannot make that listing return g-2 as the test requires. **Fix:** test that bound listings stay on g-1; separately define and test any explicit restart condition. **Invariant:** G4.
+
+8. **P2 — Task 9: deleting the current version does not retire the key.**
+
+ Plan:260 deletes each current version by version ID. `DeleteVersion` performs an exact-version deletion (`internal/lease/versioned.go:269`); the fake likewise removes that version and exposes the remaining version stack (`internal/lease/leasetest/bucket.go:325`).
+
+ **Failure:** an overwritten key’s older version becomes current again. It remains visible and no longer qualifies as noncurrent data for lifecycle expiry. Retirement can leave old data behind, particularly after a partial attempt.
+
+ **Fix:** specify retirement that leaves keys logically deleted without exposing older versions, while retaining the generation eligibility checks. Test multiple versions, partial failure and a later take retrying retirement. Make the pre-trim history an explicit input.
+
+ **Invariant:** §8’s retired generations cease to contain current objects.
+
+9. **P2 — Task 6: the G4 guard misses other construction routes.**
+
+ Plan:201 checks named constructor references and `newReplicaClient` calls. It does not cover `newReplicaClientForUID` (`internal/lease/endpoint.go:131`) or direct `ReplicaClient` construction.
+
+ **Failure:** a new root-prefix reader can pass the guard without using the resolver.
+
+ **Fix:** resolve imports by package identity, cover constructor aliases and composite literals, restrict the lower-level helper too, and add negative fixtures demonstrating each prohibited construction.
+
+ **Invariant:** G4’s guard detects direct reader construction.
+
+10. **P2 — Tasks 3, 4 and 11: the tests leave important guarantees unproved.**
+
+ The overwrite test changes the source **after** copying (plan:123), which also passes for an unpinned copy. The fake accepts a copy without a version ID by selecting the current source (`internal/lease/leasetest/s3server.go:435`). Its handler also lacks `DeleteObjects`, which Litestream retention calls (`litestream@v0.5.14/s3/replica_client.go:1083`).
+
+ **Failure:** tests can miss loss of version pinning or fail to exercise real retention.
+
+ **Fix:** overwrite between listing and copying; assert the selected version’s bytes. Test retention through a capable fake or MinIO and verify deletion occurred. Add explicit cases for the >5-GiB refusal, failed pagination, oldest-live-binary refusal and continuation at `T+1`.
+
+ **Invariants:** G3, confined retention, and §12’s compatibility witnesses.
+
+11. **P2 — Task 6: `HasReplica` needs an explicit head-present rule.**
+
+ Plan:196 only says to resolve first. Existing `HasReplica` returns false when no LTX files are listed (`internal/lease/check.go:414`, `:441`). Spec:127 requires “no replica” only when head is absent and root is empty.
+
+ **Failure:** an empty generations head can still be reported as no existing lineage.
+
+ **Fix:** specify and test that `HeadFound` prevents a false answer, including an empty first generation and an unexpectedly empty non-first generation.
+
+ **Invariant:** §6.1’s seed-placement existence check.
+
+No P3 findings. The >5-GiB refusal is a safe scope cut if enforced before copying. I found no newly introduced per-box polling loop.
+
+The P1s have several causes. Refusing unbound old-client reads and below-floor rollout removes those compatibility cases; refusing generations adoption until format preservation is implemented removes that adoption case. The writer lifecycle, path construction and marker-consumer failures affect ordinary operation and require correction. Keep switch-on blocked and take these findings and cuts to Paul; this plan’s single review round is spent.
+
+**NOT READY**
\ No newline at end of file