| new file mode 100644 |
| index 000000000..1806bdb0b |
| --- /dev/null |
| +++ b/docs/superpowers/specs/2026-11-12-region-ha-storage-generations-design.md |
| @@ -0,0 +1,208 @@ |
| +# Region HA: per-holder storage generations |
| + |
| +Design, 2026-11-12, **rev 4**, **approved 2026-11-15** (§10) (Astra rounds 1 to 3 answered; the review budget is spent, and round 3's findings are applied as cuts without a fourth round: any further review is Paul's call). Branch `design-ha-generations`. Nothing here is built. Paul's ruling (2026-11-12, HA session, #421): contain the unclean-release late write now (branch `ha-unclean-marker-waits`, region HA spec rev 6.7), spec storage generations now, **build after G6**. |
| + |
| +Sources: the wake-race review (`~/.cache/ha-flakes/wake-race/FINDINGS.md`, Astra, 2026-11-11; its options 1 and 2 combined are this design), the containment review (`docs/superpowers/reviews/ASTRA-FINDINGS-ha-unclean-containment-R1.md`), region HA without claims (**RHA**, `2026-10-26-region-ha-without-claims-design.md`, §5, §9.4, N-HA9), and the dormant claim machinery whose shapes this reuses (`internal/genselect`, `internal/hostbox/restore.go`, `internal/moves/source.go`, `internal/lease/claimgeneration.go`). |
| + |
| +**Rev 2** answers Astra round 1 (`docs/superpowers/reviews/ASTRA-FINDINGS-ha-generations-R1.md`), four P1s: |
| +- **(gen-1.1)** a snapshot-only base reset Litestream to TXID 1: the base is now a server-side **copy** of the predecessor's files into the new generation, the newest L0 included, so the new prefix looks exactly like a restored prefix does today (§4 step 4, §5.1); |
| +- **(gen-1.2)** pinned versions could expire under the bucket's noncurrent rule: nothing references a version id after the take; the copy is made from exact versions and then owned (§4, §8); |
| +- **(gen-1.3)** the old-binary fence opened the legacy acquire: old binaries now still read every lock as HA and refuse it (§9); |
| +- **(gen-1.4)** a move dropped history: generations are self-contained prefixes under `<loc>/`, so today's whole-prefix mirror copies all of them, and head.json names generations, not versions (§6.3). |
| +- Rev 1's per-take generation would copy the database on every wake. Rev 2 started a generation only when the predecessor did not release cleanly, and made "clean" mean every replica request was answered. |
| + |
| +**Rev 3** answers round 2 (`docs/superpowers/reviews/ASTRA-FINDINGS-ha-generations-R2.md`) under stopping rule 2: history continuity and history across relocation drew P1s in both rounds, so rev 3 refuses up front and cuts instead of fixing a third time. |
| +- **(gen-2.1, gen-1.1)** one central rule: a new generation starts **exactly at the predecessor's newest L0 TXID**. Files above it are not copied; if no plan reaches it, the wake is refused (§4 step 4). |
| +- **(gen-2.1 new, the drain)** cut: Litestream's own replica monitor and its shutdown retries leave requests whose outcome is unknown, so "drained" cannot be proved in 0.5.14. **Every take starts a new generation** (per holder, rev 1's rule), and nothing depends on proving that requests completed. The drain is a later design (§11). |
| +- **(gen-2.2, gen-2.3, gen-1.4)** cut: a move carries the **current state only**, into a generation the landing side names. No history is imported, so no name can collide and no copied timestamp is read as history; point-in-time reads reach back to the landing (§6.3). |
| +- **(gen-2.4)** one restore binds one generation name for its listings, downloads and retries (§6.1). |
| + |
| +**Rev 4** applies round 3 (`docs/superpowers/reviews/ASTRA-FINDINGS-ha-generations-R3.md`, every earlier finding resolved; two new P1s and a P2) with the reviewer's own remedies, no further round: |
| +- **(gen-3.1)** the files fence covers an absent manifest: a create-only empty manifest, `If-None-Match: *` (§7); |
| +- **(gen-3.2)** cut: **moves of a generations host are refused in v1** (§6.3); the current-state move is a later slice; |
| +- **(gen-3.3)** a first wake (proven-empty prefix) creates an empty generation and does not go through the start rule (§4 step 0). |
| + |
| +## 1. The problem, and what this retires |
| + |
| +Every holder of an HA instance's lease writes its Litestream replica into one shared prefix, `<loc>/` (`instances/<host>/`), with no ownership condition on the write (`litestream@v0.5.14/s3/replica_client.go:702`). Litestream's close cancels requests without proof that S3 did not receive them. So a request an earlier holder sent can be applied after a successor has restored and started its own history under the same keys. The late object replaces the successor's, and history diverges silently (wake-race P1 B; witness `internal/lease/unclean_marker_test.go`, adapted from 8e8a00a0). |
| + |
| +Today time is the only fence: |
| +- N-HA9: a terminated owner's lock is taken only after it expires (up to 15 minutes); |
| +- rev 6.7: an unclean release after replication waits a lease term from its marker; |
| +- a clean release opens at once, and still carries the exposure for cancelled compaction, snapshot and retention requests (containment R1 A). Paul kept that for the drain's fast handover. |
| + |
| +**Goal.** A successor never writes into a prefix an earlier holder can still write. Late writes may land; they land where nobody reads them as current. With that in place: |
| +- the rev 6.7 wait goes: an unclean marker opens at once, into a new generation; |
| +- N-HA9's expiry wait goes: a confirmed-terminated owner's lock is taken on the proof alone (RHA §9.8 totals become 1 to 5 minutes, not 15); |
| +- the clean marker's monitor exposure closes, because every take writes a new generation. |
| + |
| +Out of scope: hung but live boxes (still terminated by the group, RHA §9.5); the process single-writer rule (I1's cgroup and termination proofs stay); legacy non-HA hosts and the box-wide Litestream (`internal/ops/litestream.go`). |
| + |
| +## 2. Invariants |
| + |
| +| ID | Invariant | Enforced by | |
| +|---|---|---| |
| +| G1 | **Own prefix.** Every take starts a new generation `<loc>/g-<id>/`, and its holder writes replica objects only there. Nothing it does writes, compacts or deletes outside its generation. | The replica client the lease package builds (§5.1); the take (§4). | |
| +| G2 | **One authority.** `<loc>/head.json` names the one current generation and changes only by a conditional write of the lock holder. | §4 step 5, `If-Match`. | |
| +| G3 | **Frozen start, at a proven position.** A new generation starts as a server-side copy of exact object versions of its predecessor, ending exactly at the predecessor's newest L0 TXID. A later write anywhere in the predecessor prefix cannot change the copy, and Litestream's local and replica positions both start there. | `CopyObject` with a source version id; the start rule (§4 step 4). | |
| +| G4 | **One reader, one generation.** Every reader resolves the replica through head.json, by one function, and binds the generation it resolved for the whole read: listings, downloads and retries. | §6.1, and a test that no caller builds a replica client at `<loc>` directly. | |
| +| G5 | **Self-contained generations.** No generation, and no head, refers to another generation's object versions after its take. Each generation restores from its own prefix alone. | §4 (copy, not reference); §8 retention touches whole generations only. | |
| + |
| +## 3. Layout |
| + |
| +- `<loc>/lock.json`: the lease and release markers (format in §9). |
| +- `<loc>/head.json`: the pointer (§3.1). Absent means the legacy root layout. |
| +- `<loc>/g-<id>/<level>/<min>-<max>.ltx`: one generation's Litestream files, the tree Litestream writes today, one level down. `<id>` is the lock generation of the take that created it, zero-padded to 20 digits (`g-00000000000000000042`). The lock's conditional take makes it unique, and it sorts. |
| +- `<loc>/` root LTX files: the **root generation** (`@root`, as `hostclaim.RootGeneration` names it). A predecessor only; never written once head.json exists. |
| +- `<loc>/files/0/`: unchanged (§7). |
| + |
| +The claim code uses the same `<location>/g-<gen>/` shape (`BindGeneration`, `claimgeneration.go:31`; `moves.ReplicaSource`; `genselect`). Its three prefix twins (`hostbox.GenerationPrefix`, `moves.GenerationPrefix`, `genselect.prefix`) fold into one helper. |
| + |
| +### 3.1 head.json |
| + |
| +```json |
| +{ |
| + "v": 1, |
| + "generation": "g-00000000000000000042", |
| + "created_by": {"lock_generation": 42, "box": "box-a", "iid": "i-0abc", "lifetime": "<incarnation>", "at": "2026-11-12T10:00:00Z"}, |
| + "start_txid": 1234, |
| + "predecessor": "g-00000000000000000037", |
| + "history": [ {"generation": "g-00000000000000000037", "start_txid": 900, "created_at": "...", "ended_at": "2026-11-12T10:00:00Z"} ] |
| +} |
| +``` |
| + |
| +- `start_txid` is the TXID the copy ends at; the generation's own writes begin after it. |
| +- `history` lists earlier generations still inside the restore window, newest first, with the time each stopped being current (`ended_at`). PITR uses it (§6.2); §8 trims it. |
| +- No version ids, so a move can copy head.json as it is (§6.3). |
| + |
| +## 4. The take |
| + |
| +The HA acquire is unchanged up to its conditional take of `lock.json` (RHA §9.4, `hafresh.DecideAcquire`). N is the lock generation the take wrote. Then, before the instance starts: |
| + |
| +0. **First wake.** If the acquire was a first wake (an absent lock over a proven-empty prefix, `hawake.go:525`), there is no predecessor: create head.json for an empty `g-N` with `If-None-Match: *`, boot fresh as today, and skip to step 6. A box that dies before its first upload leaves an empty current generation; the next take sees no L0 in it and, because head.json's `start_txid` is 0 and its `predecessor` is empty, starts another empty generation instead of refusing. |
| + |
| +1. **Read head.json** with its ETag `E` (absent: the current generation is `@root`; step 5 uses `If-None-Match: *`). |
| +2. **Start a generation.** Every take does, whatever the lock it replaced: a clean or unclean marker, a crash or termination takeover, a same-box recovery, `@root` (the migration, §9), a staged move (§6.3). G is the current generation from step 1. |
| +3. **List G** with versions (`ListObjectVersions` under G's prefix). A paged listing that fails fails the wake. |
| +4. **Plan at the L0 position, then copy.** Let `T` be the highest MaxTXID among G's current L0 files: the position Litestream reads on startup (`db.go:1414`, `replica.go:210`). Compute a restore plan over G's current versions using only files whose MaxTXID is at most `T`, ending exactly at `T`, and include the L0 file ending at `T`. Then `CopyObject` each planned file, by its exact version id, to the same level and name under `g-N/`. Copies run in parallel and are server-side. |
| + - Files above `T` (a snapshot or compaction that ran ahead of the uploaded L0, as an unclean release can leave) are not copied. Their transactions are lost, the same loss class as an unclean release today (RHA §5.2). |
| + - **Refusals, never a guess:** G holds no L0 file while it is not an empty first generation (step 0); no plan over files at most `T` reaches `T`; a clean marker of G records a TXID above `T` (a file it covers is missing). Each refuses the wake with its reason and raises the suspect-holder page (RHA §20); an operator restores by hand. An empty plan on a host with data is also a refusal, never a fresh boot. |
| + - Whatever G sent that is not visible now never enters `g-N` (G3). |
| +5. **Switch.** Restore locally from `g-N` (the keep rule still applies: a clean marker naming this box, with `T` equal to its TXID and an unchanged local record, keeps the local copy and skips the download). Then write head.json for `g-N` (`predecessor` G, `history` = G prepended, trimmed by §8), `If-Match: E`, with the lease healthy (`Held.Err()` nil). |
| + - **412:** head changed since step 1. Only a holder of an older lock generation can have written it, so its own switch was in flight when N took over, and it never served. N abandons: it deletes nothing (its `g-N` objects are unreferenced and §8 removes them), releases through a settled marker (it never replicated) and the wake retries once from the acquire. |
| + - Any other failure: a failed wake, released settled. |
| +6. **Replicate** into the current generation (§5.1) and serve. |
| + |
| +A late switch PUT from a holder that lost its lock lands either before N's step 1 (then N copies from that generation: right, its switch was real) or after it (then one of the two conditional writes gets 412). Exactly one switch per ETag. |
| + |
| +**Cost per take.** One GET (head), the listing, one `CopyObject` per planned file (typically one snapshot, a few compacted files and some L0; a drain release leaves one snapshot and one L0), one PUT. Copy time is S3-internal and grows with the database (a multipart copy above 5 GB). Storage: §8. |
| + |
| +## 5. Writing a generation |
| + |
| +### 5.1 The replica client |
| + |
| +`Held.Replicate` builds a generation client (the existing `generationClient`, `claimgeneration.go:90`, widened): |
| +- every request (`WriteLTXFile`, `LTXFiles`, `OpenLTXFile`, `DeleteLTXFiles`) is confined to `<loc>/<generation>/`; a key outside it is refused; |
| +- every request first checks the lease's health, as `BindGeneration`'s check does. |
| + |
| +Because a generation starts with a copy that ends at an L0 file at `T`, Litestream sees what it sees today after a restore: a replica whose L0 position is `T`, matching the restored database. Retention, compaction and the monitors work inside the generation as today, including on the copied files. |
| + |
| +### 5.2 Release |
| + |
| +Releases are unchanged (RHA §5.2, rev 6.7's markers). Whatever a holder sent late, after any release, lands in its own generation, which the successor has already copied from and no longer reads as current. |
| + |
| +### 5.3 The acquire table |
| + |
| +With every take in its own generation, `hafresh.DecideAcquire` drops the rev 6.7 row (an unclean marker is taken at once) and N-HA9's expiry clause (a confirmed-terminated owner is taken at once). Same-box recovery still needs the emptiness proof, and no longer waits for expiry. These table changes ship only with the gate (§9), in slice 4. |
| + |
| +## 6. Readers |
| + |
| +### 6.1 One resolver |
| + |
| +`lease.ResolveReplica(ctx, store, loc) (Replica, error)` reads head.json once (absent: `@root`) and returns a read-only Litestream client **bound to that generation's name**, confined to its prefix. One restore uses one resolution for its listings, downloads and retries. A reader whose flow spans requests (the console DB door lists, then downloads, `apidb.go:307/354`) carries the generation name in its handle and refuses, then restarts the read, if a later step would need a different one. Generations are never rewritten by a later holder, so a bound read is consistent even after head moves on. Every reader below switches to it (G4). Inventory (2026-11-12, at 08aed1c1): |
| + |
| +| Reader | Today | With generations | |
| +|---|---|---| |
| +| Wake restore: `backend_exec.go:1074` `restorePlain`, `hawake.go:553` `restoreHA` → `lease.Restore` (`lease.go:636`) | root levels | §4; a non-HA host keeps today's root restore | |
| +| Seed placement `seedplace.go:173` `HasReplica` (`check.go:405`) | root levels | resolver; "no replica" only when head is absent and the root is empty | |
| +| Console DB door `apidb.go:73/171/503`, backups `backups.go:182`, seed copy `apiinstanceseed.go:286`, box db reads `dbreads/read.go:166` | `ReadReplicaClient` at root | resolver | |
| +| Restore drill `ops/hibernate_verify.go:139/385`, `lease.VerifyReplica` (`check.go:215/248`) | root | resolver | |
| +| Create leftovers `createleftovers.go:71-99` `hostHoldsReplicaData` | root levels | also refuses on head.json or any `g-*/` (`hacreate.go:29`'s whole-prefix check already does) | |
| +| First-wake `prefixEmpty` (`ha.go:264`) | whole prefix | unchanged (sees `g-*`: safe refusal) | |
| +| Legacy moves `movespass.go:1505-1630`; offline stage, seal, land (`movesoffline_*.go`) | whole-prefix mirror; `newestLTX` parses root keys | §6.3 | |
| +| Promote staged replica `backend_exec.go:4105` (`MirrorPrefix` onto `<loc>`) | exact mirror, deletes extras | §6.3 | |
| +| Seed deletes `seedfinish.go:271`, `seedwiring.go:243` | delete `<loc>/` | unchanged (whole prefix, lock-checked) | |
| +| Park sweep `park/sweep.go:227`, `park/remote.go:547` | `instances/<host>/` exact versions | unchanged: whole prefix, so every generation | |
| +| Claim paths (`apidbclaim.go`, `genselect`, claim moves) | generation-aware | unchanged; share the prefix helper | |
| + |
| +### 6.2 Point-in-time reads |
| + |
| +`--at T` (#262): if T is at or after the current generation's `created_by.at`, read the current generation. Otherwise walk `history` to the entry whose `created_at` ≤ T < `ended_at` and read that generation alone, with today's CreatedAt rule. Each generation is self-contained (G5), so this needs no other generation. Files a generation's holder wrote after its successor's copy (a late write, or writes lost in an unclean release) are visible to a T inside that holder's tenure, because that is what that holder had at T. Documented as such. A T older than every `history` entry still inside the restore window is refused, as a T before the oldest retained file is today. |
| + |
| +### 6.3 Moves |
| + |
| +**v1 refuses every move of a generations host** (legacy, offline, staged promotion), with a reason naming this design, before anything is copied (round 3, gen-3.2). Moves need the instance's whole current state, the files manifest and its objects and root-level build state as well as the database, installed authoritatively on the landing side; that is a later slice (§11). Today's moves are unchanged for hosts without head.json, and the claim moves (`moves/source.go:30`) are unaffected. |
| + |
| +## 7. Files, wake state and other colocated objects |
| + |
| +Files objects are immutable and the manifest moves by compare-and-swap (RHA §8.2), so a late write cannot replace a successor's object. A late manifest CAS can still land between the successor's read and its first publish; the successor's CAS then gets 412 and its publisher errs (containment R1 A). Slice 1 adds one fence at take step 5, before serving: if a manifest exists, the successor rewrites it unchanged with its lock generation in it, `If-Match` the ETag it restored from; if none exists (an empty tree), it creates an empty manifest stamped with its lock generation, `If-None-Match: *`. A late write of the predecessor's then fails its condition. A conflict on the fence fails the wake and retries from the acquire; the publisher continues from the fence's own write as its baseline (`publisher.go:153`). Build state, rootfs and demo markers (`rootfsmarker.go:74`, `buildstate.go:82`, `demo_durability.go:186`) are not part of the wake's history and stay at the root. |
| + |
| +## 8. Retention and retirement |
| + |
| +The data bucket is versioned; noncurrent versions expire after `data_noncurrent_days` (7, `infra/modules/deployment-buckets`). Nothing here depends on a noncurrent version surviving: each take's copy is made at the take, and every later read uses current versions of a generation's own files (G5). |
| + |
| +- **Inside a generation:** Litestream retention as today (snapshot retention, L0 retention), run by the §5.2 scheduler. |
| +- **History:** a `history` entry stays while its `ended_at` is inside the restore window (7 days, #263). At each switch (§4 step 5) the new head drops the expired entries. |
| +- **Retirement:** after its switch, the new holder deletes the current objects of generations that left `history`, and of abandoned `g-*` prefixes no head names (a §4 step 5 412), older than one day. Their versions then expire by lifecycle. The park sweep already covers the whole prefix. |
| +- **Storage:** every take copies one restore plan (about one database's size, compressed). A host's extra storage is about its database size times its takes inside the 7-day window. A 100 MB host that wakes 50 times a day keeps about 35 GB more (about $0.80 a month at S3 Standard); most hosts wake a few times a day. §10 Q3 and §11 name the later reduction. |
| + |
| +## 9. Rollout and the old-binary fence |
| + |
| +A binary that predates this design reads and writes the root. Once a host has head.json, such a binary would restore stale root data and append to it. Three layers: |
| + |
| +- **Gate.** A pool turns generations on only when every box serving it publishes capability `replica-generations-1` (as `offline-move-1`). With the gate on, nothing places on a box without it. The release that adds the capability is the **floor**: no HA box goes below it. |
| +- **Old binaries still see HA, and refuse.** Today's `HAOn` is true for a lock with `carlos_release`, an owner starting `released/v1;`, or a parsable `;ha=1` owner (`hafresh/lock.go:94`); an HA lock is never taken by the legacy acquire (`legacytake.go:61`). Today's `DecideAcquire` refuses (ReasonBadMarker) an owner starting `released/v1;` with no `carlos_release` record (`acquire.go:89-93`). So a generations host's locks use: |
| + - release markers: owner `released/v1;ref=<box>;iid=<iid>;gen=1`, record field `carlos_release_g` (not `carlos_release`). Old HA acquire: bad marker, refused. Old legacy acquire: HA, refused. |
| + - held locks: owner `box/v1;ref=…;iid=…;pid=…;ha=1`, unchanged, plus record field `carlos_generation` written into the lock body by the take. An old box's HA acquire would treat it as an ordinary HA lock: it waits for expiry and termination proof, then takes, and would then restore the root. That case is closed by the gate and the floor only, and by slice 0 below. |
| +- **Slice 0, ahead of everything (rides an early release):** `DecideAcquire` and the legacy take refuse any lock carrying a field they do not know from a fixed list (`carlos_generation`, `carlos_release_g`, and any future `carlos_*`). Every binary at or above the floor then refuses a generations lock outright, held or released. Verify against the oldest binary on any HA box when the gate turns on. |
| +- **Migration:** no copy job. A host's first take on the new code starts `g-N` from `@root` (§4) and writes head.json. The root files are then retired with §8 (as a `history` entry named `@root`). |
| + |
| +## 10. Questions for Paul |
| + |
| +**Decided (Paul, 2026-11-15, HA session, relayed by the release manager): all five recommendations taken.** Q1 a server-side copy, not references to pinned versions. Q2 yes, drop N-HA9's expiry wait once this is live and its drills pass (slice 4). Q3 yes, one copy per wake in v1, measured on dev. Q4 yes, the up-front refusals and no moves of generations hosts in v1. Q5 no fourth review round; the slice-1 plan gets the review instead. The questions are kept below as asked. |
| + |
| +1. **How does a new generation get its start?** Recommended: a server-side copy of the predecessor's plan at its L0 position (§4 step 4): seconds for typical databases, no upload from the box, nothing refers back to another generation. Rejected: references to pinned versions (rev 1; the bucket's noncurrent expiry could delete one); a full upload from the box before serving (over a minute at 1.6 GB on every wake and failover). Astra agrees (round 2). |
| +2. **Drop N-HA9's expiry wait once this is live and its drills pass?** Recommended: yes, for confirmed-terminated owners and same-box recovery (§5.3). Astra agrees once the complete fence is verified. |
| +3. **Accept a copy per wake (§8 storage) for v1?** Recommended: yes, and measure on dev. Reusing a generation after a clean release needs proof that every request the holder sent was answered, which Litestream 0.5.14 cannot give (round 2); that is its own later design. |
| +4. **Accept the up-front refusals** (§4 step 4: no L0, or no plan reaching it, refuses the wake and pages) **and no moves of generations hosts in v1** (§6.3)? Recommended: yes. The refusals are rare and visible rather than a silent wrong history; moves get their own slice. |
| +5. **A fourth review round?** The budget is spent; round 3's two P1s are applied with Astra's own remedies (gen-3.1 a create-only fence, gen-3.2 a cut). Recommended: no round now; review the slice-1 plan instead, where these become code. |
| + |
| +## 11. Slices (after G6, except slice 0) |
| + |
| +0. **Unknown-field refusal** (§9), now: small, inert, rides the next release, so the floor exists when slice 1 needs it. |
| +1. **Lease core:** head.json, the take (§4) with the start rule, copy and switch, the confined client (§5.1), the bound resolver with wake restore and seed placement (§6.1), the files fence (§7), the gate and lock formats (§9). Behind the gate; dev only. |
| +2. **Readers:** door, backups, seed copy, db reads, drill, leftovers (§6.1), PITR (§6.2). |
| +3. **Retirement** (§8), then **moves** of generations hosts: current state only (the generation, the files manifest and objects, root build state), installed by a §4 start on landing; until then refused (§6.3). |
| +4. **Table change:** drop the rev 6.7 wait and N-HA9's expiry clause (§5.3), with RHA §21's drills rerun and timed. |
| + |
| +Later, its own design: reuse a generation after a release proven to have no request outstanding (a Litestream change or wrapper that accounts for every mutation attempt, retries included), to remove the per-wake copy. |
| + |
| +## 12. Tests and witnesses |
| + |
| +- The late-write witness (`unclean_marker_test.go`) with no wait: B takes at once into a new generation; A's held upload lands afterwards in A's generation; B's restore, PITR and compaction never see it. |
| +- Crash takeover on termination proof alone, with an upload landing a minute later. |
| +- Head races: two takes; a late switch PUT before and after the successor's read (§4 step 5); the 412 path leaves no head change and an unreferenced prefix §8 removes. |
| +- The copy is immune: overwrite a copied source key after step 4, and restore of the new generation is unchanged. |
| +- The start rule: a predecessor with an L9 above its newest L0 (the L9 is not copied; Litestream continues at `T + 1`); a drain release (one L9 and one L0 at the same TXID); no L0, and no plan reaching `T` (both refused, nothing written, page raised). |
| +- Old binaries: the oldest live release refuses a `released/v1;…;gen=1` marker without `carlos_release`; a slice-0 binary refuses a held lock with `carlos_generation`. Both the HA and the legacy acquire. |
| +- PITR across a generation boundary, inside and outside a predecessor's late tail (§6.2). |
| +- Moves of a generations host are refused before anything is copied (v1). |
| +- First wake creates an empty generation; a box dying before its first upload leaves a host the next take starts afresh, not a refusal. |
| +- The files fence with and without a manifest; a predecessor's late first manifest PUT fails its condition. |
| +- Bound reads: head switches between the door's listing and its download; the download stays on the bound generation or the read restarts, never mixes. |
| +- Retirement removes only generations outside `history` and abandoned prefixes over a day old. |
| +- Simulation: model generations; I1 becomes "no late write lands in the current generation", with rules for §4 steps 2 to 5 and §5.2, and a witness for each. |
| + |
| +## 13. Review budget |
| + |
| +At most three Astra rounds (memory round-limit-anti-spin). Rounds 1 to 3 are spent (rev 4 applies round 3 without a fourth). Further review needs Paul's go. A P1 in round three cuts scope or goes to Paul. |