Skip to content

test(lint): linear-time checks alternate their two page sizes so a busy runner slows both - #8837

Merged
miguel-heygen merged 1 commit into
mainfrom
fix/lint-growth-interleaved
Nov 25, 2026
Merged

miguel-heygen merged 1 commit into
mainfrom
fix/lint-growth-interleaved

Conversation

@miguel-heygen

Copy link
Copy Markdown
Collaborator

What

The lint package's linear-time checks (growth in packages/lint/src/rules/gsap.test.ts) now time the small and the large page alternately, five times each, and compare the fastest of each. Before, they timed the small page twice, then the large page twice. A busy CI runner no longer fails a check whose code is linear.

Why

"lints script tags naming one file in linear time" failed a PR's Test (support) job today with a ratio of 8.33 against its limit of 8. That job runs the support packages' suites in parallel on one runner. When a load spike falls only on the two large-page runs, the large time inflates while the small one doesn't, and the ratio crosses the limit with no change to the code.

The code is linear. On the devbox, linting 1,250 / 2,500 / 5,000 / 10,000 / 20,000 script tags takes 62 / 119 / 240 / 530 / 1,347 ms (fastest of 5). The check's own ratio, 5,000 over 1,250 tags, ranges 4.07 to 4.72 over 15 measurements on a quiet box.

Related work

None.

How

growth builds both pages once, then runs small, large five times in turn and keeps each one's fastest time. A load spike now lands on both sizes, not just one. The limit (8, halfway between linear 4x and quadratic 16x) and both callers are unchanged.

Test plan

  • Unit tests added/updated
  • Manual testing performed
  • Documentation updated (if applicable)
  • Comments follow CONTRIBUTING.md "Comments": they say why, not what, and a bug fix says what the code must do and how to reproduce the bug

The failure depends on timing and doesn't reproduce on demand, so the proof is the spread under load. The old and new growth were measured on the same 1,250-tag page, with the run and 3 or 4 bursty busy-loop workers (50-400 ms on, 50-400 ms off) pinned to the same 2 cores:

Load Helper Max ratio Median Trials
3 workers old: 2 runs each, sequential 7.03 4.49 30
3 workers new: 5 runs each, alternating 5.15 4.53 30
4 workers old 7.66 4.83 40
4 workers new 5.83 4.52 40

The old helper reaches 7.66 under load, within reach of the 8.33 CI saw. The new one stays under 6. The median is unchanged, so a real move to quadratic work (about 16x) still fails.

gsap.test.ts 250/250; the five linear-time checks pass 3 runs in a row. oxlint, oxfmt --check, lint tsc --noEmit and the comment-share ratchet are clean.

@jrusso1020 jrusso1020 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review at 6a1b3bb3: APPROVE.

  • growth now builds both pages once and times them in turn, small then large, five times. It keeps the fastest of each and returns bestLarge / bestSmall. Under the old order (small twice, then large twice), a load spike could land only on the large runs. Alternating spreads a spike across both, and the minimum drops the slow ones. The limit stays at 8, so linear work (about 4x) still passes and quadratic work (about 16x) still fails. Both callers (growth(page, 1250) and growth(page, 250)) are unchanged.
  • Cost: 10 lint runs per check instead of 4. At the body's measured 62 ms and 240 ms for 1,250 and 5,000 tags, that is about 1.5 s, well inside the existing timeout: 120_000.
  • There is no "fails without the fix:" line. This is a test-only change for a timing flake that can't be reproduced on demand, so the body's load table stands in for one: the old helper's maximum ratio is 7.66 against the new one's 5.83 at the same median. I read that as meeting the intent of the rule, not as a gap.

Need · Size · Reuse · Simpler · Structure: stops a flaky lint check from failing CI on busy runners · +12/−11 · n/a · as simple as it can be · n/a.
Risk: very low. Test only.

— Rames

@miguel-heygen
miguel-heygen added this pull request to the merge queue Nov 25, 2026
Merged via the queue into main with commit 26b9e90 Nov 25, 2026
71 checks passed
@miguel-heygen
miguel-heygen deleted the fix/lint-growth-interleaved branch November 25, 2026 10:38
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.

2 participants