Skip to content

fix(imagegen): share one chromium across test renders to avoid spawn deadlocks - #111

Merged
nibzard merged 1 commit into
mainfrom
fix/imagegen-shared-browser
Jul 31, 2026
Merged

fix(imagegen): share one chromium across test renders to avoid spawn deadlocks#111
nibzard merged 1 commit into
mainfrom
fix/imagegen-shared-browser

Conversation

@nibzard

@nibzard nibzard commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Summary

The imagegen CI flake was not slow runners: with the timeout raised to 240s (#110), the failing test died at 180s, which is Playwright's own browser launch timeout, with chrome-headless-shell stuck at launching. Repeated chromium.launch() calls in the same Bun test process intermittently deadlock on spawn; cli.test.ts already documents this pattern for subprocess spawns. The first launch always succeeds, so the fix is to launch once and reuse.

  • renderCard accepts an optional already-launched browser; the caller owns its lifecycle, and pages are now closed per render either way. Without the option, behavior is unchanged (launch and close per call), so the production CLI path is untouched.
  • run() gains a render seam in RunDependencies, mirroring the existing generate seam.
  • New tests/imagegen/helpers/browser.ts shares one lazily-launched Chromium across all imagegen test files; Playwright reaps it at process exit.
  • Both integration test files render through the shared browser; timeout comments updated.

Side effect: the full test suite drops from about 195s to about 28s, since Chromium launches once instead of per render.

Test plan

  • bun test tests/imagegen: 79 pass, 0 fail
  • bun test (full): 316 pass, 0 fail
  • bun run typecheck and bun run check: clean

@vercel

vercel Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview Jul 31, 2026 1:37pm

Request Review

@nibzard
nibzard merged commit ee9b0e5 into main Jul 31, 2026
3 checks passed
@nibzard
nibzard deleted the fix/imagegen-shared-browser branch July 31, 2026 14: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