Public: anyone can read this; the crew can change it.
test/snapshot-hosted-inside.test.ts fits its 2 s budget by building its fixture once #15152
Check · Review · Land · Live done — Landed and live in production.
test/snapshot-hosted-inside.test.ts now builds all of its hosted forges once, in beforeAll and in parallel, through a BUILD table. That covers each forge's user, its commits, and the links, swaps, views and extra files laid in its directory.
shipped production is serving it deploy af62c42
1 earlier comment · 1 event
test/snapshot-hosted-inside.test.ts now builds all of its hosted forges once, in beforeAll and in parallel, through a BUILD table. That covers each forge's user, its commits, and the links, swaps, views and extra files laid in its directory. Each test reads its own forge with forge(name) and only takes its snapshot and asserts. A test still changes only its own forge, and no other test reads it, so nothing is shared between tests. Run alone, the file takes 8.2 s instead of 15.9 s, and every test is under 1 s. The repository test that was over budget ("a repository git would run something of, that holds a link, …") takes 0.50 s, down from 2.7 s.
What to look at:
- Repository test passphrase: that test no longer passes
PASS. Wrapping the key cost about five scrypt runs of roughly 150 ms each, and the key is not what that test is about. The views, WAL and awake tests still wrap and restore a key. - Assertions: all 54 still run, and nothing is added to
SLOWinscripts/gate.ts. As a check, I removed the link laid insidestacks/linkedand the repository test failed (entry.reposwas 2, expected 1). - The other slow test: "the owner's settings pages (#9781) > a preview already seeded gets its settings rows once" is not in this file. It is in
test/preview-looks.test.ts, which this change does not touch. That one needs its own issue. - Remaining cost: most of what each test still spends is the snapshot itself. Copying the host database in a worker takes about 200 ms, and copying a hosted forge's database in a child process about 170 ms. That child process is the code under test, so it stays. The
snaphelper's comment says the copy runs "in this process", butcopyInProcessstarts a process of its own; I left that comment alone.
Checks: bun scripts/gate.ts --fix and bun x tsc --noEmit are clean. Of the 119 files bun scripts/fast.ts named, 1721 tests passed and 2 were skipped. One failed: test/schema-migrations.test.ts › "two pulls' migrations land in either order" ran 6.2 s and failed with no failed assertion, which looks like the time limit under load. It passed 26 of 26 when run alone, and this change does not reach it.
To try it: bun test test/snapshot-hosted-inside.test.ts --reporter=junit --reporter-outfile=$TMPDIR/j.xml and read each test's time in the report.
🤖 Generated with Claude Code
Reads clean: one BUILD table, forges built once in parallel in beforeAll, each test reads its own forge, no SLOW entry, no new dependency. Only a test file changed, so there is no page or terminal surface and the preview has nothing to show. Next two things: (1) open the issue for the slow settings-rows test in test/preview-looks.test.ts, which box 2 names and this pull does not touch; (2) the snap helper comment says the copy runs in this process while copyInProcess starts its own, so fix that comment while you are in the file. Dropping PASS from the stacks test is fine because the views, WAL and awake tests still wrap and restore a key.
Left #15147 open: 1 unticked item remain ('the owner's settings pages … a preview already seeded gets its settings rows once' and 'a repository git would run something of … left out by name in the manifest' each run under 1 s alone and under 2 s in the full suite).
test/snapshot-hosted-inside.test.tsnow builds all of its hosted forges once, inbeforeAlland in parallel, through aBUILDtable. That covers each forge's user, its commits, and the links, swaps, views and extra files laid in its directory. Each test reads its own forge withforge(name)and only takes its snapshot and asserts. A test still changes only its own forge, and no other test reads it, so nothing is shared between tests. Run alone, the file takes 8.2 s instead of 15.9 s, and every test is under 1 s. The repository test that was over budget ("a repository git would run something of, that holds a link, …") takes 0.50 s, down from 2.7 s.What to look at:
PASS. Wrapping the key cost about five scrypt runs of roughly 150 ms each, and the key is not what that test is about. The views, WAL and awake tests still wrap and restore a key.SLOWinscripts/gate.ts. As a check, I removed the link laid insidestacks/linkedand the repository test failed (entry.reposwas 2, expected 1).test/preview-looks.test.ts, which this change does not touch. That one needs its own issue.snaphelper's comment says the copy runs "in this process", butcopyInProcessstarts a process of its own; I left that comment alone.Checks:
bun scripts/gate.ts --fixandbun x tsc --noEmitare clean. Of the 119 filesbun scripts/fast.tsnamed, 1721 tests passed and 2 were skipped. One failed:test/schema-migrations.test.ts› "two pulls' migrations land in either order" ran 6.2 s and failed with no failed assertion, which looks like the time limit under load. It passed 26 of 26 when run alone, and this change does not reach it.To try it:
bun test test/snapshot-hosted-inside.test.ts --reporter=junit --reporter-outfile=$TMPDIR/j.xmland read each test's time in the report.🤖 Generated with Claude Code
Closes #15147