observability: backup-sealed-size-ledger — the movement engine records each copy's sealed size — absent stays absent, never zero #820

Closed
opened 2026-08-25 10:59:28 +00:00 by matou-build-agent · 2 comments

Parent

Feature spec: #793 — control-panel observability child spec: backup replication matrix (P7-S7) (DDR 0205).
Design ticket #762; slice-map fan-in #770; wayfinder map #7.
Slice backup-sealed-size-ledger of docs/slices/observability.yaml; covers spec #793 stories 14, 26.

What to build

The movement engine already computes len(cipher.Sealed) to check the target's headroom before
every write, logs it, and then discards it. This slice threads it back so the copy carries it,
and the projection sums it into size on target (per pair) and on targets (per parent).

Size on target is a recorded figure, not a measurement — it is the sealed size the fleet
actually produced, never a du over the target and never an estimate. Absent stays absent: a
copy with no recorded sealed size (written before this landed, or re-derived from an inventory that
carried none) contributes nothing to the sum and renders — with the reason stated — never
0
(ADR 0100). The re-derived path takes the size from the inventory's ciphertext length where
the inventory carried it.

No edge to backup-pair-projection (slice-map ruling 4): the two are mergeable in either
order — the projection only decides where the number lands.

This is the only change in the whole feature that touches the write path. Read
docs/GOTCHAS.md before touching the movement path: the sealed-size figure crosses the same
boundary the crown-jewel sealing does, and nothing may be logged or persisted that discloses key
material or plaintext length beyond the sealed size already recorded for headroom.

## Open gate (veto-open, non-blocking) — #793 G4. Default: record it (the engine already
computes it for headroom and throws it away), which this manifest is written against. A veto
retires this slice entirely and the two size fields render permanently absent with their reason
stated — the surface stays honest and every other story is untouched.

Acceptance criteria

  • (story 14/26, decisions) Given a replicated copy, when the movement engine writes it, then the sealed byte length it already computes for headroom is recorded alongside the copy.
  • (story 26) Given a target holding retained verified moments with recorded sizes, then SIZE ON TARGET is the sum over those moments; and given the parent, then ON TARGETS is the sum over its counted pairs.
  • (stories 14, 26) Given a copy written before this ledger existed (or re-derived from an inventory carrying no size), then it contributes nothing to the sum and renders — with the reason stated — never 0 B and never an estimate.
  • (story 34) Given an unreachable pair, then its last-known figures are excluded from the parent's ON TARGETS sum.
  • (story 56) Given the re-derived path (Rederive), then sizes are present exactly where the inventories carried them and absent everywhere else.
  • (GOTCHAS) Given the movement path, then nothing is logged or persisted that discloses key material or plaintext length beyond the sealed size already recorded for headroom.

Blocked by

  • engine-adapters:backup-engine-exec (#168 — done, satisfied)

Task manifest

task: observability:backup-sealed-size-ledger
interface: the movement engine records each written copy's sealed byte length (the figure headroom already
  computes) alongside the copy; the replication projection sums it into per-pair `size on target` and
  per-parent `on targets`, with absence contributing nothing and rendering `—` with its reason
seam: 'the existing movement seam (prior art `movement_test.go`, `movement_production_test.go`) plus the
  orchestrator projection tests: a replicated copy''s recorded size equals the sealed byte length headroom
  checked; a copy written before the ledger existed reads absent rather than zero; sums cover only recorded
  sizes; the re-derived path takes sizes from the inventory''s ciphertext length where carried'
acceptance:
- given: a copy the movement engine writes
  when: the write completes
  then: the sealed byte length it computed for headroom is recorded alongside the copy
- given: a target holding copies with recorded sizes
  when: the projection sums
  then: '`size on target` is their sum and the parent''s `on targets` is the sum over counted pairs'
- given: a copy with no recorded sealed size
  when: the projection sums
  then: it contributes nothing and the cell renders `—` with the reason stated, never `0 B`
- given: an unreachable pair with last-known figures
  when: the projection sums
  then: its figures are excluded from `ON TARGETS`
- given: an orchestrator re-derived from inventories carrying no sizes
  when: the replication read runs
  then: the sizes read absent rather than zero
depends_on:
- engine-adapters:backup-engine-exec
out_of_scope:
- measuring a target's real disk usage (a `du` over the target) — headroom's concern is ADR 0104's, not
  this screen's
- any estimate or fabricated figure where a size was never recorded
- the projection's own pair/grade rules (`backup-pair-projection`)
- logging or persisting anything beyond the sealed size already recorded for headroom
needs_human_decision: []

Emitted by /to-tickets over docs/slices/observability.yaml in an unattended session under ADR 0174 (two-way-door posture — Ben's veto is asynchronous, never blocking). Advances #797.

## Parent Feature spec: **#793** — control-panel observability child spec: backup replication matrix (P7-S7) (DDR 0205). Design ticket #762; slice-map fan-in **#770**; wayfinder map #7. Slice `backup-sealed-size-ledger` of `docs/slices/observability.yaml`; covers spec #793 stories 14, 26. ## What to build The movement engine **already computes** `len(cipher.Sealed)` to check the target's headroom before every write, logs it, and then discards it. This slice threads it back so the **copy carries it**, and the projection sums it into *size on target* (per pair) and *on targets* (per parent). **Size on target is a recorded figure, not a measurement** — it is the sealed size the fleet actually produced, never a `du` over the target and never an estimate. **Absent stays absent**: a copy with no recorded sealed size (written before this landed, or re-derived from an inventory that carried none) contributes nothing to the sum and renders `—` with the reason stated — **never `0`** (ADR 0100). The re-derived path takes the size from the inventory's ciphertext length where the inventory carried it. **No edge to `backup-pair-projection`** (slice-map ruling 4): the two are mergeable in either order — the projection only decides where the number lands. **This is the only change in the whole feature that touches the write path.** Read `docs/GOTCHAS.md` before touching the movement path: the sealed-size figure crosses the same boundary the crown-jewel sealing does, and nothing may be logged or persisted that discloses key material or plaintext length beyond the sealed size already recorded for headroom. **## Open gate (veto-open, non-blocking) — #793 G4.** Default: record it (the engine already computes it for headroom and throws it away), which this manifest is written against. A veto retires this slice entirely and the two size fields render permanently absent with their reason stated — the surface stays honest and every other story is untouched. ## Acceptance criteria - [ ] (story 14/26, decisions) Given a replicated copy, when the movement engine writes it, then the sealed byte length it already computes for headroom is **recorded alongside the copy**. - [ ] (story 26) Given a target holding retained verified moments with recorded sizes, then `SIZE ON TARGET` is the sum over those moments; and given the parent, then `ON TARGETS` is the sum over its **counted** pairs. - [ ] (stories 14, 26) Given a copy written before this ledger existed (or re-derived from an inventory carrying no size), then it contributes **nothing** to the sum and renders `—` with the reason stated — **never `0 B`** and never an estimate. - [ ] (story 34) Given an unreachable pair, then its last-known figures are excluded from the parent's `ON TARGETS` sum. - [ ] (story 56) Given the re-derived path (`Rederive`), then sizes are present exactly where the inventories carried them and absent everywhere else. - [ ] (GOTCHAS) Given the movement path, then nothing is logged or persisted that discloses key material or plaintext length beyond the sealed size already recorded for headroom. ## Blocked by - `engine-adapters:backup-engine-exec` (#168 — done, satisfied) ## Task manifest ```yaml task: observability:backup-sealed-size-ledger interface: the movement engine records each written copy's sealed byte length (the figure headroom already computes) alongside the copy; the replication projection sums it into per-pair `size on target` and per-parent `on targets`, with absence contributing nothing and rendering `—` with its reason seam: 'the existing movement seam (prior art `movement_test.go`, `movement_production_test.go`) plus the orchestrator projection tests: a replicated copy''s recorded size equals the sealed byte length headroom checked; a copy written before the ledger existed reads absent rather than zero; sums cover only recorded sizes; the re-derived path takes sizes from the inventory''s ciphertext length where carried' acceptance: - given: a copy the movement engine writes when: the write completes then: the sealed byte length it computed for headroom is recorded alongside the copy - given: a target holding copies with recorded sizes when: the projection sums then: '`size on target` is their sum and the parent''s `on targets` is the sum over counted pairs' - given: a copy with no recorded sealed size when: the projection sums then: it contributes nothing and the cell renders `—` with the reason stated, never `0 B` - given: an unreachable pair with last-known figures when: the projection sums then: its figures are excluded from `ON TARGETS` - given: an orchestrator re-derived from inventories carrying no sizes when: the replication read runs then: the sizes read absent rather than zero depends_on: - engine-adapters:backup-engine-exec out_of_scope: - measuring a target's real disk usage (a `du` over the target) — headroom's concern is ADR 0104's, not this screen's - any estimate or fabricated figure where a size was never recorded - the projection's own pair/grade rules (`backup-pair-projection`) - logging or persisting anything beyond the sealed size already recorded for headroom needs_human_decision: [] ``` --- *Emitted by `/to-tickets` over `docs/slices/observability.yaml` in an unattended session under ADR 0174 (two-way-door posture — Ben's veto is asynchronous, never blocking). Advances #797.*
Author
Member

swarm-claim host=elitebook-distributed-server-03 run=10063
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=elitebook-distributed-server-03 run=10063 (automated multi-host claim — lowest live claim id works this ticket)
Author
Member

close-report for #820 — status success

✅ close-report gates passed — every claim verified against main; issue closed.

envelope
{
  "issue": 820,
  "status": "success",
  "commits": [
    "a111ca0929531c43539d8d49e55e736c5efc0c2e"
  ],
  "changed_files": [
    "STATUS.md",
    "internal/backup/backup.go",
    "internal/backup/rebuild.go",
    "internal/backup/sealedsize_test.go",
    "internal/backup/targets.go",
    "internal/backupengine/movement.go",
    "internal/backupengine/movement_test.go"
  ],
  "tests": [
    {
      "command": "go build ./...",
      "exit_code": 0
    },
    {
      "command": "go vet ./internal/backup/... ./internal/backupengine/...",
      "exit_code": 0
    },
    {
      "command": "go test -count=1 ./internal/backup/... ./internal/backupengine/... ./internal/controlapi/... ./control-plane/...",
      "exit_code": 0
    },
    {
      "command": "gofmt -l internal/backup/ internal/backupengine/ (no output)",
      "exit_code": 0
    },
    {
      "command": "pre-push gate: nix develop .#go-ci (build/vet/golangci-lint/test) — passed on push",
      "exit_code": 0
    }
  ],
  "criteria": {
    "story 14/26 — the sealed byte length headroom computes is recorded alongside the copy on write": "internal/backupengine/movement.go records one `sealedSize` var (fed to CheckHeadroom and to InventoryMoment.SealedSize); proven by TestReplicate_RecordsSealedSizeEqualToHeadroomFigure (movement_test.go) — cold-read moment.SealedSize == len(sealed file)",
    "story 26 — SIZE ON TARGET is the sum over retained verified moments; ON TARGETS is the sum over counted pairs": "internal/backup/targets.go TargetInventory.SizeOnTarget + SumOnTargets; internal/backup/backup.go Orchestrator.SizeOnTarget/OnTargets; proven by TestSizeOnTarget_SumsRecordedVerifiedMomentsAbsentContributesNothing and TestSumOnTargets_SumsCountedPairsExcludesUnreachable and TestRederive_SizesPresentWhereInventoriesCarriedThemElseAbsent",
    "stories 14,26 — a copy written before the ledger (or re-derived with none) contributes nothing and renders `—`, never `0 B`": "InventoryMoment.RecordedSealedBytes() returns (0,false) for a bare moment (SealedSize *int64, nil=absent); sums skip absent; proven by TestRecordedSealedBytes_PrefersRecordedThenCiphertextElseAbsent + the absent branches of the sum tests",
    "story 34 — an unreachable pair's last-known figures are excluded from ON TARGETS": "OnTargets/SumOnTargets take a caller-supplied `counted` reachability predicate; proven by TestSumOnTargets_SumsCountedPairsExcludesUnreachable (the unreachable pair's 999 is excluded)",
    "story 56 — the re-derived path takes sizes present exactly where the inventories carried them and absent elsewhere": "internal/backup/rebuild.go rederiveFromInventories folds each inventory's SizeOnTarget into the orchestrator's sizeOnTarget map; RecordedSealedBytes falls back to ciphertext length; proven by TestRederive_SizesPresentWhereInventoriesCarriedThemElseAbsent (chat present, files absent-not-zero)",
    "GOTCHAS — nothing logged or persisted beyond the sealed size already recorded for headroom": "the recorded figure is exactly len(cipher.Sealed) (the headroom figure); no new log field (the existing `bytes` slog attr already logged it); SealedSize is metadata that survives strippedInventory while the ciphertext bytes stay stripped; proven by TestSealedSize_SurvivesStripAndColdReadsBack (JSON carries `sealed_size` but not the ciphertext)"
  },
  "summary": "The movement engine records each replicated copy's sealed byte length (the figure headroom already computes) alongside the copy, and the replication projection sums it into per-pair size-on-target and per-parent on-targets with absence contributing nothing and rendering `—`, never `0 B`.",
  "blockers": []
}
**close-report** for #820 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; issue closed. <details><summary>envelope</summary> ```json { "issue": 820, "status": "success", "commits": [ "a111ca0929531c43539d8d49e55e736c5efc0c2e" ], "changed_files": [ "STATUS.md", "internal/backup/backup.go", "internal/backup/rebuild.go", "internal/backup/sealedsize_test.go", "internal/backup/targets.go", "internal/backupengine/movement.go", "internal/backupengine/movement_test.go" ], "tests": [ { "command": "go build ./...", "exit_code": 0 }, { "command": "go vet ./internal/backup/... ./internal/backupengine/...", "exit_code": 0 }, { "command": "go test -count=1 ./internal/backup/... ./internal/backupengine/... ./internal/controlapi/... ./control-plane/...", "exit_code": 0 }, { "command": "gofmt -l internal/backup/ internal/backupengine/ (no output)", "exit_code": 0 }, { "command": "pre-push gate: nix develop .#go-ci (build/vet/golangci-lint/test) — passed on push", "exit_code": 0 } ], "criteria": { "story 14/26 — the sealed byte length headroom computes is recorded alongside the copy on write": "internal/backupengine/movement.go records one `sealedSize` var (fed to CheckHeadroom and to InventoryMoment.SealedSize); proven by TestReplicate_RecordsSealedSizeEqualToHeadroomFigure (movement_test.go) — cold-read moment.SealedSize == len(sealed file)", "story 26 — SIZE ON TARGET is the sum over retained verified moments; ON TARGETS is the sum over counted pairs": "internal/backup/targets.go TargetInventory.SizeOnTarget + SumOnTargets; internal/backup/backup.go Orchestrator.SizeOnTarget/OnTargets; proven by TestSizeOnTarget_SumsRecordedVerifiedMomentsAbsentContributesNothing and TestSumOnTargets_SumsCountedPairsExcludesUnreachable and TestRederive_SizesPresentWhereInventoriesCarriedThemElseAbsent", "stories 14,26 — a copy written before the ledger (or re-derived with none) contributes nothing and renders `—`, never `0 B`": "InventoryMoment.RecordedSealedBytes() returns (0,false) for a bare moment (SealedSize *int64, nil=absent); sums skip absent; proven by TestRecordedSealedBytes_PrefersRecordedThenCiphertextElseAbsent + the absent branches of the sum tests", "story 34 — an unreachable pair's last-known figures are excluded from ON TARGETS": "OnTargets/SumOnTargets take a caller-supplied `counted` reachability predicate; proven by TestSumOnTargets_SumsCountedPairsExcludesUnreachable (the unreachable pair's 999 is excluded)", "story 56 — the re-derived path takes sizes present exactly where the inventories carried them and absent elsewhere": "internal/backup/rebuild.go rederiveFromInventories folds each inventory's SizeOnTarget into the orchestrator's sizeOnTarget map; RecordedSealedBytes falls back to ciphertext length; proven by TestRederive_SizesPresentWhereInventoriesCarriedThemElseAbsent (chat present, files absent-not-zero)", "GOTCHAS — nothing logged or persisted beyond the sealed size already recorded for headroom": "the recorded figure is exactly len(cipher.Sealed) (the headroom figure); no new log field (the existing `bytes` slog attr already logged it); SealedSize is metadata that survives strippedInventory while the ciphertext bytes stay stripped; proven by TestSealedSize_SurvivesStripAndColdReadsBack (JSON carries `sealed_size` but not the ciphertext)" }, "summary": "The movement engine records each replicated copy's sealed byte length (the figure headroom already computes) alongside the copy, and the replication projection sums it into per-pair size-on-target and per-parent on-targets with absence contributing nothing and rendering `—`, never `0 B`.", "blockers": [] } ``` </details>
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#820
No description provided.