The rule-preview search test loads its lazy chunk before it runs (#1080) #1084

Merged
claude-bot merged 1 commit from fix/1080-appframe-rule-preview-flake into main 2026-10-04 17:18:00 +00:00
Collaborator

Closes #1080. Test-only.

Summary

The test "choosing a rule opens it in place" failed once in CI with Unable to find role="dialog" and name "Tidal Surge".

  • Cause. The rule preview is loaded lazily (React.lazy in useRulePeek.jsx), and this test is the first to open one. On a loaded machine, Vite transforming that module takes longer than findByRole's 1,000 ms.
  • Not the cause. The result row is not replaced between the find and the key press: rows are keyed, and rendered once per answer.
  • A person cannot hit it. In the app the same wait is a chunk fetch behind a Suspense.
  • Fix. A beforeAll in that describe imports RulePeek.jsx, with its own 60 s limit, so the load is outside any test's timeout. No timeout was raised and no component changed.

Evidence

One test, a fresh vitest process per run, on the dev host:

Conditions Before After
No added load 1 of 12 failed, with the dialog error 0 of 12
4 extra busy processes 10 of 12 failed (9 with the dialog error) 6 of 12, all the test's own 15 s limit
12 extra busy processes on 6 cores 15 of 15 failed, with the dialog error 8 of 15, all the 15 s limit

The fix removes the dialog error, not every failure under heavy load. What remains there is the whole test exceeding 15 s on an overloaded host, which this PR does not change.

Test plan

  • The loop above.
  • npx vitest run src/shell: 173 passed, 1 skipped.
  • eslint: no errors.
  • Full frontend suite: CI.

🤖 Generated with Claude Code

Closes #1080. Test-only. ## Summary The test "choosing a rule opens it in place" failed once in CI with `Unable to find role="dialog" and name "Tidal Surge"`. - **Cause.** The rule preview is loaded lazily (`React.lazy` in `useRulePeek.jsx`), and this test is the first to open one. On a loaded machine, Vite transforming that module takes longer than `findByRole`'s 1,000 ms. - **Not the cause.** The result row is not replaced between the find and the key press: rows are keyed, and rendered once per answer. - **A person cannot hit it.** In the app the same wait is a chunk fetch behind a Suspense. - **Fix.** A `beforeAll` in that `describe` imports `RulePeek.jsx`, with its own 60 s limit, so the load is outside any test's timeout. No timeout was raised and no component changed. ## Evidence One test, a fresh vitest process per run, on the dev host: | Conditions | Before | After | |---|---|---| | No added load | 1 of 12 failed, with the dialog error | 0 of 12 | | 4 extra busy processes | 10 of 12 failed (9 with the dialog error) | 6 of 12, all the test's own 15 s limit | | 12 extra busy processes on 6 cores | 15 of 15 failed, with the dialog error | 8 of 15, all the 15 s limit | **The fix removes the dialog error, not every failure under heavy load.** What remains there is the whole test exceeding 15 s on an overloaded host, which this PR does not change. ## Test plan - [x] The loop above. - [x] `npx vitest run src/shell`: 173 passed, 1 skipped. - [x] eslint: no errors. - [ ] Full frontend suite: CI. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
The rule preview test loads the lazy preview chunk before it presses Enter (#1080)
All checks were successful
CI / Summarisation accuracy eval harness (stub provider) (pull_request) Successful in 1m5s
CI / Bot tests and audit (pull_request) Successful in 2m11s
CI / Bot/backend version sync (pull_request) Successful in 34s
CI / Backend lint (ruff) (pull_request) Successful in 40s
CI / Feedback site tests (pull_request) Successful in 56s
CI / Does this change touch the recording path? (pull_request) Successful in 42s
CI / Synthetic session harness (no GPU, no LLM) (pull_request) Has been skipped
CI / Docker image build (pull_request) Successful in 1m11s
CI / Frontend (shard 2/2) (pull_request) Successful in 8m58s
CI / Frontend (shard 1/2) (pull_request) Successful in 23m12s
CI / End-to-end journeys (phone) (pull_request) Successful in 13m35s
CI / End-to-end journeys (keyboard) (pull_request) Successful in 14m31s
CI / End-to-end journeys (desktop) (pull_request) Successful in 14m33s
CI / Backend migration, tests, and audit (pull_request) Successful in 29m57s
5703c25ad9
The preview is a React.lazy chunk fetched at the first press. In vitest that
is a module transform, which on a loaded shard outlasts findByRole's one
second. Result rows are keyed and render once per answer, so the row is not
replaced; the app is unaffected. Load the module in beforeAll.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude-bot deleted branch fix/1080-appframe-rule-preview-flake 2026-10-04 17:18:01 +00:00
rbrooks referenced this pull request from a commit 2026-10-05 00:39:29 +00:00
Sign in to join this conversation.
No description provided.