Public: anyone can read this; the crew can change it.
The restore drill's result keeps how long the hosted forge took to restore, in whole seconds #14189
Check · Review · Land · Live done — Landed and live in production.
The restore drill's proof of a hosted forge now records how long that forge's restore and checks took, as ms. Drills saved before this change still read. src/snapshot/drillhosted.ts: HostedProof gains an optional ms.
shipped production is serving it deploy 4adf612
The restore drill's proof of a hosted forge now records how long that forge's restore and checks took, as ms. Drills saved before this change still read.
src/snapshot/drill_hosted.ts:HostedProofgains an optionalms.proveHostedtakes a newticksclock option (it defaults toperformance.now). It reads the clock before the restore and after the lastgit fsck, and returns the difference rounded to whole milliseconds.src/snapshot/drill.ts:runDrillpasses its owntickclock asticks, so a drill run with a fake clock times the hosted forge with that clock too.src/snapshot/drills.ts:parseHostedreadsmsback only when it is a whole, non-negative safe integer. Otherwise it leavesmsout and still returns the rest of the proof. This field lives in the existing phases JSON, so there is no migration.
I stored whole milliseconds rather than the whole seconds the issue title mentions, because the issue's checklist asks for ms. The card can round to seconds when it shows the value. There is no page change; the card is the next issue.
Tests:
test/snapshot-hosted-chunks.test.ts: a new test callsproveHostedwith a fake clock that reads 1000 then 13,400.6, and expectsms: 12_401. The existing drill test that compares the whole proof now also expects an integerms.- New
test/drill-hosted-ms.test.ts: a stored row withmsreads it back. A stored row withoutmsparses with nomskey. Bad values (-1,1.5,"12",null,Number.MAX_VALUE) are dropped and the rest of the proof still reads.
Checks run: scripts/gate.ts --fix (its comment rewrap is in the commit), tsc --noEmit, and the drill, snapshot, admin-drill and MCP drill tests (165 tests across 25 files) all passed. scripts/fast.ts named 2,369 files, over its budget, so I picked those test files by hand rather than run the full suite.
🤖 Generated with Claude Code
proveHosted now times its own restore and proof and returns ms, in whole milliseconds. Drills saved before this change still read.
main had already added the same ms field in #14181, timed from outside by the drill. The merge keeps both:
src/snapshot/drill_hosted.ts:proveHostedtakes an injectable clock,ticks, which defaults toperformance.now. It reads it before the restore and after the lastgit fsck, and returns the difference rounded. Thems?: number | undefinedfield frommainstays, with one comment covering both ways it gets set.src/snapshot/drill.ts: the drill passes its own clock toproveHosted. It usesproof.ms ?? Math.round(tick() - from), so its own outside timing from #13919 now only fills in when the proof has no time, as with a stubbedprovein tests.src/snapshot/drills.ts:parseHostedreadsmsonly when it is a whole number of zero or more; otherwise it leaves it out and the rest still reads.main'sparseHostedSkippedis kept.
Tests:
test/snapshot-hosted-chunks.test.tscallsproveHostedwith a fake clock that reads 1000 then 13,400.6 and expectsms: 12_401.main's assertions on the drill's wording and the skipped hosted step are kept.test/drill-hosted-ms.test.tschecks that a stored drill withmsreads it back, and one without it still parses. Bad values (-1,1.5,"12",null,Number.MAX_VALUE) are dropped and the rest of the proof still reads.
There is no page change; the card is the next issue.
scripts/gate.ts --fix and tsc --noEmit are clean. The drill, snapshot and hosted-forge test files, including the ones main changed, pass: 168 tests in 25 files. scripts/fast.ts named 2,369 files, over its time limit, so I chose those test files by hand.
🤖 Generated with Claude Code
Meets all three boxes: proveHosted times itself on an injectable monotonic clock and returns whole ms, the drill passes its own clock through and only falls back to outside timing when a stubbed prove gives none, and parseHosted drops a missing or malformed ms and still reads the rest. No page change, no new dependency, no README edit, and the preview is unaffected. Two things I would do next: (1) test runDrill itself with a fake clock so the proof.ms ?? fallback is pinned in both directions; drill-hosted-ms.test.ts passes on main already, since parseHosted read ms there, so only the proveHosted test guards this change. (2) Put proveHosted options on one line per field, since the new multi-line type is formatted unlike its neighbours, and show the time in seconds on the card in the next issue.
The restore drill's proof of a hosted forge now records how long that forge's restore and checks took, as
ms. Drills saved before this change still read.src/snapshot/drill_hosted.ts:HostedProofgains an optionalms.proveHostedtakes a newticksclock option (it defaults toperformance.now). It reads the clock before the restore and after the lastgit fsck, and returns the difference rounded to whole milliseconds.src/snapshot/drill.ts:runDrillpasses its owntickclock asticks, so a drill run with a fake clock times the hosted forge with that clock too.src/snapshot/drills.ts:parseHostedreadsmsback only when it is a whole, non-negative safe integer. Otherwise it leavesmsout and still returns the rest of the proof. This field lives in the existing phases JSON, so there is no migration.I stored whole milliseconds rather than the whole seconds the issue title mentions, because the issue's checklist asks for
ms. The card can round to seconds when it shows the value. There is no page change; the card is the next issue.Tests:
test/snapshot-hosted-chunks.test.ts: a new test callsproveHostedwith a fake clock that reads 1000 then 13,400.6, and expectsms: 12_401. The existing drill test that compares the whole proof now also expects an integerms.test/drill-hosted-ms.test.ts: a stored row withmsreads it back. A stored row withoutmsparses with nomskey. Bad values (-1,1.5,"12",null,Number.MAX_VALUE) are dropped and the rest of the proof still reads.Checks run:
scripts/gate.ts --fix(its comment rewrap is in the commit),tsc --noEmit, and the drill, snapshot, admin-drill and MCP drill tests (165 tests across 25 files) all passed.scripts/fast.tsnamed 2,369 files, over its budget, so I picked those test files by hand rather than run the full suite.🤖 Generated with Claude Code
Closes #14184