Skip to content

test(dashboard): hold the page exit in page-swap cases that act during it - #443

Merged
Brooooooklyn merged 1 commit into
mainfrom
test/dashboard-shell-page-swap-flake
Nov 29, 2026
Merged

Brooooooklyn merged 1 commit into
mainfrom
test/dashboard-shell-page-swap-flake

Conversation

@Brooooooklyn

@Brooooooklyn Brooooooklyn commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

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 drafts failed on main CI (run 46246595371, at 07995ed):

AssertionError: expected 'Skip to contentEngineSearch or jump t…' not to contain 'The inference process, live.'

The app works correctly. The test raced the 180 ms (wall clock) exit fade of the old page:

 t(ms)  test                                  app
   0    click Engine (act starts)             Chat fade-out starts (180 ms)
 251    click act returns                     Chat leaving, Engine not mounted
 252    waitFor poll 1: draft? no ──► one act(setTimeout 0) runs for 266 ms:
 283      │                                   Chat (still leaving) saves the draft
 ~432     │                                   fade-out done → Chat removed
 513      │                                   Engine mounts
 518    poll 2: draft? yes → "Engine not shown yet" check fails

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 one act() call.

Fix (test only): the new holdPageExit() sets MotionGlobalConfig.useManualTiming = true before 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.

Run Result
Before, the CI case, under load 4/20 and 9/20 failed
Before, page swap block, 12 runs 6 runs failed
After, the CI case, under load 200/200 pass
After, page swap block, 40 runs 40/40 pass
Whole shell.test.ts 49/49 pass
Mutation: holdPageExit() made a no-op fails in 39/40 runs under load

yarn typecheck, vp lint --type-aware --type-check and vp fmt --check pass.

Review decisions (no change)

  • The BrowserRouter fork case (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

@coderabbitai

coderabbitai Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 332fe0ba-a2cd-4b8a-8ac4-30edf52b2c08

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • 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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-29T12:05:58.626914Z 84deff0 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

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]>
@Brooooooklyn
Brooooooklyn force-pushed the test/dashboard-shell-page-swap-flake branch from 84deff0 to 6c7ec40 Compare November 29, 2026 12:35
@Brooooooklyn
Brooooooklyn merged commit 52f40cb into main Nov 29, 2026
21 checks passed
@Brooooooklyn
Brooooooklyn deleted the test/dashboard-shell-page-swap-flake branch November 29, 2026 13:06
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