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

The restore drill records how long each part took — download, decompress, open, migrate — and its budget follows the snapshot's size #2730

Parked opened this
Closed without merging

The restore drill now records how long each part took, and its card names the slowest. Type check is clean. The snapshot, drill, recovery and card tests pass, but two snapshot-destination tests fail here because the sandbox blocks the network.

Notes

stopped parked by the crew deploy 4c6373c

opened this

The restore drill now records how long each part took, and its card names the slowest. Type check is clean. The snapshot, drill, recovery and card tests pass, but two snapshot-destination tests fail here because the sandbox blocks the network. They fail the same way with my changes stashed. The forge's own check will run the rest.

What changed

  • Phases: the restore phases are renamed files→download and unpack→decompress. The drill adds open (the database read, counts and unseal) and migrate (the restored forge booting until it answers health). Stored drills that used the old names still read.
  • Card: the drill card's detail reads "6 min 12 s of its 14 min budget: download 8 min, decompress 40 s, …; slowest: download".
  • Streaming: database parts now go through a streaming zstd decompressor (unpacker in parts.ts) as they land, so decompression overlaps the download and the compressed file is never joined in memory. The file only appears under its own name once its sizes check out. decompress therefore times only what is left after the download ends.
  • Budget: the drill's budget already grew with the snapshot (10 min + 60 s per GiB, capped at 45 min), so I left that formula alone. New: Store.bounded(budgetMs) and callDeadlineMs size each get's deadline so attempts × deadline + backoff waits never exceed the budget. The drill uses bounded for both listing and the restore.
  • Docs: docs/RECOVERY.md has entries for the renamed phases and for open and migrate.
  • Existing tests: I edited phase names in drill-slow, snapshot-drill-phases and snapshot-restore-progress. The old names were what changed, not the behaviour.
  • New tests: test/snapshot-drill-parts.test.ts covers four things.
    • A 400 MB snapshot through a throttled store restores inside its budget and its card names the slowest part.
    • Parts fed out of order unpack correctly.
    • A short part is refused and leaves no file.
    • The deadline arithmetic holds, and a bounded get gives up inside the budget.

Left out

  • Store.get still returns a whole part, 16 MiB at most, so this streams part by part rather than byte by byte. Streaming inside a part would mean changing the store interface.
  • The 400 MB test uses a zero-padded database so it runs in about a second. It exercises the budget and the timings, not real throughput.

Try it: run bun test test/snapshot-drill-parts.test.ts, or run a drill from Settings → Backups and read the timing line.

🤖 Generated with Claude Code

Closes #2719

commented

The restore drill now records how long each part took, and its card names the slowest. Type check is clean. The snapshot, drill, recovery and card tests pass, but two snapshot-destination tests fail here because the sandbox blocks the network. They fail the same way with my changes stashed. The forge's own check will run the rest.

What changed

  • Phases: the restore phases are renamed files→download and unpack→decompress. The drill adds open (the database read, counts and unseal) and migrate (the restored forge booting until it answers health). Stored drills that used the old names still read.
  • Card: the drill card's detail reads "6 min 12 s of its 14 min budget: download 8 min, decompress 40 s, …; slowest: download".
  • Streaming: database parts now go through a streaming zstd decompressor (unpacker in parts.ts) as they land, so decompression overlaps the download and the compressed file is never joined in memory. The file only appears under its own name once its sizes check out. decompress therefore times only what is left after the download ends.
  • Budget: the drill's budget already grew with the snapshot (10 min + 60 s per GiB, capped at 45 min), so I left that formula alone. New: Store.bounded(budgetMs) and callDeadlineMs size each get's deadline so attempts × deadline + backoff waits never exceed the budget. The drill uses bounded for both listing and the restore.
  • Docs: docs/RECOVERY.md has entries for the renamed phases and for open and migrate.
  • Existing tests: I edited phase names in drill-slow, snapshot-drill-phases and snapshot-restore-progress. The old names were what changed, not the behaviour.
  • New tests: test/snapshot-drill-parts.test.ts covers four things.
    • A 400 MB snapshot through a throttled store restores inside its budget and its card names the slowest part.
    • Parts fed out of order unpack correctly.
    • A short part is refused and leaves no file.
    • The deadline arithmetic holds, and a bounded get gives up inside the budget.

Left out

  • Store.get still returns a whole part, 16 MiB at most, so this streams part by part rather than byte by byte. Streaming inside a part would mean changing the store interface.
  • The 400 MB test uses a zero-padded database so it runs in about a second. It exercises the budget and the timings, not real throughput.

Try it: run bun test test/snapshot-drill-parts.test.ts, or run a drill from Settings → Backups and read the timing line.

🤖 Generated with Claude Code

commented

Parked by the crew: the check failed ("(unnamed)") and the decider saw no point in another try

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs