Repository navigation
Conversation
Playwright pages acquired inside an it() body and closed only as the last happy-path statement leak a live tab into the file's shared browser on assertion failure, compounding memory pressure across the suite (audit on #389, finding 4). Wrap every page acquisition without existing try/finally protection, following the pattern already used in connection-pool.it.test.ts and transport-selection.it.test.ts. Left alone: the two reload-simulation tests in embed.it.test.ts ("a reload restores the panel open on the same view" and "a reload after closing the panel boots shut") where page.close() mid-body is the reload trigger itself, not incidental cleanup; and the shared beforeAll/afterAll pages in page-dispatch-boot.it.test.ts and page-dispatch-parity.it.test.ts, which are not per-test. PR 2 of 2 for #389, under epic #409. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Warning Review limit reached
Next review available in: 22 minutes 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 (16)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
…ths too The two reload-simulation tests kept a bare-body page for `first` (closed mid-body as the reload trigger) and `second` (closed only as the last statement). Either leaks on an assertion failure before its close: page.close() is idempotent, so wrapping each phase in its own try/finally closes on failure without changing happy-path behavior — the mid-body first.close() stays in place as the reload trigger. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Superseded by the runner migration: the embed integration suite is moving off vitest onto @playwright/test, which owns page lifecycle via fixtures and kills this leak class by construction rather than patching it test-by-test. Not merging. See the follow-up PR for #389 that supersedes this one. |
…/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
packages/embed/test/*.it.test.ts: everyit()that acquires one or more Playwright pages and only closed them as the last happy-path statement now wraps the body intry { ... } finally { await page.close() }(multi-page tests close each page in the finally). This matches the pattern already used inconnection-pool.it.test.tsandtransport-selection.it.test.ts(untouched — already correct).browser, compounding memory pressure across the suite (audit on Flaky: grab-reference.browser.test.tsx dies with 'Browser connection was closed' + extension teardown unhandled (CI shard-4) #389, finding 4).apps/conciv/test/transport-standalone.it.test.tsalready used try/finally per test — left untouched, per the audit.Left alone (and why)
embed.it.test.ts:'a reload restores the panel open on the same view'and'a reload after closing the panel boots shut'— each closes the first page mid-body as the literal reload/close simulation, then opens a second page to assert restored state. That mid-body close is test semantics, not incidental cleanup, so these two are left unwrapped per the "leave alone and note it" instruction.page-dispatch-boot.it.test.tsandpage-dispatch-parity.it.test.ts— their pages are created inbeforeAlland closed inafterAll, shared across allit()s in the describe block, not per-test acquisitions.Test plan
pnpm turbo run build --filter=@conciv/embed(green)packages/embed/test/embed.it.test.ts— 18/18 passedpackages/embed/test/rebind.it.test.ts— 4/4 passedpackages/embed/test/composer-trigger-menu.it.test.ts— 5/5 passedpnpm turbo run typecheck --filter=@conciv/embed --filter=@conciv/app(green)oxfmt --check/oxlinton all 16 touched files (clean; formatting auto-fixed two files pre-commit)fallow audit --changed-since origin/main --format json→ verdictpass, 0 introduced findingsRefs #389, #409
🤖 Generated with Claude Code