Hosted forges in the nightly backup

Each forge this one hosts goes into the nightly snapshot (#13819), under children/<name>/.

WhatWhere in the snapshot
Database (a consistent copy, taken while it runs)forge.db
Repositories, every ref but refs/upstream/* (what a forge only mirrors from its parent, fetched again every hour it is awake: with those in, an awake fork went up whole every night)repos/<owner>/<name>.bundle
SSH host keysssh/
Its key, wrapped under FORGE_SNAPSHOT_PASSPHRASEsecret.key.wrapped (without a passphrase the key stays home)
Every app's production dataalongside
This forge's own record of itledger.json
Its history: run logs, drop, cost ledger, parent.json, plan.jsonruns/, drop/, ledger/, alongside
What the host holds of it: credit and spend, the own-code switchparent/credit.json, parent/own-code.json; --forge puts them back under <data>/credit and <data>/own-code

parent/credit.json holds the forge's tokenHash; it is backed up like everything else and is covered by the same encryption: a snapshot kept on a sealed lane is sealed chunk by chunk, this file with the rest. Files are opened without following a link and only if regular; a link, a pipe, a file that changed while it was copied, or history past the 512 MiB cap on runs/, drop/ and ledger/ together is left out and named in the manifest's omitted list (first 100, omittedTotal counts all). A restore refuses a parent/ entry it has no place for.

Chunks are shared with the rest of the snapshot, so a forge unchanged since last night sends nothing. A forge that cannot be read is named in the manifest's hosted list and the log; the snapshot goes on without it.

Read from inside the forge's directory only

A hosted forge's directory is the forge's own to write, and its host reads it for the snapshot from outside the forge's cell (copyHosted, src/snapshot/hosted.ts). So the copy stays inside it:

Where it shows

The drill restores one

Each restore drill, after the host itself, restores one hosted forge alone from the same snapshot (the next one each day and each week, src/snapshot/drill_hosted.ts) and proves it opens: its ledger reads and names it, its database passes SQLite's integrity check, and every repository its copy holds comes back and passes git fsck. The verdict says which forge ("…passed, with hosted forge glint (1 of 17)"). One that does not come back fails the drill at the step forge, by name (RECOVERY.md).

Restore one forge

Into an empty data directory; children/<bodyId>/ and spawn/<name>.json are written there:

bun run src/snapshot/restore.ts latest <data-dir> --forge <name>

A whole restore of the parent leaves children/ out; restore each forge this way.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs