From 39c10cb552d519cb44fd518312e2c8d2c3ccc94d Mon Sep 17 00:00:00 2001 From: Tyler <53561637+im-tyler@users.noreply.github.com> Date: Sun, 4 Oct 2026 02:26:19 -0700 Subject: [PATCH 1/2] feat(s19): snapshot producer, restore-check, live doctor probes, bundle folding Productizes the practiced procedure in scripts/ship-backup.sh where that is safe, keeping its invariants load-bearing in the CLI too: - teploy-ship snapshot: same archive shape as the script (tar of the nucleus data dir + sha256 sidecar + manifest); refuses while ship-* containers run unless the operator attests the coordinated stop (--i-stopped-writers); never overwrites; never deletes anything except its own partial output after a failed production so a failed tar cannot wedge the label+date slot. - teploy-ship restore-check: verifies an archive WITHOUT unpacking (sidecar in sha256sum -c form, full-stream gzip integrity, content listing failing on absolute/.. paths); verdict is integrity-only and names the rehearsal as the restore proof. The unpack and rehearse stay in the script. - doctor: store liveness (SELECT 1) and clock skew against the store's own clock (SELECT now()) probed read-only when NUCLEUS_URL is set; unknown otherwise or when the engine answers no time query; store consistency deliberately not probed (read-only while writers may run). - support bundle (scriptVersion 2): doctor.json + the latest backup manifest (the receipt, never the archive), both degrading to note files. Tests: 11 snapshot/restore-check tests incl. negative controls (running-writer refusal with the exact stop line, overwrite refusal, tampered sidecar, truncated archive with re-computed checksum caught by gzip, path-escape listing, failed-production cleanup), 4 live-probe doctor tests against a fake store client, 2 bundle folding tests. Fake fixtures only; no live systems. No upstream defects found; nothing to report upstream. --- AUDIT_OPEN.md | 9 +- CHANGELOG.md | 23 ++ docs/BACKUP.md | 32 ++ docs/SHIP_RELEASE_PROGRAMME_2026-09-21.md | 2 +- docs/SUPPORT.md | 22 +- src/args.ts | 2 + src/cli.ts | 118 +++++- src/install-doctor.test.ts | 70 +++- src/install-doctor.ts | 70 +++- src/snapshot.test.ts | 332 ++++++++++++++++ src/snapshot.ts | 462 ++++++++++++++++++++++ src/support.test.ts | 53 ++- src/support.ts | 44 ++- 13 files changed, 1218 insertions(+), 21 deletions(-) create mode 100644 src/snapshot.test.ts create mode 100644 src/snapshot.ts diff --git a/AUDIT_OPEN.md b/AUDIT_OPEN.md index f4e83fe5..a0d9b98b 100644 --- a/AUDIT_OPEN.md +++ b/AUDIT_OPEN.md @@ -44,8 +44,13 @@ All off by default or observe-only; flags are in the programme's wave-4 table. - **S15/S17 (PR #46):** inert; callers must redact log excerpts. - **S22 (PR #47):** the coordination record does not keep the revision the client was planned against. -- **S19 (PR #49):** doctor's store and clock checks report unknown until real - probes exist; the restore comparison has no snapshot producer. +- **S19 (PR #49; tail landed 2026-10-04):** doctor now answers store liveness + and clock skew read-only when `NUCLEUS_URL` is set (unknown otherwise, and + unknown when the engine answers no time query — honest, not a gap to paper + over); `teploy-ship snapshot` / `restore-check` exist with the script's + invariants. Still open: the unpack and rehearsal remain script-only by + design; restore-readiness has no command; none of the S19 tail has run + against a live store. - **S07 (PR #53):** unwired; wiring must not add a durable step to existing runs. - **Agent hygiene:** parallel agents share one scratch directory and the fixed grading port 8901. A backup-file collision corrupted one agent's mutation diff --git a/CHANGELOG.md b/CHANGELOG.md index 71bcc9ac..64c85b90 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,29 @@ All notable changes to Teploy Ship are recorded here. ## [Unreleased] ### Added +- **S19 tail: `teploy-ship snapshot` and `teploy-ship restore-check`, live + doctor probes, and doctor + backup receipt in the support bundle.** The + practiced procedure in `scripts/ship-backup.sh` is now productized where + that is safe: `snapshot` produces the identical archive shape (tar of the + nucleus data dir + sha256 sidecar + manifest under + `$SHIP_BACKUP_DIR/