Repository navigation
test(dashboard): hold the page exit in page-swap cases that act during it - #443
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
…g it Four page-swap cases in shell.test.ts do something while the old page is still leaving and then check that it is still there. The exit is a 180 ms Motion animation timed by the wall clock. React's async act() keeps flushing work with a setImmediate turn between flushes, and happy-dom runs requestAnimationFrame on setImmediate, so Motion frames run inside one act(). On a slow runner the steps between the nav click and the check take more than 180 ms: the exit ends, the next page mounts, and the check fails. In the main CI failure (run 46246595371, "keeps Engine active when a hook-blocked prompt arrives during Chat exit") the Chat page saved the blocked prompt to drafts while it was still leaving, as it should. The waitFor that read the draft only got control back after Engine had mounted, so the "Engine not shown yet" check failed. The app was right; the test raced the clock. holdPageExit() sets MotionGlobalConfig.useManualTiming, Motion's switch for a clock the caller drives. Frames still run, but an exit that starts meanwhile does not move until the release, so the "still leaving" checks no longer depend on runner speed. Each case releases the clock once its checks are done and then waits for the next page as before. Loaded runs (background QoS on E-cores, 4 parallel runs, 6 CPU burners): - "keeps Engine active ...": 39/40 fail with holdPageExit made a no-op, 0/200 with this change - page swap block on main, 12 runs: the hook-block case failed 5 times, "restores a failed send prompt ..." 3, "drops navigator.replace ..." 1; "freezes an exiting page ..." failed once in 40 runs before it got the hold too Co-Authored-By: Claude Opus 5.5 <[email protected]>
84deff0 to
6c7ec40
Compare
Summary
packages/dashboard/__test__/shell.test.ts>page swap>keeps Engine active when a hook-blocked prompt arrives during Chat exit and saves the prompt to draftsfailed on main CI (run 46246595371, at 07995ed):The app works correctly. The test raced the 180 ms (wall clock) exit fade of the old page:
On a loaded runner, async
act()gives the event loop turns, and happy-dom runs animation frames in those turns. So the fade can end inside oneact()call.Fix (test only): the new
holdPageExit()setsMotionGlobalConfig.useManualTiming = truebefore the nav click and resets it after the "still leaving" checks. Frames still run, but the exit does not advance until the release. Four cases use it, and each one failed under load before the fix.Verification
Load = the test pinned to efficiency cores, 4 parallel lanes, 6 CPU burners.
page swapblock, 12 runspage swapblock, 40 runsshell.test.tsholdPageExit()made a no-opyarn typecheck,vp lint --type-aware --type-checkandvp fmt --checkpass.Review decisions (no change)
shell.test.ts:615-630) can pass after Chat has unmounted. It does not flake. It is a coverage gap in an existing case, not the CI failure this PR fixes. A follow-up can hold the exit there too, if that case must always cover a reply while Chat is closing.🤖 Generated with Claude Code