Repository navigation
fix(embed): give port-drift navigation.set its own readiness deadline - #410
Conversation
The 'survives same-core port drift' test started the navigation.set completion deadline before waiting for the chat reply, so under CI load the reply wait could consume most of the 30s budget, leaving navigation.set observed but not completed in time (#404). Capture the observer mark before the turn but only await completion after the reply is visible, so the write gets its own full window instead of racing the reply wait's clock. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Warning Review limit reached
Next review available in: 1 minute Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Comment |
There was a problem hiding this comment.
Pull request overview
Moves the navigation-write deadline to begin after the assistant reply renders, reducing rebind test flakiness.
Changes:
- Captures an RPC observer mark before sending the chat message.
- Exports the shared navigation procedure path.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
packages/embed/test/rebind.it.test.ts |
Separates reply and navigation-write deadlines. |
packages/embed/test/helpers/navigation.ts |
Exports the navigation-set RPC path. |
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| await sendChatMessage(page, USER_TEXT) | ||
| await expectLocator(page.getByText(ASSISTANT_TEXT)).toHaveCount(1, {timeout: 30_000}) | ||
| await routed | ||
| await navigationObserver.completed({path: NAVIGATION_SET, since: navigationMark, timeout: 30_000}) |
There was a problem hiding this comment.
Valid arithmetic — the sequential 30s waits share one 60s testTimeout, so an inner deadline can be pre-empted by the test cap. Two notes: this is a pre-existing property of every test in this file (this PR only swaps which wait mechanism is used inside the same budget), and the file is being migrated to @playwright/test as its runner (#389 / epic #409), where per-test timeouts are being set deliberately — the migration carries the instruction to budget rebind's test timeout above the sum of its sequential deadlines. Tracking it there rather than re-rolling this green PR.
…/e2e — the runner owns page lifecycle (#389) (#415) * test(embed): move integration tests onto @playwright/test under tests/e2e — the runner owns page lifecycle (#389) Failed assertions in the old hand-rolled `chromium.launch()`/`browser.newPage()` vitest suite leaked live Chromium pages: nothing guaranteed a close on a failure path, and those leaks pressured CI shard-4 and stranded sibling vitest browser sessions. Kill the leak class by construction: @playwright/test owns the browser/context/page lifecycle end to end via its built-in fixtures, so a failed assertion can no longer skip a close. Splits packages/embed's test suite by kind: - tests/e2e/ — the 22 real browser-driven integration tests (*.it.test.ts), now run by `playwright test`. Kit boots stay per-file via test.beforeAll/test.afterAll; per-test pages come from the page/context fixtures; multi-page tests use context.newPage(); the two reload-simulation tests in embed.it.test.ts keep their intentional mid-body page.close(). - tests/unit/ — the 4 build/bundle assertion tests plus proxy-upgrade (an integration test against a real HTTP/WS server that never opens a browser page), still run by vitest. - tests/helpers/ — boot.ts, host.ts, proxy.ts: shared, non-playwright helpers used by both tiers. - tests/e2e/helpers/ — the playwright-only helpers (suite.ts and probe-suite.ts no longer own a browser at all). - tests/fixtures/, tests/dist/, tests/globals.d.ts moved alongside. Supersedes the closed #411 try/finally hand-wrapping attempt and epic #409. Rebased onto #410 (port-drift navigation.set deadline fix) after it merged. Also fixes a latent gap in the banned-vocabulary allowlist: the renamed native-bridge.ts helper was never covered under its old path either, so add the new path to NATIVE_AND_REACT_BRIDGE_PATHS. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(embed): budget per-test timeouts and make e2e teardown never throw Sum the sequential wait budgets (expect timeouts, observer completed timeouts, and the shared helper waits they call into) for every packages/embed/tests/e2e/*.it.test.ts test and set test.setTimeout on any test whose sum clears the ~45s default, so slow CI runs don't trip the global 60s playwright timeout. Move teardown robustness into the shared helpers instead of wrapping every test.afterAll in try/finally at the call site: bootEmbedKit's returned cleanup, serveHost's returned close, proxyTo's returned close, and startProbeServer's returned close now catch and log rather than throw, so a failure in one step never skips the rest of a multi-step afterAll. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(embed): close dedicated panel-focus hosts on teardown, propagate close errors panel-focus.it.test.ts left dedicated hosts open on a failed assertion since close() only ran on the happy path; move cleanup to a module-level afterEach that owns every host openPanelOverFocusedHostButton creates. Also make listenLocal's close callback reject on a server.close error instead of silently discarding it, so serveHost.close's existing catch/log wrapper can actually log cleanup failures. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Summary
rebind.it.test.ts> 'survives same-core port drift' > "re-points rpc and SSE to the new port..." timed out waiting fornavigation.setto reach "completed" within 30s on a loaded CI runner.Signal analysis
navigation.setcompleting IS the right, contract-guaranteed signal here — unlike case 1's frame-count snapshot (opportunistic background traffic), this write is a deterministic side effect of the chat turn: the widget persists the panel's session href into navigation state once the turn lands, and the very next line (panelSession()) reads that persisted state back. Dropping the wait, or swapping to a different signal, would let the test read stale navigation state.The actual bug was deadline placement, not signal choice:
waitForNavigationWrite(page)was called beforesendChatMessage+ the up-to-30s wait for the assistant reply to render. Itscompleted({..., timeout: 30_000})starts its own 30s clock the instant it's called (seerpc-observer.ts'sbuffered()), so on a loaded runner the reply-visibility wait could eat most of that budget before the code ever got toawait routed— leavingnavigation.set"observed but never completed within the window" even though it was healthy.Fix: keep the observer mark taken before the turn (so an in-flight/early write is still matched via
since), but only start waiting oncompleted()after the reply is visible — givingnavigation.setits own full 30s window instead of sharing one with the reply wait.NAVIGATION_SETis exported from the navigation helper so the test can reference the same procedure path instead of duplicating the string literal.Test plan
pnpm exec turbo run build --filter=@conciv/embedCI=1 pnpm exec vitest run test/rebind.it.test.ts— 3x green in the worktree (all 4 tests in the file pass each run)Closes/relates to #404 (second occurrence, from PR #399 shard-1 CI run 31411496253).
🤖 Generated with Claude Code