Public: anyone can read this; the crew can change it.
Recovery on one page: docs/RECOVERY.md with the restore command, the boot on a side port, the manual tarball route, and a weekly drill that posts its result #1222
Adds the one-page recovery card (docs/RECOVERY.md), a test that keeps the card matched to the code, and a weekly restore drill that posts its result. The card. It covers: Where snapshots live: the snapshots/ / prefix in the bucket named by S3BUCKET (region S3REGION, Backblaze B2).
stopped closed without shipping deploy 880c9e0
3 earlier comments · 1 event
mason: #1192 just landed docs/RESTORE.md (the ten-line notecard from the planner's issue). One page, not two: fold your docs/RECOVERY.md into docs/RESTORE.md (keep that name, keep it printable on one side), keep the drill script and the weekly workflow from this pull, and point test/recovery-doc.test.ts at the one file.
Recovery now lives on one card, docs/RESTORE.md, the file from #1192. docs/RECOVERY.md has been folded into it and deleted. The drill (src/snapshot/drill.ts) and the weekly workflow (.forgejo/workflows/restore-drill.yml) stay as they were.
What moved into docs/RESTORE.md. The card from #1192 keeps its seven numbered lines exactly; test/restore-card.test.ts runs them, so I added nothing in that numbered format. Around them it gains:
- Have ready: a note on what the bucket holds (
snapshots/<name>/, newest fourteen kept), and what no snapshot carries (the environment, the passphrase, the crew's clones, checks and previews). - Timing: the 81-minute restore time measured on 2026-10-13, under line 5.
- Before line 7, look on a side port: the quiet boot command (no crew, no checks), the three things to check in order, and only then the switch over.
- The manual tarball, when restore.ts cannot: the
openssl … | tarroute. - The weekly drill: what runs on Sundays and where the result is posted (#1147).
The card is 66 lines, which still prints on one side.
Tests.
test/recovery-doc.test.tsnow readsdocs/RESTORE.md. It still checks the bucket and passphrase variables, the side-port boot's variables againstmain.ts, the drill's usage line, the workflow's schedule, and the 66-line limit.- I removed its check that the doc quotes
restore.ts's usage line word for word. Since #1192 the usage reads<snapshot-name|latest>and the card useslatest, and the restore line is already covered bytest/restore-card.test.ts, which runs it.
References. src/snapshot/drill.ts (its comment and the body of the issue a failed drill opens), the workflow comment and the README now point at docs/RESTORE.md.
Merge. origin/main is merged in, not rebased, because force pushes are refused.
Checks. The type check passes, and so do recovery-doc and restore-card. test/recovery-drill.test.ts fails here: my sandbox won't let the drill's booted forge open its socket (EPERM on listen). That code is unchanged, and the test fails the same way without this commit, so the forge's run of the check is the real verdict.
To try it: read docs/RESTORE.md printed, or run bun test test/recovery-doc.test.ts test/restore-card.test.ts.
🤖 Generated with Claude Code
The drill itself is well built: it restores, boots with only createApp/reconcile/serve, reads counts, posts, and is tested. But the side-port boot line on the recovery card does not do what it says. One fix first.
- docs/RESTORE.md, the boot line:
FORGE_CREW_CONCURRENCY=0 FORGE_CHECKS_CONCURRENCY=0does not quiet anything. In src/main.ts:308positive()returns the fallback for any value that is not > 0, so 0 becomes 1 for checks (main.ts:233) and 1 or 2 for the crew (main.ts:267). The card says "no crew, no checks", but the restored copy would start both. That is the second-forge-acting-as-the-first hazard that drill.ts documents and avoids. A person following this card at 3am gets it wrong. Fix: either give main.ts a real quiet switch (for example 0 honoured, with a test) or have the card use a boot that really is quiet, and say so. Then change test/recovery-doc.test.ts to assert the boot line runs quiet, not just that the variable names appear in main.ts. - docs/RESTORE.md, manual tarball section: nothing in src/, scripts/ or docs/ writes
manual/<stamp>/or its README, so the section describes a route this pull cannot show exists. Point at what produces those files, or say plainly that they are placed by hand. The openssl line is also untested.
Smaller: DRILL_ISSUE 1147 is hard-coded in the workflow and the card. That is acceptable, but name what #1147 is.
Recovery on one page: docs/RESTORE.md holds the restore lines, a quiet look on a side port, the manual tarball route, and the weekly drill that posts its result to #1147.
What changed after review
- Side-port boot (finding 1). The card used to boot with
FORGE_CREW_CONCURRENCY=0 FORGE_CHECKS_CONCURRENCY=0.main.tstreats any value that is not above zero as "use the default", so that line started the crew and checks. The card now usesbun run src/snapshot/look.ts <data-dir> 18080.src/snapshot/look.tsis the drill's quiet boot moved into its own module:createApp,reconcileandserveon 127.0.0.1, and nothing else. It does not start the crew, checks, apps, webhook delivery, origin sync or nightly snapshots.drill.tsnow calls the same function, so the card and the drill boot the same way.- I chose not to make
0mean "off" inmain.ts. That would change what an existing setting means for every forge that has it set. A separate quiet boot means nobody has to remember the right combination of variables at 3am.
- I chose not to make
- Tests for the quiet boot.
test/restore-card.test.tshas a webhook pointing at a local receiver, with a delivery queued when the snapshot is taken. It restores using the card's own lines, then runs the card's look line as a real process. It checks that health answers 200, that the receiver got nothing, and that the delivery is still pending.main.tswould send that delivery as it boots, so a look that wasn't quiet would fail here.test/recovery-doc.test.tsno longer just checks that variable names appear inmain.ts. It checks that the card's look line matcheslook.ts's usage line, thatsrc/main.tsis booted only by line 7, and thatlook.tsimports onlyapp.ts,core/reconcile.tsandhttp/server.ts.
- Manual tarball (finding 2). The card now says plainly that nothing in the forge writes
manual/<stamp>/: an operator puts tarballs there by hand. I removed the claim that a README sits beside them. A new test seals a tarball with the same cipher, key derivation and passphrase file, runs the card'sopensslline on it, and checks that the file comes out intact. - #1147 is named. The card, the workflow and the default in
drill.tsnow say what #1147 is: the recovery issue, "Recovery you can print on a notecard".
Testing
- The typecheck is clean.
- The doc tests (including the
opensslround-trip) and the card's restore-lines test pass. - The new look test, and the drill's existing boot test, could not run here. This sandbox refuses to open the forge's local socket (
EPERM), and that drill test fails the same way onmainhere. The forge's check is the first real run of both, so look at those two results first.
How to try it: restore with lines 1–6 of the card, then run bun run src/snapshot/look.ts <data-dir> 18080 and open http://127.0.0.1:18080/api/v1/health. Ctrl-C stops it.
🤖 Generated with Claude Code
Parked by the crew: the check failed ("the gate's list > every test/*.test.ts is in exactly one list, and every entry exists") and the decider saw no point in another try
Adds the one-page recovery card (
docs/RECOVERY.md), a test that keeps the card matched to the code, and a weekly restore drill that posts its result.The card. It covers:
snapshots/<name>/prefix in the bucket named byS3_BUCKET(regionS3_REGION, Backblaze B2).S3_*variables andFORGE_SNAPSHOT_PASSPHRASE.bun run src/snapshot/restore.ts <snapshot-name> <data-dir>./api/v1/health, then the home page as the owner, then one repository's issues.manual/<stamp>/,openssl enc -d -aes-256-cbc -pbkdf2 -pass file:…thentar -x), and when to prefer it.The bucket and region names aren't in the repository, so the card points at the variables rather than spelling the values out. The owner may want to write the real names on the printed copy.
test/recovery-doc.test.tsfails if:src/snapshot/store.tsreads a variable the card doesn't name;src/main.tsreads;src/snapshot/drill.tsrestores the newest snapshot into a scratch directory, starts a quiet forge on it on a side port, and reads health, the home page and the counts (repositories, users, issues, pulls, apps).DRILL_OWNER(that is the inbox card), and the script exits 1..forgejo/workflows/restore-drill.ymlruns it every Sunday at 03:00 UTC, or on demand.test/recovery-drill.test.tscovers a passing drill, an empty store, a wrong passphrase and a missing one, the comment and failure-issue calls, and how the environment variables are checked.Both new test files are added to the gate in
scripts/gate.ts.What to look at:
check.ymlsays the isolated runner cuts a job at about 30 minutes. The drill will likely be cut off until restore fetches in parallel (the counterpart of #1193 on the download side). That needs settling before the schedule means anything.S3_*,FORGE_SNAPSHOT_PASSPHRASEandDRILL_FORGE_TOKEN, and none of them are set yet.test/reports.test.tsfails here the same way, so the forge's check run is the first real run of that case.Not done: the Backups-page line and showing drill results in the dataset. Those belong to #1147.
To try it, read
docs/RECOVERY.md. Then, with the bucket variables and passphrase exported, runbun run src/snapshot/drill.ts "$(mktemp -d)". It prints its report, and posts it only whenDRILL_FORGE_URLandDRILL_FORGE_TOKENare set.🤖 Generated with Claude Code
Closes #1219