Skip to content

test(unit): split queue.test.ts and backfill.test.ts into smaller files - #4814

Merged
JSONbored merged 5 commits into
mainfrom
perf/split-oversized-test-files
Jul 11, 2026
Merged

test(unit): split queue.test.ts and backfill.test.ts into smaller files#4814
JSONbored merged 5 commits into
mainfrom
perf/split-oversized-test-files

Conversation

@JSONbored

@JSONbored JSONbored commented Jul 11, 2026

Copy link
Copy Markdown
Owner

Summary

  • test/unit/queue.test.ts (33,461 lines / 810 tests) and test/unit/backfill.test.ts (6,874 lines / 236 tests) each ran as one atomic unit under a single vitest worker. In a real CI run, queue.test.ts alone accounted for ~282s (~half the wall-clock) of the full coverage run's ~565s duration, since vitest schedules whole test files to one worker and can't parallelize within a file.
  • Split each into several files along verified-safe boundaries: no shared mutable state crosses a file boundary, and hoisted helper functions used across sections were promoted into each file's shared header (found via a TypeScript-AST structural pass, not indentation grepping, after an initial indentation-based attempt silently mis-attributed a describe block's real end line).
  • queue.test.ts -> queue.test.ts, queue-2.test.ts, queue-3.test.ts, queue-4.test.ts, queue-5.test.ts, queue-lifecycle-guards.test.ts.
  • backfill.test.ts -> backfill.test.ts, backfill-2.test.ts.
  • Fixes two stale comments in src/queue/processors.ts that named the old monolithic queue.test.ts for a test that moved.

Why

Pairs with #4815 (CI coverage sharding): splitting these two files is what lets the new matrix shards actually balance -- without it, one shard would always be stuck holding a ~5-minute file no matter how many shards exist.

Test plan

  • npx tsc --noEmit clean
  • npx vitest run on the old file(s) vs. all new split files: identical test counts and all passing (810/810 for queue*, 236/236 for backfill*)
  • Full local suite (npx vitest run --coverage) green
  • Confirmed no cross-file references were missed by grepping every hoisted helper's full usage range against the pristine originals before cutting

@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@JSONbored JSONbored self-assigned this Jul 11, 2026
@JSONbored
JSONbored force-pushed the perf/split-oversized-test-files branch 2 times, most recently from a8a829f to 508827b Compare July 11, 2026 00:38
queue.test.ts (33,461 lines / 810 tests) and backfill.test.ts (6,874 lines
/ 236 tests) each ran as one atomic unit under a single vitest worker --
queue.test.ts alone accounted for ~282s (roughly half the wall-clock) of
the full coverage run's ~565s duration, since vitest schedules whole test
files to workers and can't parallelize within one file.

Split each into several files along safe, verified boundaries (no shared
mutable state crosses a file boundary; hoisted helper functions used
across sections were promoted into each file's shared header). Test
count and pass/fail results are identical before and after (810 and 236
tests respectively, all passing) -- verified via `vitest run` on the full
old-vs-new file sets.

Also fixes two stale comments in src/queue/processors.ts that named the
old monolithic queue.test.ts file for a test that moved.
Rebasing onto main picked up #4757 (feat(review): decouple e2e-test-gen
auto-trigger and widen checkbox auth), which touched the monolithic
queue.test.ts before it was split. That content now lives in
queue-5.test.ts, so port the same test changes there: the new
autoTrigger opt-in on seedAutoTriggerPr, its three new/updated tests,
and the [BETA] badge text update. Verified against main's actual source
change (src/queue/processors.ts already carries the [BETA] label) and a
full run of all 6 split queue files: 813 tests passing (810 + 3 new).
@codecov

codecov Bot commented Jul 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.23%. Comparing base (62d91f8) to head (56ae5ab).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4814   +/-   ##
=======================================
  Coverage   94.23%   94.23%           
=======================================
  Files         442      442           
  Lines       38845    38845           
  Branches    14150    14150           
=======================================
  Hits        36607    36607           
  Misses       1577     1577           
  Partials      661      661           
Files with missing lines Coverage Δ
src/queue/processors.ts 95.67% <ø> (ø)
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@JSONbored
JSONbored merged commit fe592b8 into main Jul 11, 2026
10 checks passed
@JSONbored
JSONbored deleted the perf/split-oversized-test-files branch July 11, 2026 00:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant