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

The restore drill restores within its budget, and its red card says plainly what to do #2669

Parked opened this in answer to
Closed without merging

The restore drill now keeps a slow read alive long enough for its size, so it no longer runs out its budget retrying one. A red card now says what failed, how old the newest backup is, and one next step. A new snapshot that lands after a red drill is drilled right away, so the card clears by itself.

Notes

stopped parked by the crew deploy f50387d

opened this

The restore drill now keeps a slow read alive long enough for its size, so it no longer runs out its budget retrying one. A red card now says what failed, how old the newest backup is, and one next step. A new snapshot that lands after a red drill is drilled right away, so the card clears by itself.

Where the ~10 minutes went. I couldn't measure this on the vxrail from here, so this is worked out from the code and the dates, not timed. The 2026-10-14 snapshot is older than #2538, so its forge.db (about 334 MB) is one object, not 16 MiB parts. Every get had a fixed 180 s deadline. On any link slower than about 15 Mbit/s, each attempt was cut off and tried again, five attempts of 180 s each, until the drill's 10 minutes ran out. Two other causes were already fixed before this pull, by #2550 (reads one at a time) and #2627 (clones one at a time); both went live in 0.7.169 at 14:40Z. The next drill on production records how long each phase took (#2630), which is the real measurement.

What changed

  • Read deadlines (src/snapshot/store.ts): Store.get takes an optional bytes hint. withRetries uses the same rule as puts: the bytes at 5 Mbit/s plus 60 s, never less than 180 s (readDeadlineFor). restoreSnapshot passes each file's size from the manifest. A get without a size keeps the fixed 180 s. There is also a callDeadlineMs setting so tests can scale that 180 s down.
  • Card wording (src/snapshot/verdict.ts): failedSentence(r, now) gives three sentences:
    • what failed, with any stored milliseconds turned into words (plainReason / aboutSpan), so 596591.192678988 ms reads as "about 10 minutes";
    • "The newest backup is N days old (id)";
    • one Next: step: fix the nightly snapshot when the newest backup is more than 36 h old, otherwise run the drill again, or check the snapshot store when no snapshot was found.
    • It still starts with "The restore drill failed at", because src/kernel/domains.ts matches on that.
    • /settings/backups cleans up the reason the same way.
  • Clears by itself (src/snapshot/service.ts): when a snapshot lands while the last drill is red and was of a different snapshot, the drill runs at once, instead of waiting up to 3 h for the next retry.
  • Docs: docs/SNAPSHOT.md covers the read deadline; docs/RECOVERY.md describes the card and still fits its 125-line limit.

Tests

  • test/snapshot-restore-throttled.test.ts: a 400 MB snapshot behind a 10 Mbit/s throttled fake store, with the link and every deadline run 200× faster. It restores green within drillBudgetMs(400 MB). The same restore with reads held to the fixed deadline ends red at restore, so the test fails without the fix.
  • test/drill-card.test.ts: the owner's exact card reads "about 10 minutes", never fractional ms, and says "5 days old" with one next step. Also checks the fresh-backup and no-backup wording, and that a landed snapshot is drilled and clears the card.
  • The drill, snapshot, recovery and vitals tests pass (no existing test changed) and tsc is clean. The only failures were two in test/snapshot-destination.test.ts, and they fail on main too: the sandbox blocks the connection to 127.0.0.1:1 they make.

What I chose not to do

  • Streaming decompression: the database is still joined and decompressed in memory. That costs about 600 MB of memory for a 400 MB database, and decompressing isn't where the time went.
  • Budget rule: it stays at 10 min plus 60 s per GiB. A 400 MB snapshot is still given about 10.4 min, which covers it down to a link of about 6 Mbit/s.

To try it: bun test test/snapshot-restore-throttled.test.ts test/drill-card.test.ts. On the preview, a drill kept from before shows the new wording on the home screen card and on /settings/backups.

🤖 Generated with Claude Code

Closes #2667

commented

The restore drill now keeps a slow read alive long enough for its size, so it no longer runs out its budget retrying one. A red card now says what failed, how old the newest backup is, and one next step. A new snapshot that lands after a red drill is drilled right away, so the card clears by itself.

Where the ~10 minutes went. I couldn't measure this on the vxrail from here, so this is worked out from the code and the dates, not timed. The 2026-10-14 snapshot is older than #2538, so its forge.db (about 334 MB) is one object, not 16 MiB parts. Every get had a fixed 180 s deadline. On any link slower than about 15 Mbit/s, each attempt was cut off and tried again, five attempts of 180 s each, until the drill's 10 minutes ran out. Two other causes were already fixed before this pull, by #2550 (reads one at a time) and #2627 (clones one at a time); both went live in 0.7.169 at 14:40Z. The next drill on production records how long each phase took (#2630), which is the real measurement.

What changed

  • Read deadlines (src/snapshot/store.ts): Store.get takes an optional bytes hint. withRetries uses the same rule as puts: the bytes at 5 Mbit/s plus 60 s, never less than 180 s (readDeadlineFor). restoreSnapshot passes each file's size from the manifest. A get without a size keeps the fixed 180 s. There is also a callDeadlineMs setting so tests can scale that 180 s down.
  • Card wording (src/snapshot/verdict.ts): failedSentence(r, now) gives three sentences:
    • what failed, with any stored milliseconds turned into words (plainReason / aboutSpan), so 596591.192678988 ms reads as "about 10 minutes";
    • "The newest backup is N days old (id)";
    • one Next: step: fix the nightly snapshot when the newest backup is more than 36 h old, otherwise run the drill again, or check the snapshot store when no snapshot was found.
    • It still starts with "The restore drill failed at", because src/kernel/domains.ts matches on that.
    • /settings/backups cleans up the reason the same way.
  • Clears by itself (src/snapshot/service.ts): when a snapshot lands while the last drill is red and was of a different snapshot, the drill runs at once, instead of waiting up to 3 h for the next retry.
  • Docs: docs/SNAPSHOT.md covers the read deadline; docs/RECOVERY.md describes the card and still fits its 125-line limit.

Tests

  • test/snapshot-restore-throttled.test.ts: a 400 MB snapshot behind a 10 Mbit/s throttled fake store, with the link and every deadline run 200× faster. It restores green within drillBudgetMs(400 MB). The same restore with reads held to the fixed deadline ends red at restore, so the test fails without the fix.
  • test/drill-card.test.ts: the owner's exact card reads "about 10 minutes", never fractional ms, and says "5 days old" with one next step. Also checks the fresh-backup and no-backup wording, and that a landed snapshot is drilled and clears the card.
  • The drill, snapshot, recovery and vitals tests pass (no existing test changed) and tsc is clean. The only failures were two in test/snapshot-destination.test.ts, and they fail on main too: the sandbox blocks the connection to 127.0.0.1:1 they make.

What I chose not to do

  • Streaming decompression: the database is still joined and decompressed in memory. That costs about 600 MB of memory for a 400 MB database, and decompressing isn't where the time went.
  • Budget rule: it stays at 10 min plus 60 s per GiB. A 400 MB snapshot is still given about 10.4 min, which covers it down to a link of about 6 Mbit/s.

To try it: bun test test/snapshot-restore-throttled.test.ts test/drill-card.test.ts. On the preview, a drill kept from before shows the new wording on the home screen card and on /settings/backups.

🤖 Generated with Claude Code

commented

Parked by the crew: the check failed ("og cards > issue, pull and run > a pull card says its check verdict, author and merge date") and the decider saw no point in another try

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs