vps-health-api/__tests__
le king fu 1b619249e2
All checks were successful
CI / verification (pull_request) Successful in 36s
feat(backups): GET /backups and POST /backups/pull
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
..
fixtures/claude-usage feat(agent): add the claude-usage agent: plan limits, local cache, push 2026-10-04 15:26:15 -04:00
agent-claude-usage.test.js feat(agent): one-shot backfill of the Claude usage history from local transcripts 2026-10-08 20:44:45 -04:00
agent-pg-backup-pull.test.js fix(agent): nothing the VPS sends deletes or alters a pulled backup 2026-10-10 19:13:27 -04:00
agent.test.js feat(agent): push workstation metrics to /hosts/<id> from cron 2026-08-16 12:21:59 -04:00
auth.test.js feat(backups): GET /backups and POST /backups/pull 2026-10-10 19:43:07 -04:00
backups.test.js feat(backups): GET /backups and POST /backups/pull 2026-10-10 19:43:07 -04:00
ci.test.js feat(backups): GET /backups and POST /backups/pull 2026-10-10 19:43:07 -04:00
claude-usage-history.test.js fix(server): archive by latest date, never a day past reception 2026-10-08 21:34:54 -04:00
claude-usage.test.js feat(backups): GET /backups and POST /backups/pull 2026-10-10 19:43:07 -04:00
findings.test.js feat(defenseurs): add GET /defenseurs/findings?project=X route 2026-05-12 20:56:56 -04:00
health.test.js refactor: extract CPU/RAM/disk collection into metrics.js 2026-08-16 11:30:03 -04:00
hosts.test.js fix(server): require a full ISO receivedAt on read, cover the temp-file cleanup 2026-10-07 20:25:26 -04:00
state.test.js feat(defenseurs): serve the Sergent's findings state at GET /defenseurs/state 2026-09-24 20:42:20 -04:00
writes.test.js feat(backups): GET /backups and POST /backups/pull 2026-10-10 19:43:07 -04:00