Skip to content

test(hotkeys): Stop invariant tests from timing out on CI - #298

Merged
KevinVandy merged 2 commits into
mainfrom
fix/invariant-test-timeouts
Nov 25, 2026
Merged

KevinVandy merged 2 commits into
mainfrom
fix/invariant-test-timeouts

Conversation

@KevinVandy

@KevinVandy KevinVandy commented Nov 25, 2026 •

Copy link
Copy Markdown
Member

🎯 Changes

The Release workflow on main fails in @tanstack/hotkeys:test:lib. Invariant tests time out (run); no assertion fails.

  • The matching, layouts, and recorder-match invariants created a vi.fn() for each of thousands of registrations. Vitest holds every called mock and its call arguments (the dispatched events) until the test returns. matching.test.ts peaked at 2.2 GB of heap in one worker, and with a 384 MB heap cap its worker crashes out of memory.
  • These loops now count calls with a plain counter. The assertions check the same counts at the same points. Peak heap drops from 2.2 GB to 250 MB for matching, from 1.1 GB to 565 MB for layouts, and from 380 MB to 164 MB for recorder-match. matching runs in 6.6 s instead of 11.4 s.
  • The layouts recorded chord sweep gets the same explicit 30 s timeout as its neighbour. It takes about 0.2 s locally but went past the 5 s default on both failing Release runs.
  • .intent/review-state.json records the three test files as out of scope for skills.

Notes

PR CI runs only the affected test:lib, not the full uncached test:ci that Release runs, so the first Release run after merge is the real check.

✅ Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested code changes locally with pnpm run test:pr, or these tests do not apply to this pull request.
  • I fully understand the code in this pull request, including any code generated with AI assistance.

🚀 Release Impact

  • This change affects published code, and I have generated a changeset.
  • This change is docs/CI/dev-only (no release).

Summary by CodeRabbit

  • Tests
    • Updated hotkey test checks to track callback execution and verify each registered hotkey fires once.
    • Adjusted timing expectations and added a timeout to reduce sensitivity to slow test environments.
    • No changes to public APIs or runtime behavior. These updates affect test coverage and execution only; they do not change the app’s behavior for end users.

The matching, layouts, and recorder-match invariants created a vi.fn()
for each of thousands of registrations. Vitest holds every called mock
and its call arguments until the test returns, so matching.test.ts
peaked at 2.2 GB of heap in one worker and ran out of memory under a
384 MB cap. On a loaded Release runner the tests went past their
timeouts.

Count calls with a plain counter instead, and give the layouts
recorded-chord sweep the same 30 s timeout as its neighbours.
@KevinVandy
KevinVandy marked this pull request as draft November 25, 2026 03:46
@changeset-bot

changeset-bot Bot commented Nov 25, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 240126e

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai

coderabbitai Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The hotkey invariant tests replace Vitest mock call tracking with numeric counters. One recorded-chord test now has a 30-second timeout, and a timing comment and related review-state records are updated.

Changes: Hotkey Test Updates

Layer / File(s) Summary
Counter-based test tracking
packages/hotkeys/tests/invariants/*.test.ts, .intent/review-state.json
The tests use numeric counters to track callback calls instead of Vitest mock call history. The recorded-chord test has a 30-second timeout, and a timing comment is updated. The related review-state records have updated snapshots, fingerprints, heads, outcomes, and reasons.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Other

Suggested reviewers: schiller-manuel, alemtuzlak

Merge Risk: Minimal · up to 24012

This change only adjusts invariant tests to avoid CI timeouts and memory exhaustion. It does not touch runtime behavior, and the main remaining check is the first Release run after merge.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: invariant tests in @tanstack/hotkeys are changed to stop timing out on CI. The diff replaces vi.fn() callback tracking with plain counters in the matching, layouts, an…
Description check Passed The description follows the template. It has a Changes section that explains the motivation (Release workflow OOM and timeouts) and the concrete change. It includes the checklist and the release-impac…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: invariant tests in @tanstack/hotkeys are changed to stop timing out on CI. The diff replaces vi.fn() callback tracking with plain counters in the matching, layouts, and recorder-match invariant tests, and adds a 30 s timeout to the layouts recorded chord sweep. The title follows the conventional type(scope) format and is specific enough for a scanning teammate.

Full details: Description check

Explanation

The description follows the template. It has a Changes section that explains the motivation (Release workflow OOM and timeouts) and the concrete change. It includes the checklist and the release-impact section. The checklist marks the AI-assistance item as unchecked, and the release impact choice is marked as docs/CI/dev-only. Those are author decisions, not structural gaps.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

A rabbit counts each tap and beat
No mock-call list beneath its feet
One chord gets thirty seconds more
Three test records match the score
The keys go click, the counters grow
Then off the rabbit hops in snow

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 97d4147 and 240126e.

Files selected for processing: 4

  • .intent/review-state.json
  • packages/hotkeys/tests/invariants/layouts.test.ts
  • packages/hotkeys/tests/invariants/matching.test.ts
  • packages/hotkeys/tests/invariants/recorder-match.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

@pkg-pr-new

pkg-pr-new Bot commented Nov 25, 2026

Copy link
Copy Markdown

Open in StackBlitz

@tanstack/alpine-hotkeys

npm i https://pkg.pr.new/@tanstack/alpine-hotkeys@298

@tanstack/angular-hotkeys

npm i https://pkg.pr.new/@tanstack/angular-hotkeys@298

@tanstack/angular-hotkeys-devtools

npm i https://pkg.pr.new/@tanstack/angular-hotkeys-devtools@298

@tanstack/ember-hotkeys

npm i https://pkg.pr.new/@tanstack/ember-hotkeys@298

@tanstack/hotkeys

npm i https://pkg.pr.new/@tanstack/hotkeys@298

@tanstack/hotkeys-devtools

npm i https://pkg.pr.new/@tanstack/hotkeys-devtools@298

@tanstack/lit-hotkeys

npm i https://pkg.pr.new/@tanstack/lit-hotkeys@298

@tanstack/octane-hotkeys

npm i https://pkg.pr.new/@tanstack/octane-hotkeys@298

@tanstack/preact-hotkeys

npm i https://pkg.pr.new/@tanstack/preact-hotkeys@298

@tanstack/preact-hotkeys-devtools

npm i https://pkg.pr.new/@tanstack/preact-hotkeys-devtools@298

@tanstack/react-hotkeys

npm i https://pkg.pr.new/@tanstack/react-hotkeys@298

@tanstack/react-hotkeys-devtools

npm i https://pkg.pr.new/@tanstack/react-hotkeys-devtools@298

@tanstack/solid-hotkeys

npm i https://pkg.pr.new/@tanstack/solid-hotkeys@298

@tanstack/solid-hotkeys-devtools

npm i https://pkg.pr.new/@tanstack/solid-hotkeys-devtools@298

@tanstack/svelte-hotkeys

npm i https://pkg.pr.new/@tanstack/svelte-hotkeys@298

@tanstack/svelte-hotkeys-devtools

npm i https://pkg.pr.new/@tanstack/svelte-hotkeys-devtools@298

@tanstack/vue-hotkeys

npm i https://pkg.pr.new/@tanstack/vue-hotkeys@298

@tanstack/vue-hotkeys-devtools

npm i https://pkg.pr.new/@tanstack/vue-hotkeys-devtools@298

commit: 240126e

@github-actions

Copy link
Copy Markdown
Contributor

🚀 Changeset Version Preview

No changeset entries found. Merging this PR will not cause a version bump for any packages.

@KevinVandy
KevinVandy marked this pull request as ready for review November 25, 2026 04:09
@KevinVandy
KevinVandy merged commit 581b219 into main Nov 25, 2026
16 checks passed
@KevinVandy
KevinVandy deleted the fix/invariant-test-timeouts branch November 25, 2026 04:10
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.

1 participant