Skip to content

test: pace the early-boot pack test so a slow runner has two seconds, not half of one - #76

Merged
alekswebnet merged 1 commit into
mainfrom
fix/pack-test-pacing
Oct 23, 2026
Merged

alekswebnet merged 1 commit into
mainfrom
fix/pack-test-pacing

Conversation

@alekswebnet

Copy link
Copy Markdown
Contributor

Closes #75.

pack.test.ts > "attaches the parts while a download from a host without Range is under way" now paces its archive at 32 kB/s instead of 128 kB/s.

Why it failed

  • How the bytes arrive: the dev server sends the archive 64 kB at a time, one slice per interval (sendThrottled). The download first publishes its forward index at 256 kB (FIRST_FLUSH_SIZE in the chunk writer).
  • The window: for this 265 kB archive, the frame may boot from the fourth slice on, and the fifth slice ends the download. So the test has one slice's interval to plan, fetch and attach the pack's parts and boot: 0.5 s at 128 kB/s.
  • How close it was: passing Firefox runs reached ready at 1.66 to 1.93 s, using 0.16 to 0.43 s of that window. On main after ci: install Chromium and Firefox without their system packages #74, a runner needed more, and the load went through indexing as a whole download does. That load's late path took about 0.9 s after the download ended.

The change

At 32 kB/s the interval is 2 s, four times what it was and twice what that slow runner needed.

  • Cost: the test takes about 6 s instead of 2.
  • If the early boot breaks: the test still fails on its assertion at about 8.5 s, well inside the browser suite's 15 s timeout.

The comment in the test now explains where the window comes from, instead of saying the library folder "arrives seconds before its media". The library folder is in the first 3 kB.

libraries.test.ts paces the same fixture at the same rate, but its assertions hold whichever path wins, so it is unchanged.

Testing

Run locally, the whole of pack.test.ts: 15 of 15 pass in Chromium and in Firefox. This test took 6.1 s in each.

🤖 Generated with Claude Code

…two seconds

The dev server sends 64 kB at a time, and the download first publishes
its forward index at 256 kB. The frame may boot from the fourth slice,
and the download ends with the fifth, so the test had one slice's
interval to plan, fetch and attach the pack's parts: half a second at
128 kB/s. Passing runs used 0.16 to 0.43 s of it, and a Firefox runner on
main used more, so the load went through `indexing`. At 32 kB/s the
interval is two seconds, and the test takes about six instead of two.

Closes #75

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pack.test.ts: the early-boot test wins its race by a third of a second, and lost it on main in Firefox

1 participant