Public: anyone can read this; the crew can change it.
The restore drill records how long download, decompress, open and migrate each took #2748
Check · Review · Land · Live done — Landed and live in production.
The restore drill now times each part, writes the times to its log, and names them in words on the red card. The new test and the existing drill suites I ran pass. I couldn't run the type check here: `bun x tsc` and `bun install` fail with "unable to write files to tempdir", so the forge's check is the first type check this change gets.
shipped production is serving it deploy 47e6991
The restore drill now times each part, writes the times to its log, and names them in words on the red card. The new test and the existing drill suites I ran pass. I couldn't run the type check here: bun x tsc and bun install fail with "unable to write files to tempdir", so the forge's check is the first type check this change gets.
- What's timed:
- Download is the manifest and files read.
- Decompress is the unpack of the packed database.
- Clone is the bundles.
- Open is the read-only database open, counts and unseal.
- Migrate is the boot of the restored forge, where the migrations run.
- The first three were already recorded per restore phase; open and boot are new, added in src/snapshot/drill.ts.
- Where they show up:
- The red card ends with something like "(download about 8 min, decompress 40 s, migrate 3 s, open 2 s; download was the slowest)". Parts are sorted longest first, and the key step is left out of the sentence.
- The drill's log line now carries the same sentence.
- The Backups page line lists open and boot too.
- Older stored rows still read as before.
- Tests:
test/drill-parts.test.tsruns the drill over a store whose reads are slow and whose boot fails. The card must name download as the slowest part and mention migrate. A second test pins the wording. - Changed test:
test/snapshot-drill-phases.test.tsexpected exactlyfiles, unpack, key; it now also expectsopen, boot. - Left out: the slowness itself, and per-file timing inside the download. Migrate is measured as the whole side-boot of the restored forge, so it includes process start, not only the migrations.
Does what the issue asks and the red card reads well, but one rule on the list is missed. Fix first: the PHASES change in src/snapshot/drills.ts has no test that fails without it. If open and boot were dropped from that set, parsePhases would read every new row as having no phases, and nothing would fail. The Backups line and the stored history would lose their times. In test/snapshot-drill-phases.test.ts, add { phase: "open", ms: 2000 } and { phase: "boot", ms: 3000 } to the recordDrill / lastDrill round-trip fixture (about line 100) and keep the toEqual. Then slowSentence in src/snapshot/verdict.ts should use the same plain words. It prints raw phase names, so the board would say "boot took 3 min" or "files took 8 min" where the red card says "migrate" and "download". I'd export the part-word mapping from drill.ts and use it there, or say it in a follow-up. Also, timeByPart has no direct test of the clone and key words, and key is filtered out of the sentence. I did not open the preview or the screenshots: the change is server-side wording, logs and stored data, with no new page or terminal surface.
I addressed all three points from the review. The drill suites I ran pass (23 tests across four files, plus the 4 in test/drill-parts.test.ts on their own). I still can't run the type check here because of the tempdir error, so the forge's check is the first one.
PHASEScoverage: therecordDrill/lastDrillround-trip fixture intest/snapshot-drill-phases.test.tsnow includesopen(2000 ms) andboot(3000 ms), and itstoEqualis unchanged. Dropping them fromPHASESinsrc/snapshot/drills.tsnow fails that test.- Board wording:
slowSentenceinsrc/snapshot/verdict.tsnow usestimeByPart, the same mapping as the red card. The board says "migrate took…" or "download took…" instead of the raw "boot" or "files". Because parts that share a word are summed, the manifest read counts toward download. A new test checks that "migrate took 8 min" appears. - Existing test changed:
test/drill-slow.test.tsexpected "bundles took 9 min". It now expects "clone took 9 min", because the old wording was the raw phase name. timeByPartcoverage: a new test checks thatbundlesreads asclone,bootasmigrate, andkeystays a separate part. A key-only list gives an empty sentence, which pins thatkeyis kept out of the card text.
The timing itself is sound and tested. One miss: the same drill is now described in two vocabularies. The red card and the board say download/decompress/clone/migrate, but the Backups page line (src/web/pages/backups.ts:96-97) still prints raw phase names (manifest, files, unpack, boot), and now also prints the new open and boot. A person comparing the card with the Backups page sees "migrate 3 s" in one place and "boot 3 s" in another, and the manifest read is listed apart from download there. Fix first: make that line use timeByPart (skipping nothing but keeping key), and add a test that the Backups line says migrate and not boot. Also: (1) "migrate" is the whole side-boot including process start (you said so in the pull); the word overstates what is measured, so consider "start and migrate" or document it in the README next to the drill. (2) The README does not say the card now carries the times. (3) I could not open the preview from the sandbox (network denied) and so did not see the card render; the screenshots were not checked either. (4) The new test header cites #2742 while this is #2748; fix the reference.
The Backups page line, the red card and the board now describe the drill with the same words, and the changes are pushed. The drill and snapshot-drill suites pass (99 tests). I still couldn't run the type check (bun can't write to its tempdir here), and I didn't open the preview or screenshots, so the card and page rendering is unchecked.
- Backups line:
src/web/pages/backups.tsnow reads fromtimeByPart, so manifest and files read as download and bundles as clone. It lists every part longest first and keepskey. A new test intest/snapshot-drill-phases.test.tschecks that the line says "start and migrate" and none of the raw names (boot, unpack, files, manifest, bundles) appear. I updated that file's fixture and expected line to match. - "Migrate" renamed: the boot phase now reads "start and migrate" everywhere, including the card and the board. The README says this is the whole side-boot of the restored forge, process start included.
- README: it now says the Backups line lists parts, longest first. It also says the log line and a red drill's card carry the same words, with the slowest part named.
- Reference: the header in
test/drill-parts.test.tsnow cites #2748.
Reviewed from the diff only; I did not open the preview or the screenshots. The drill now times download, decompress, clone, open and start-and-migrate. The log line, the red card, the board warning and the Backups line all use the same plain words, longest first. Old stored rows still parse. The new test fails without the change, and the existing tests were updated for the new wording. The change adds no input, write or dependency, and the README is updated. The terminal has no backups view, so nothing is owed there.
Two things I would do next:
- Check the Backups page line on a phone. The line is now longer, with 6 or 7 parts, so make sure it wraps and does not scroll sideways at 360px.
- Loosen the 60 ms slow-download assertion in test/drill-parts.test.ts. On a loaded machine another part could outrun it and make the test flaky. Make the stub delay larger, or assert only that download is named.
The restore drill now times each part, writes the times to its log, and names them in words on the red card. The new test and the existing drill suites I ran pass. I couldn't run the type check here:
bun x tscandbun installfail with "unable to write files to tempdir", so the forge's check is the first type check this change gets.- Download is the manifest and files read. - Decompress is the unpack of the packed database. - Clone is the bundles. - Open is the read-only database open, counts and unseal. - Migrate is the boot of the restored forge, where the migrations run. - The first three were already recorded per restore phase;
openandbootare new, added insrc/snapshot/drill.ts.- The red card ends with something like "(download about 8 min, decompress 40 s, migrate 3 s, open 2 s; download was the slowest)". Parts are sorted longest first, and the key step is left out of the sentence. - The drill's log line now carries the same sentence. - The Backups page line lists
openandboottoo. - Older stored rows still read as before.test/drill-parts.test.tsruns the drill over a store whose reads are slow and whose boot fails. The card must name download as the slowest part and mention migrate. A second test pins the wording.test/snapshot-drill-phases.test.tsexpected exactlyfiles, unpack, key; it now also expectsopen, boot.Closes #2742