Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
docs: say unlimited retention still prunes interrupted snapshots (#12618)
[._.]/ Adam Eivy25c55a7a5054
diff --git a/docs/BACKUP.md b/docs/BACKUP.mdindex c2ec24b7b4..28f8b2bb2e 100644--- a/docs/BACKUP.md+++ b/docs/BACKUP.md@@ -575,7 +575,7 @@ Separate from snapshot restore: `server/routes/database.js` can copy data **betwLeft unbounded, `snapshots/<hostname>/` grows forever — every prior full DB dump stays reachable, so a record deleted from the live database (including `privacy_vault_records`, `privacy_consents`, and `privacy_broker_cases`) remains restorable from an old snapshot indefinitely. `server/lib/backupConfig.js` resolves a per-source `retentionCount`, and `runBackup()` prunes with it after a successful database dump, or when the explicit file-backend escape hatch skips the dump (`pruneOldSnapshots()` in `backup.js`). A degraded run whose database dump failed skips pruning and logs a warning, preserving older snapshots until a later dump succeeds.- **New installs default to 30 completed snapshots per source.** The default ships as `backup.retentionCount: 30` in `data.reference/settings.json`, copied only into an install that has no `data/settings.json` yet — see the comment on `resolveRetentionCount()` for why this, not a migration, is what keeps an existing install from silently losing its archive. Operators choose 1–365, or Unlimited, from the Backup settings tab.-- **`retentionCount` absent or explicitly `null` both mean unlimited** — no pruning runs. This is why an install that predates this setting keeps every snapshot until the operator saves a choice: it has no stored value, and absence resolves to unlimited, not to the new-install default.+- **`retentionCount` absent or explicitly `null` both mean unlimited** — no completed snapshot is ever pruned. This is why an install that predates this setting keeps every completed snapshot until the operator saves a choice: it has no stored value, and absence resolves to unlimited, not to the new-install default. Unlimited retention still removes interrupted snapshots older than the newest healthy completed one (#12618), including ones a pre-#12618 version left with an empty `.in-progress` marker, so the first successful run after upgrading clears those partial copies.- **Pruning runs only after a run reaches a completed snapshot with a usable database dump** (`pg_dump` succeeded, or was explicitly skipped by the file-backend escape hatch). A degraded run whose database dump failed keeps older snapshots and reports zero pruned snapshots; retention resumes after a later successful dump. A run that fails before completion never prunes, and a prune failure is logged without failing an otherwise-successful backup.- **Pruning is scoped to the CURRENT machine's namespace** (`snapshots/<hostname>/`) and only ever deletes snapshots whose `snapshotState()` reports neither `incomplete` nor `failed`, plus interrupted snapshots older than the newest healthy completed one. Interrupted snapshots never count toward `retentionCount` and are pruned even under unlimited retention, since they can never be restored or downloaded. It never touches another machine's namespace in a shared destination, the legacy pre-namespace root, or an in-progress/ordinary failed snapshot — those stay until the operator deletes them explicitly. It also skips a snapshot that a restore or download is still reading (see [Snapshot source lifetime](#how-restore-works)); the skipped snapshot is not counted as pruned and becomes a candidate again on a later run.- **Unreadable or structurally invalid manifests are protected in addition to the retention count.** Retention uses the same field, count, path and SHA-256-shape validator as file restore, without hashing old payloads. Existing JSON `null`, arrays, malformed objects and invalid entries are not legacy absence. They never displace structurally valid completed snapshots, even when an incorrect clock gave a protected snapshot a future-dated ID. Snapshot IDs determine age; manifest timestamps do not change that ordering. Legacy completed snapshots with no manifest remain eligible for retention as before.