backups: rebuild-from-nothing-property — offsite ciphertext survives a total loss #94

Closed
opened 2026-07-25 04:59:51 +00:00 by ben · 1 comment
Owner

Parent

Feature spec: #20 (backups).

What to build

The disaster-survival contract, asserted as harness properties rather than a screen (no wireframe): every backup artifact is shaped so a total loss is genuinely recoverable with no step consulting infrastructure that burned down (ADR 0082). Offsite copies are ciphertext only: in a rebuild-from-nothing, the recovery kit / combined shares yield the crown jewels → the config repo comes back → the restored policy names the offsite target → the target's self-describing inventory lists the snapshots → the crown-jewel keys decrypt them → every dataset restores, and the offsite host can never read the data (story 29). Run history and coverage are re-derivable, not durable: losing the gateway never means losing the backups' truth — when the gateway is rebuilt the run ledger and coverage map are recomputed from policy (config repo) + target inventories (targets, where "last good" and verification results travel) + per-service health, never a gateway-local table (story 30).

This slice builds the artifact shapes and the properties that guarantee them — the encryption boundary, the self-describing target inventory, the re-derivable projection — and the harness that asserts them. The running rebuild engine is rescue's; this slice's obligation is that every artifact rescue's Tier-3 ceremony consumes exists with these rebuild-from-nothing properties. Notes: the kit-held keys live in the crown-jewel secret store seeded at founding (ADR 0044/0082) — a runtime coupling, not a build edge; consumed by rescue:tier3-ceremony (artifacts + properties only).

Acceptance criteria

  • (story 29) Given a total loss, when recovery runs (rescue drives the ladder), then the recovery kit / combined shares yield the crown jewels → the config repo comes back → the restored policy names the offsite target → the target's self-describing inventory lists the snapshots → the crown-jewel keys decrypt them → every dataset restores, with no step consulting infrastructure that burned down.
  • (story 30) Given the gateway is lost, when it is rebuilt, then the run ledger and coverage map are recomputed from policy (config repo) + target inventories (targets) + per-service health — "last good" and verification results travel in the self-describing target inventory, not a gateway-local table.

Blocked by

  • #88 — the snapshots/inventory whose shape is asserted

Task manifest

task: backups:rebuild-from-nothing-property
implements_flow: p7-backups
implements_edge: (property — no single flow edge; underpins the disaster-survival contract)
interface: backup artifact shapes + properties — offsite snapshots are ciphertext (keys only in the crown-jewel store); target holds a self-describing inventory (datasets, moments, verification results); run ledger + coverage re-derivable from policy + target inventories + per-service health, no durable gateway table
wireframe: (none — asserted via harness properties, not a screen)
seam: "backup orchestrator seam tests (control plane, Go) \u2014 property harness: offsite holder sees only ciphertext; rebuild recomputes ledger/coverage from policy + fake target inventories + fake per-service health with no gateway-local state; total-loss decrypt chain via kit-held keys"
acceptance:
  - given: a total loss
    when: recovery runs (rescue drives the ladder)
    then: kit/shares → crown jewels → config repo → restored policy names the offsite target → self-describing inventory lists snapshots → crown-jewel keys decrypt → every dataset restores, with no step consulting burned-down infrastructure
  - given: the gateway is lost
    when: it is rebuilt
    then: run ledger and coverage are recomputed from policy + target inventories + per-service health; last good and verification results live in the self-describing target inventory, not a gateway-local table
depends_on: [scheduled-runs-and-verification]
out_of_scope:
  - the running Tier-3 rebuild engine and ceremony — rescue:tier3-ceremony's (consumes these artifacts/properties)
  - a run/coverage database as durable state (rejected, ADR 0082)
needs_human_decision: []
## Parent Feature spec: #20 (backups). ## What to build The disaster-survival contract, asserted as harness **properties** rather than a screen (no wireframe): every backup artifact is shaped so a **total loss** is genuinely recoverable with **no step consulting infrastructure that burned down** (ADR 0082). Offsite copies are **ciphertext only**: in a rebuild-from-nothing, the recovery kit / combined shares yield the crown jewels → the config repo comes back → the restored policy names the offsite target → the target's **self-describing inventory** lists the snapshots → the crown-jewel keys decrypt them → every dataset restores, and the offsite host can never read the data (story 29). Run history and coverage are **re-derivable, not durable**: losing the gateway never means losing the backups' truth — when the gateway is rebuilt the run ledger and coverage map are recomputed from **policy** (config repo) + **target inventories** (targets, where "last good" and verification results travel) + **per-service health**, never a gateway-local table (story 30). This slice builds the artifact shapes and the properties that guarantee them — the encryption boundary, the self-describing target inventory, the re-derivable projection — and the harness that asserts them. The running rebuild engine is **rescue's**; this slice's obligation is that every artifact rescue's Tier-3 ceremony consumes exists with these rebuild-from-nothing properties. Notes: the kit-held keys live in the crown-jewel secret store seeded at founding (ADR 0044/0082) — a runtime coupling, not a build edge; consumed by rescue:tier3-ceremony (artifacts + properties only). ## Acceptance criteria - [ ] (story 29) Given a total loss, when recovery runs (rescue drives the ladder), then the recovery kit / combined shares yield the crown jewels → the config repo comes back → the restored policy names the offsite target → the target's self-describing inventory lists the snapshots → the crown-jewel keys decrypt them → every dataset restores, with no step consulting infrastructure that burned down. - [ ] (story 30) Given the gateway is lost, when it is rebuilt, then the run ledger and coverage map are recomputed from policy (config repo) + target inventories (targets) + per-service health — "last good" and verification results travel in the self-describing target inventory, not a gateway-local table. ## Blocked by - #88 — the snapshots/inventory whose shape is asserted ## Task manifest ```yaml task: backups:rebuild-from-nothing-property implements_flow: p7-backups implements_edge: (property — no single flow edge; underpins the disaster-survival contract) interface: backup artifact shapes + properties — offsite snapshots are ciphertext (keys only in the crown-jewel store); target holds a self-describing inventory (datasets, moments, verification results); run ledger + coverage re-derivable from policy + target inventories + per-service health, no durable gateway table wireframe: (none — asserted via harness properties, not a screen) seam: "backup orchestrator seam tests (control plane, Go) \u2014 property harness: offsite holder sees only ciphertext; rebuild recomputes ledger/coverage from policy + fake target inventories + fake per-service health with no gateway-local state; total-loss decrypt chain via kit-held keys" acceptance: - given: a total loss when: recovery runs (rescue drives the ladder) then: kit/shares → crown jewels → config repo → restored policy names the offsite target → self-describing inventory lists snapshots → crown-jewel keys decrypt → every dataset restores, with no step consulting burned-down infrastructure - given: the gateway is lost when: it is rebuilt then: run ledger and coverage are recomputed from policy + target inventories + per-service health; last good and verification results live in the self-describing target inventory, not a gateway-local table depends_on: [scheduled-runs-and-verification] out_of_scope: - the running Tier-3 rebuild engine and ceremony — rescue:tier3-ceremony's (consumes these artifacts/properties) - a run/coverage database as durable state (rejected, ADR 0082) needs_human_decision: [] ```
Author
Owner

Done in bf09e7e (on origin/main).

The disaster-survival contract shipped as harness properties (no screen — engineering slice), in internal/backup/rebuild.go + rebuild_test.go:

  • Encryption boundary (story 29): Seal/Open (AES-GCM) put a snapshot on a target as Ciphertext — sealed bytes + a key ref, never the key. Keys live only in the crown-jewel store (CrownJewelKeys, seeded at founding, ADR 0044/0082). Test TestOffsiteHolderSeesOnlyCiphertext proves an offsite holder holds ciphertext it can never read; only the crown-jewel key opens it.
  • Self-describing target inventory: TargetInventory/InventoryMoment carry datasets, moments, verification results and the ciphertext; Orchestrator.InventoryFor/SealedInventoryFor emit it from real run state. Last good + verification results travel in the inventory, not a gateway-local table.
  • Total-loss decrypt chain (story 29): RebuildFromNothing(kit, inventories) walks recovery kit → crown jewels → config-repo policy names the offsite target → self-describing inventory lists the snapshots → crown-jewel keys decrypt → every dataset restores. TestTotalLossDecryptChainRestoresEveryDataset restores every dataset from artifacts alone (no gateway); without recovered crown jewels the same inventories restore nothing. TestRebuildErrorsRatherThanSilentlyLosingADataset proves a broken rung errors, never silently drops a dataset.
  • Re-derivable projection (story 30): Rederive(fleet, ports, clock, policies, inventories) recomputes ledger + coverage from policy + target inventories + per-service health only (coalescing a moment seen on several targets into one run). TestGatewayRebuildRederivesLedgerAndCoverage asserts the re-derived Overview()/RunsView() read identically to the live gateway — no durable gateway table.

Out of scope, unchanged: the running Tier-3 rebuild engine is rescue's (consumes these artifacts); a run/coverage DB as durable state stays rejected (ADR 0082). 5 Go property tests + existing 8 run tests green; go vet + gofmt clean. STATUS.md updated (header + milestone log).

Done in bf09e7e (on `origin/main`). The disaster-survival contract shipped as harness **properties** (no screen — engineering slice), in `internal/backup/rebuild.go` + `rebuild_test.go`: - **Encryption boundary (story 29):** `Seal`/`Open` (AES-GCM) put a snapshot on a target as `Ciphertext` — sealed bytes + a key *ref*, never the key. Keys live only in the crown-jewel store (`CrownJewelKeys`, seeded at founding, ADR 0044/0082). Test `TestOffsiteHolderSeesOnlyCiphertext` proves an offsite holder holds ciphertext it can never read; only the crown-jewel key opens it. - **Self-describing target inventory:** `TargetInventory`/`InventoryMoment` carry datasets, moments, verification results and the ciphertext; `Orchestrator.InventoryFor`/`SealedInventoryFor` emit it from real run state. Last good + verification results travel in the inventory, not a gateway-local table. - **Total-loss decrypt chain (story 29):** `RebuildFromNothing(kit, inventories)` walks recovery kit → crown jewels → config-repo policy names the offsite target → self-describing inventory lists the snapshots → crown-jewel keys decrypt → every dataset restores. `TestTotalLossDecryptChainRestoresEveryDataset` restores every dataset from artifacts alone (no gateway); without recovered crown jewels the same inventories restore nothing. `TestRebuildErrorsRatherThanSilentlyLosingADataset` proves a broken rung errors, never silently drops a dataset. - **Re-derivable projection (story 30):** `Rederive(fleet, ports, clock, policies, inventories)` recomputes ledger + coverage from policy + target inventories + per-service health only (coalescing a moment seen on several targets into one run). `TestGatewayRebuildRederivesLedgerAndCoverage` asserts the re-derived `Overview()`/`RunsView()` read identically to the live gateway — no durable gateway table. Out of scope, unchanged: the running Tier-3 rebuild engine is rescue's (consumes these artifacts); a run/coverage DB as durable state stays rejected (ADR 0082). 5 Go property tests + existing 8 run tests green; `go vet` + `gofmt` clean. STATUS.md updated (header + milestone log).
ben closed this issue 2026-07-26 01:10:21 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Matou/idss#94
No description provided.