Skip to content

Keep parent finalize alive through popup dispose failures - #37

Open
mmkal wants to merge 1 commit into
mainfrom
popup-child-dispose-failures
Open

Keep parent finalize alive through popup dispose failures#37
mmkal wants to merge 1 commit into
mainfrom
popup-child-dispose-failures

Conversation

@mmkal

@mmkal mmkal commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #36 — this fix (cursor bugbot's finding, confirmed in review there) landed on the branch a few minutes after the squash-merge snapshot, so it missed main.

A throwing popup dispose (e.g. a screencast copy or settle failure) aborted the parent page's afterTest/afterTestFinalize, silently dropping the main page's video artifacts. Child wrap and dispose failures are now collected and rethrown only after the parent's own teardown runs:

// before: popup teardown hiccup → no video-rendered.webm for the whole test
// after: parent artifacts written, then the child's error still fails the test
await expect(page[Symbol.asyncDispose]()).rejects.toThrow("popup teardown exploded");
expect(events).toEqual(["parent finalized"]);

🤖 Generated with Claude Code

Session: b7f6f792-6606-44be-9ec3-207eb762c4b6


Note

Medium Risk
Changes test teardown ordering in the plugin system, which affects artifact finalization for pages with auto-wrapped popups; scope is limited to dispose error handling with a targeted regression test.

Overview
Popup teardown errors no longer skip the parent page’s lifecycle. In addPlugins, child popup pages are disposed before the parent runs afterTest / afterTestFinalize. Previously, a throwing child asyncDispose (not only a failed wrap) could abort teardown before those parent hooks ran, which could drop main-page artifacts such as video output.

The dispose loop now collects child wrap rejections and child dispose errors in childFailures, still runs the parent’s serial lifecycle emissions and cleanups, and rethrows the first child failure only after parent teardown completes.

A new popup spec asserts that a popup plugin’s afterTestFinalize throw still fails page[Symbol.asyncDispose](), while the parent’s afterTestFinalize handler runs first (events contains "parent finalized").

Reviewed by Cursor Bugbot for commit ef2f003. Bugbot is set up for automated code reviews on this repo. Configure here.

Cursor bugbot caught that a throwing child asyncDispose (e.g. a popup
screencast copy failure) aborted the parent's afterTest/afterTestFinalize,
dropping the main page's video artifacts. Child wrap and dispose failures
are now collected and rethrown only after the parent's own teardown runs.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@pkg-pr-new

pkg-pr-new Bot commented Aug 14, 2026

Copy link
Copy Markdown

Open in StackBlitz

pnpm add https://pkg.pr.new/middlewright@37

commit: ef2f003

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