carlos / platform Public

docs: storage generations floor, console floor and recovery fixes

Runbook, Storage generations: delete the copy-pass residue (Fable P2-1);
the console at vG before the first switch-on and never rolled back
below it (Fable P2-2, also in README beside the app regions floor);
point at a history folder gives up every later change whatever the
transaction numbers (Astra P2-2); lock_not_generations means a binary
below the floor, so check the root for LTX files after head's
created_by.at before switching on (Fable P2-4); the floor is vG and the
box's activation refusal, in the PPv2 floor's style.

Plan: generations_floor names this branch's release; the fix wave and
the follow-ups it leaves.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev eefc435488ceeeef3cef2d43d2c9f205dfee105f parent e07dc30
3 files changed, +43 −14
  • README.md +11 −0
  • docs/region-ha-runbook.md +21 −13
  • docs/superpowers/plans/2026-11-17-region-ha-storage-generations.md +11 −1
diff --git a/README.md b/README.md
index df7f03104..c47fc9b57 100644
--- a/README.md
+++ b/README.md
@@ -341,6 +341,17 @@ own rollback: it stops new non-home regions and keeps existing ones in force.
The first release that understands app regions is v0.23.0.
+**Storage generations rollback floor.** Before the first group in a
+deployment switches on region HA storage generations
+(`CARLOS_HA_GENERATIONS`), the console must be at the release that
+carries them or later. Never roll the console back below that release
+while any host has `head.json`: an older console reads the host's root
+folder, so its database door, backups, seed copies and drills return stale
+data with no error for up to 7 days, and report no replica once the root
+folder is deleted. Name the same release in the console roll recipe in
+carloku-infrastructure. The runbook's Storage generations section
+(docs/region-ha-runbook.md) has the rest of the floor.
+
**The hostname history.** Once app regions are on, a hostname that has
held an app's data is never given to a new instance again, in any region.
Its old data may still sit in a bucket or on a box, and a new instance with
diff --git a/docs/region-ha-runbook.md b/docs/region-ha-runbook.md
index 2b342b6bb..c01674099 100644
--- a/docs/region-ha-runbook.md
+++ b/docs/region-ha-runbook.md
@@ -346,9 +346,23 @@ Set `CARLOS_HA_GENERATIONS` in the group's host.env, one group at a time:
Turn on `on` first and run the drills before `fast`. Never turn it off once a host has `head.json`. A host with `head.json` keeps using generations whatever the setting says because its lock stays in generations mode. But a host that has `head.json` and an ordinary lock, woken by a box with storage generations off, is refused with `lock_not_generations`.
-### The floor: nothing below v0.39.0
+Before the first group in a deployment is switched on, the console must be at vG or later (see [the floor](#the-floor-nothing-below-vg)). Never roll the console back below vG while any host has `head.json`. An older console reads the host's root folder, not the folder `head.json` names. Its database door, backups, seed copies and drills then return stale data with no error for up to 7 days, and report no replica once the root folder is deleted.
-Before switching a group on, set its `generations_floor` to v0.39.0. The group roll refuses any member below that release and any member that does not report `replica-generations-1`. A box older than v0.39.0 would read a generations host's lock as an ordinary lock and serve stale data. Do not lower or remove the floor while any host in the group has `head.json`.
+### The floor: nothing below vG
+
+vG is the release that carries storage generations, the first whose `carlos version --json` reports `replica-generations-1`. A box older than vG would read a generations host's lock as an ordinary lock and serve stale data.
+
+Before switching a group on, set its `generations_floor` to vG. The group roll refuses any member below that release and any member that does not report `replica-generations-1`. It also refuses while a declared fixed box has no edges file, because that box's release is unknown. Do not lower or remove the floor while any host in the group has `head.json`.
+
+The box enforces it too. A box whose host.env sets `CARLOS_HA_GENERATIONS` to anything but `0` or `off` refuses to activate a binary that does not report `replica-generations-1` in `carlos version --json`, and keeps the running binary. This covers an update, a rollback, `install-channel` and boot recovery, on fixed boxes and group members alike. The recovery unit makes the same check with `carlos system generations-allows-prev /opt/carlos/carlos.prev` (exit 0 allowed or not armed, 1 refused, 2 bad arguments). The refusal reads:
+
+```text
+this box serves region HA storage generations (CARLOS_HA_GENERATIONS is or was on); <binary> does not, so it cannot run here. Roll forward, or to a build at or above the first one with replica-generations-1.
+```
+
+The refusal stays after the switch is removed. When a root process on the box first sees the switch on, it writes `/etc/carlos/ha-generations-floor`, and the box keeps refusing while that file exists. The adopt pass, which runs at boot and every hour, writes it, and so does any update or recovery. Do not delete the file while any host the box serves has `head.json`.
+
+On a box with the guard armed, the guard binary `/opt/carlos/system/guard/carlos` is not refreshed by updates, and a guard binary older than vG recovers without this check. Before switching such a box on, check that both `/opt/carlos/carlos` and `/opt/carlos/carlos.prev` report `replica-generations-1`, as for [PROXY protocol](#the-floor-nothing-below-vn-on-an-nlb-target).
### A wake refused with ha_generation_refused
@@ -358,7 +372,7 @@ The box refused to start the host. The journal line names the reason:
- `no_l0` and `empty_plan_with_data` mean the previous holder's copy holds no usable starting point.
- `file_over_5gib` means one file is too large to copy.
- `head_missing` means generation folders exist but `head.json` does not.
-- `lock_not_generations` means a box with storage generations off met an ordinary lock on a host that has `head.json`.
+- `lock_not_generations` means a box with storage generations off met an ordinary lock on a host that has `head.json`. Every box at vG or later keeps a generations lock in generations mode, so a binary below the floor took that lock, or someone edited it by hand.
L0 is the newest level of the host's database copy, where each uploaded change lands first. The host stays down and pages once an hour. Do not edit `head.json` or the lock to get past it.
@@ -367,10 +381,12 @@ To restore the host, choose a folder to restart it from and point the host at it
1. List the host's folders with `carlos ops ha-generations list <host>`. It shows the folder `head.json` names, the folders in its history, each folder's newest L0 transaction and the lock. Choose the folder `head.json` names or one marked `(in history)`. Point refuses any other folder.
2. Check that folder with `carlos ops ha-generations verify <host> --gen <g-N>`. It restores the folder into a temporary file, checks it and removes the file.
3. Do a dry run with `carlos ops ha-generations point <host> --gen <g-N> --accept-loss-after <txid>`, where `<txid>` is the folder's newest L0 transaction from `list`. It writes nothing. It prints the two files it would write and one sentence that says what is lost. Read that sentence.
-4. Run the same command again with `--yes`. Point keeps the host's data up to `<txid>` and permanently gives up every transaction after it. It writes `head.json`, then the lock. If it says that `head.json` was written and the lock was not, run `list` again, then point again.
+4. Run the same command again with `--yes`. Pointing at the folder `head.json` names keeps the host's data up to `<txid>` and permanently gives up every transaction after it. Pointing at a folder from the history permanently gives up every change written after that folder stopped being current, whatever the transaction numbers: they cannot be compared between folders. Point writes `head.json`, then the lock. If it says that `head.json` was written and the lock was not, run `list` again, then point again.
5. Wake the host by sending it a request.
-A host refused with `head_missing` has no `head.json`, and `carlos ops` has no recovery for it yet: point refuses it. A host refused with `lock_not_generations` was woken by a box with storage generations off, and point does not fix it. Set `CARLOS_HA_GENERATIONS` to `on` or `fast` in that group's host.env.
+A host refused with `head_missing` has no `head.json`, and `carlos ops` has no recovery for it yet: point refuses it.
+
+A host refused with `lock_not_generations` had its lock taken by a binary below the floor, or edited by hand. Point does not fix it. Before you switch the group on, list the host's root layout, the files under `instances/<host>/` outside its `g-<number>/` folders, and look for LTX files written after `created_by.at` in `head.json`. Those are changes the binary below the floor wrote after the last generations take. Switching on makes the next wake copy from the folder `head.json` names, so those changes are not served, and the box later deletes them with the root folder. If you find any, copy them somewhere safe and ask before you switch on. Then find the box below the floor and roll it forward.
### Old folders and the clock
@@ -380,14 +396,6 @@ After each successful wake, the box deletes folders older than the 7-day restore
Moves of a host with `head.json` are refused for now, before anything is copied. The follow-up is discussion #1253.
-| Change | Revision |
-|---|---|
-| Refusal reasons | Defined the distinct meaning of all seven reason codes. |
-| Generation mode | Explained why hosts keep using generations and added the ordinary-lock exception. |
-| Missing storage time | Distinguished lock-write wake failure from switch-write retirement failure. |
-
-Flags: None.
-
## Install chrony on a fixed box
Before G3 step 4 on the G3 card, install chrony on each named fixed box during an attended maintenance window. Use the reviewed `scripts/region-ha-g3/chrony-fixed-box.sh` through SSM as root, with approval for the named box. Group boxes already configure Amazon Time Sync at first boot.
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 f64345724..6a33ffdb4 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
@@ -419,10 +419,15 @@ The ledger is `.superpowers/sdd/2026-11-17-region-ha-storage-generations/progres
**Decisions by 8a3d302 for Paul:**
- Ruling A: `generations_floor` is enforced in the group roll and refuses outright (`floor_generations`), never DR-4 (Task 13).
- Ruling B: an unbound console door read of a head.json host gets a 409 carrying the generation to bind (Task 8).
-- The floor is the slice-0 release, v0.39.0 (tag e1974e6c at 8c861346), not `ha_floor` at this branch's release as Task 12's switch-on order said.
+- The floor is the slice-0 release, v0.39.0 (tag e1974e6c at 8c861346), not `ha_floor` at this branch's release as Task 12's switch-on order said. **Superseded by the branch review fix wave (2026-11-19):** set `generations_floor` to this branch's release (vG: the first release whose `carlos version --json` and edges file report `replica-generations-1`). With the floor at v0.39.0, a roll to exactly v0.39.0 passed prepare and the floor step and was refused only at admission, after the member was rolled (Fable P3); at vG it is refused at prepare. The box's own activation floor (below) also refuses anything without the feature, v0.39.0 included.
- The clock family: every retirement time is store time (option 1); the clock-skew check was cut before that.
- Task 14 approved on conditions: point is a dry run unless `--yes`; Astra and Fable both review it; the dev drill exercises list, verify and point on a deliberately refused host (owed at switch-on); its CLI text goes through a copy pass.
+**Branch review fix wave (2026-11-19):**
+- Astra P1: the box's activation floor. A box whose `CARLOS_HA_GENERATIONS` is anything but empty, `0` or `off`, or that has ever had it set (`/etc/carlos/ha-generations-floor`, root 0600, written by the adopt pass's unit repair and by any activation guard that sees the switch on), refuses to activate a binary that does not report `replica-generations-1` in `carlos version --json`, on every path the PPv2 floor covers; the recovery unit gates carlos.prev with `carlos system generations-allows-prev`.
+- Fable P2-3: while `generations_floor` is set, a declared fixed box with no edges file is a generations refusal, not DR-4 only.
+- Runbook: console at vG before the first switch-on and never rolled back below it; history-generation point loss; `lock_not_generations` means a binary below the floor (check the root for LTX files after head's `created_by.at`); the activation refusal.
+
**Follow-ups (for the branch description):**
- Retirement deletes one key at a time (no DeleteObjects).
- Old CLI root-layout door reads cost one head GET per request until CLIs update.
@@ -431,3 +436,8 @@ The ledger is `.superpowers/sdd/2026-11-17-region-ha-storage-generations/progres
- No ops recovery for `head_missing` (point refuses no-head hosts).
- The sweep never reaches the take-side switch 412 (witness only); the retirement guards are caught only together.
- The replication-failure activator test skips as root.
+- A refused legacy move repeats one `head.json` GET per moves pass, each through a new store (`movespass.go`, `lease.HasHead`), until it is aborted. Reusing one store across passes needs a memo in `armMovesPass` (a census unit) and saves only the store's construction, not the GET; left as is (Fable P3).
+- The console door binds any valid generation name without checking that head.json names it (`apidb.go`, `parseDBBinding`): a caller can read `@root` or an abandoned partial `g-N` of its own host. The CLI binds only what the door names (Fable P3).
+- A root holding only Litestream v0.3 backups starts empty under generations (`genstart.go` PlanStart returns Empty) while the root reader still restores v0.3; the platform has pinned 0.5.x since 2026-08-01. A refusal when `<loc>/generations/` exists would close it (Fable P3).
+- The console's release is not gated: nothing refuses a console rollback below vG while hosts have head.json; the runbook and README say so, and the console roll recipe in carloku-infrastructure needs the same line (Fable P2-2).
+- `CARLOS_HA_GENERATIONS` is not in internal/hostenv's allowlist, so `carlos system host-env` and the group's SSM parameters cannot deliver it to group members yet; adding it is owed before switch-on.