backupengine: a snapshot BUNDLE can never replicate — Replicate cats one file, but the IDIP identity and content contracts return a directory #1802
Labels
No labels
agent-blocked
agent-working
autopilot
bug
deferred
deploy-pending
enhancement
landing-pr
model-haiku
model-opus
model-sonnet
needs-design
needs-info
needs-triage
no-triage
out-of-scope
priority
ready-for-agent
ready-for-human
ready-for-session
rehearsal-183
snapshot-pending
standing-drive
wayfinder:grilling
wayfinder:map
wayfinder:prototype
wayfinder:research
wayfinder:task
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Matou/idss#1802
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The defect
Engine.Replicatereads a snapshot artifact as one file:But two of the three written backup contracts return a directory:
catinternal/backupengine/identity.go)identity-XXXXXXXX.jsoninternal/keria/backup.go)mktemp -dbundle:keria/,keri-witness/,roster.json,matou-config/,blip.jsoncontent— anysync (internal/anysync/backup.go:171,226)mktemp -dbundle: mongodump + minio/treeNothing anywhere tars a bundle —
grep '"tar"' internal/**/*.gofinds onlyinstall/guestpayload.go.So the dataset an IDIP community cannot be re-founded without can reach no target at all — hosted offsite, cross-device, or "This computer" (DDR 0268). Same for
content.Why it is latent, not live
backupengine.WithContracthas no production caller — onlycmd/smoke-backupsandcmd/smoke-fleet. The whole composition registersemptyCatalogue, so only kanidm's built-in Identity contract is reachable on a real gateway today, and that one happens to return a single file. The bug surfaces the moment any bundle contract is registered.Why it blocks more than itself
DDR 0268 decision 5 (the IDSS offsite storage free-tier allowance) cannot be settled without this: the allowance is a size ÷ retention, and there is no snapshot size until a bundle has a single-file form and a compression answer. See that DDR's measured table — KERIA is ~3 MiB of LMDB per member.
Ruling (agent, ADR 0174 — two-way door, veto anytime)
Revertible by a commit and provable by the contract tests, so ruled here rather than parked:
tar. Not a foreign repository format (ADR 0104's refusal stands) — a bundle stays readable on a bare target with standard tooling plus the community's keys (ADR 0082 §2).tar --sparseis mandatory. KERIA runs 100 MiB LMDB map size per DB, sparse (docs/research/2026-08-24-keria-stack-on-nixos.md). The in-window copy usescp -a, which preserves holes; a naivetarwould expand every map file to its full 100 MiB and multiply the artifact by an order of magnitude.tar -zor equivalent) — PROPOSED, flagged because it moves DDR 0268's figure. LMDB and mongodump both compress well. Ben may prefer uncompressed for the same "readable with a JSON reader alone" reason kanidm's contract decompresses its export; say so on this ticket and it changes.cat: Is a directory.Acceptance criteria
internal/keria's identity snapshot returns a single file; its bundle round-trips — tar → seal → target → open → untar — byte-identical, including sparse LMDB map files that do not expand to their full map size.internal/anysync'scontentsnapshot likewise returns a single file and round-trips.Engine.Replicategiven a directory artifact fails with a named, honest error; a seam test pins it.docs/GOTCHAS.mdgains the sparse-LMDB entry (ADR 0160): symptom = an offsite copy orders of magnitude larger than the live data; cause =tarwithout--sparseover LMDB map files; rule = the flag.Related, NOT in scope (worth its own ticket if it bites)
Replicateholds the whole artifact in memory twice —catreturns the plaintext as[]byte,backup.Sealproduces the ciphertext as a second[]byte, andstore.Puttakes that slice. Fine for a megabyte JSON export; a ~150 MiB KERIA bundle on a 4 GB gateway is a different proposition, and the catalogue's steady-memory budget (ADR 0243) does not account for it.Decisions
swarm-claim host=elitebook-distributed-server-03 run=30978
(automated multi-host claim — lowest live claim id works this ticket)
Ruled by agent under ADR 0174 — veto anytime.
Ruling item 3 (compression): the single-file bundle form ships uncompressed (
tar --sparse, no-z). Bothinternal/keriaandinternal/anysynctar their bundles withbackupengine.TarBundle→tar --sparse -cf.Why this is a two-way door: it is revertible by a one-line change to
TarBundle/UntarBundle(add-z/--zstd) and proven either way by the round-trip contract tests (TestSnapshotIsSingleFileAndSparseBundleRoundTrips,TestContentSnapshotIsSingleFileAndSparseBundleRoundTrips). It is not on the one-way-door list.Why uncompressed by default: the same reason kanidm's Identity contract decompresses its export — a sealed artifact must be readable on a bare target with the community's keys plus standard tooling alone, no decompressor implied by the artifact's own format (ADR 0082 §2).
--sparsealready collapses the LMDB holes that were the order-of-magnitude blow-up, so the artifact is bounded by real data, not map size.Ben: if you'd prefer compressed (LMDB + mongodump both compress well, and it would shrink DDR 0268's free-tier size÷retention figure), say so here and it changes — one commit, no data-format migration, since nothing production registers a bundle contract yet.
close-report for #1802 — status
success✅ close-report gates passed — every claim verified against main; issue closed.
envelope