Skip to content

feat(backups): the worker refreshes the backup catalog on its own (OD-73) - #75

Merged
davdxpx merged 1 commit into
mainfrom
feat/backup-catalog-auto-refresh
Nov 9, 2026
Merged

davdxpx merged 1 commit into
mainfrom
feat/backup-catalog-auto-refresh

Conversation

@davdxpx

@davdxpx davdxpx commented Nov 9, 2026

Copy link
Copy Markdown
Owner

What

The worker refreshes the backup catalog mirror on its own (OD-73, decided by the owner on 2026-11-09).

  • New worker task backups.catalog_refresh, every 5 minutes.
  • For every cluster with a repository that is neither retired nor external, it plans and accepts backup.catalog.refresh as the system actor (system:worker).
  • It holds a per-cluster advisory lock and skips a cluster whose refresh is already open (waiting, queued, running, verifying, needs reconciliation).
  • It follows the existing worker-started suspension (suspendForIdentityMismatch). The kind stays low and read-only on the host, is audited, and goes through the worker's dispatch re-check like a person's refresh.
  • A cluster whose node is offline or lacks the capability is skipped with the warning backups.system_refresh_unreachable and retried on the next pass.
  • Any other failure of one cluster is logged as backups.system_refresh_failed, never stops the other clusters, and marks the task run failed (review finding).

Why

[OBSERVED] on REOSA production (cls_01M5J4RDBP52B715X5HDFKDN5F), 2026-11-09:

  • The host's pgBackRest backups run and verify.
  • Even so, the protection state reads unknown 30 minutes after every manual refresh.
  • Every production approval of a destructive migration met BACKUP_REQUIRED until someone refreshed by hand (P6 needs a catalog younger than 10 minutes).

Why 5 minutes and not 10: a 10-minute cadence would leave the catalog just outside the policy hooks' 10-minute window for part of every cycle.

Docs

  • open-decisions.md: OD-73 (section and index row); the VC-038 row is marked superseded.
  • 09-backups-and-restore/architecture.md §3 and §5.
  • adoption.md step 4.
  • PRE-WAVE-11-REVIEW.md: the VC-038 row.

Tests

  • New test, first in apps/server/test/http-backups.int.test.ts, real PostgreSQL 17: a production cluster is refreshed by the system without an approval, a second pass while one is queued plans nothing, the mirror is read afterwards (protection no longer unknown), and a pass after it succeeded refreshes again.
  • Red on origin/main (617fcd61): the worker has no task backups.catalog_refresh.
  • Whole http-backups.int.test.ts: 16/16.
  • New unit test packages/backups/test/auto-refresh.test.ts: a cluster whose transaction fails is reported and the next cluster is still checked.
  • http-registry-tier, http-drift-accept, http-registry, http-migrations: 59/59.
  • packages/backups unit 42/42, integration 29/29.
  • Independent code review: no critical or high findings; the medium one (per-cluster isolation) is fixed here.
  • apps/server unit 218/218.
  • bun run check, typecheck (backups, server), boundaries, secrets green.
  • Full bun run verify not run (no CI by owner rule).

Consequence

  • About 288 refresh operations a day per cluster in the operations list and the audit.
  • Pruning old operations is not built (VC-041).
  • The protection ceiling stays at_risk until a lock probe and the sub-key check exist.

Developed by @davdxpx

…-73)

A new worker task backups.catalog_refresh plans and accepts
backup.catalog.refresh as the system actor every 5 minutes for every
cluster with a repository that is neither retired nor external, one open
refresh per cluster (a per-cluster advisory lock and the open operation
are checked first), like the worker's own suspension of a target. The
kind stays low and read-only on the host, audited, and goes through the
worker's dispatch re-check. One cluster's failure never stops the others.

Supersedes the VC-038 decision that only a person or a client refreshes:
REOSA production read protection "unknown" 30 minutes after every manual
refresh and production approvals met BACKUP_REQUIRED until someone
refreshed by hand. 5 minutes, not 10, keeps the catalog inside the policy
hooks' 10-minute window.

Red on origin/main 617fcd6: "the worker has no task
backups.catalog_refresh" (apps/server/test/http-backups.int.test.ts).

Developed by @davdxpx
@davdxpx
davdxpx merged commit bfa6e51 into main Nov 9, 2026
16 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant