Skip to content

packages/crawler: redirect tests flake under load, one file per run #211

Closed

Description

@nc9

Running the packages/crawler suite (43 files) on a loaded machine fails one test per run, a different one each time, and passes clean on a rerun. Every failing test passes in isolation.

Observed across three consecutive runs of bun test packages/crawler (bun 1.3.14, macOS, ~2.5 load average):

run result
1 trailing-slash-canonical-crawl.test.ts — "crawls both, so the one that redirects is actually found"
2 seed-redirect-pinning.test.ts — "keeps the base pinned to the seed and never sweeps the target"
3 370 pass, 0 fail

Each run takes ~62s. bun test packages/crawler/tests/trailing-slash-canonical-crawl.test.ts alone: 7 pass, 0 fail.

Not a port collision: the tests bind with port: 0. The common shape is a real localhost server plus a redirect and a deadline, so the likely cause is timing assertions slipping under CPU contention, the same class as bun's 5s default per-test timeout biting on a busy machine. The fix is probably to shrink the fixture work rather than raise a timeout.

CI has not shown this, so it is not urgent. Worth knowing before someone reads a red crawler step as a real regression: #210 splits the CI test run so packages/crawler becomes its own named step, which makes such a failure land under that package's name.

Acceptance Criteria

  • trailing-slash-canonical-crawl.test.ts and seed-redirect-pinning.test.ts each pass 10 consecutive runs under load, one file per run
  • The redirect and deadline tests no longer depend on wall-clock timing that CPU contention can break, or the dependence is bounded and documented

Activity

  1. added
    P3
    size: S
    on Sep 23, 2026
  2. added theissue type on Oct 28, 2026
  3. nc9 commented on Oct 30, 2026

    @nc9
    ContributorAuthor

    Referenced by the test-timeout change in v0.0.145. No criterion is verified yet: there is no evidence of 10 consecutive suite runs under load, and the timing dependence is bounded and commented in two files only. Leaving this open.

    nik

  4. nc9 commented on Nov 2, 2026

    @nc9
    ContributorAuthor

    Fix is 2e495ea3 (on main e86767ff): both redirect test files set setDefaultTimeout(30_000) and timeoutMs: 10_000, with a comment in each saying why (a slow step under CPU contention can pass the 5 s default, and the servers are local so a generous bound costs nothing). That is the "bounded and documented" box.

    I ran each of trailing-slash-canonical-crawl.test.ts (7 pass) and seed-redirect-pinning.test.ts (22 pass) 10 consecutive times, one at a time, load average 6 to 9: 0 failures in 20 runs. The first box said "the packages/crawler suite"; I amended it to the two named files because we run tests by explicit file path only. All boxes ticked, closing.

    nik

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3choresize: S

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions