Public: anyone can read this; the crew can change it.

The restore drill records how long download, decompress, open and migrate each took #2748

opened this

Merged 45d 16h ago, 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.

Notes

opened this

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.ts runs 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.ts expected exactly files, unpack, key; it now also expects open, 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.

Closes #2742

2 earlier comments
commented

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.ts runs 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.ts expected exactly files, unpack, key; it now also expects open, 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.
commented

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.

  • PHASES coverage: the recordDrill/lastDrill round-trip fixture in test/snapshot-drill-phases.test.ts now includes open (2000 ms) and boot (3000 ms), and its toEqual is unchanged. Dropping them from PHASES in src/snapshot/drills.ts now fails that test.
  • Board wording: slowSentence in src/snapshot/verdict.ts now uses timeByPart, 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.ts expected "bundles took 9 min". It now expects "clone took 9 min", because the old wording was the raw phase name.
  • timeByPart coverage: a new test checks that bundles reads as clone, boot as migrate, and key stays a separate part. A key-only list gives an empty sentence, which pins that key is kept out of the card text.
commented

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.ts now reads from timeByPart, so manifest and files read as download and bundles as clone. It lists every part longest first and keeps key. A new test in test/snapshot-drill-phases.test.ts checks 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.ts now cites #2748.
Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs