Commit graph

2 commits

Author SHA1 Message Date
le king fu
329d83e4e5 feat(backups): pass the files[] block of status.json through GET /backups
All checks were successful
CI / verification (pull_request) Successful in 35s
backup-postgres.sh now writes files[], one entry per archived host
directory (la-compagnie-maximus#295). sanitizeBackupsStatus() dropped
it as an unknown field, so a failed archive turned the status red with
no cause. It is now rebuilt from a whitelist like databases[], with a
closed code list of its own (source_missing, archive_failed,
encrypt_failed, invalid_name), the script's name pattern with a 63 cap,
a nullable archivedAt and a bound of 16. A status without files keeps
working.

Refs #61

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 20:04:12 -04:00
le king fu
1b619249e2 feat(backups): GET /backups and POST /backups/pull
All checks were successful
CI / verification (pull_request) Successful in 36s
Track the PostgreSQL cluster backups (la-compagnie-maximus#220) the same
way as /claude-usage: freshness is decided by the server.

- GET /backups (read token) serves { vps, lenovo }: the status.json the
  VPS script writes, rebuilt through a whitelist (closed error codes,
  rotation block included), and the last workstation pull report. Each
  block gets ageSeconds, stale and staleAfterSeconds from the server
  (BACKUPS_STALE_SECONDS, 36 h): VPS on generatedAt, workstation on the
  server-stamped receivedAt. A broken file gives a null block plus
  vpsError/lenovoError, never a 500; no_data only when both are absent.
- POST /backups/pull: fourth token kind, backups-ingest, on
  BACKUPS_INGEST_TOKEN (503 naming it when unset). Strict validation of
  { pulledAt, files, ok, error? }, server receivedAt, atomic write in
  mode 600 through writeJsonAtomic(), now shared with /claude-usage.
  Answers 204 and 413 like the two other ingest routes (the agent only
  checks for a 2xx), where the issue said 200 and 400.
- backups.js joins the Dockerfile COPY line. Tests: backups.test.js
  (101 cases), auth/writes pins extended, 6 socket cases in test-curl.sh.

Refs #58

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-10 19:43:07 -04:00