fix(build): playwright extension parses the Playwright 1.58+ install --dry-run output - #4881
fix(build): playwright extension parses the Playwright 1.58+ install --dry-run output#4881NERLOE wants to merge 3 commits into
install --dry-run output#4881Conversation
…utput Playwright 1.58 changed the per-browser header printed by `playwright install --dry-run` from `browser: <name> version <v>` to `<Product> <v> (playwright <name> v<build>)`, so the extension's grep found nothing and the image build failed at that step. The header match now accepts both formats. The context window after the header is also narrowed to the two lines the extension reads (install location and download url): the new blocks are shorter than the old five-line ones, so the previous window ran into the next browser's install location and would have unpacked the archive into the wrong directory. Fixes triggerdotdev#3089 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: b9dd0f0 The changes in this PR will be included in the next version bump. This PR includes changesets to release 27 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review. 📜 Recent review details⏰ Context from checks skipped due to timeout. (39)
🧰 Additional context used📓 Path-based instructions (7)We use vitest exclusively.📄 CodeRabbit inference engine (AGENTS.md) Files:
**Prefer static imports over dynamic imports.**📄 CodeRabbit inference engine (AGENTS.md) Files:
Add crumbs as you write code — not just when debugging.📄 CodeRabbit inference engine (AGENTS.md) Files:
Use vitest for all tests in the Trigger.dev repository📄 CodeRabbit inference engine (.github/copilot-instructions.md) Files:
Use function declarations instead of default exports📄 CodeRabbit inference engine (.github/copilot-instructions.md) Files:
Use types over interfaces for TypeScript Avoid using enums; prefer string unions or const objects instead📄 CodeRabbit inference engine (.github/copilot-instructions.md) Files:
When creating or editing OTEL metrics (counters, histograms, gauges), ensure metric attributes have low cardinality by using only enums, booleans, bounded error codes, or bounded shard IDs Do not use high-cardinality attributes in OTEL metr...📄 CodeRabbit inference engine (.cursor/rules/otel-metrics.mdc) Files:
🪛 ast-grep (0.45.2)packages/build/src/extensions/playwright.test.ts[warning] 24-24: Do not use variable for regular expressions (regexp-non-literal-typescript) [warning] 31-31: Do not use variable for regular expressions (regexp-non-literal-typescript) 🔇 Additional comments (2)
WalkthroughThe Playwright build extension now matches legacy and Playwright 1.58+ Merge Risk: 🔵 Low · up to The PR updates browser-output parsing for Playwright 1.58+ and is otherwise a localized change, but the modified parsing block still lacks the required crumb instrumentation, which may make build failures harder to diagnose; it is mergeable with explicit owner follow-up. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Full details: Description checkExplanation The description is mostly complete. It identifies issue Full details: Linked Issues checkExplanation The changes satisfy issue ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
…test Only the Chrome-for-Testing blocks shrank in 1.58+; Firefox and WebKit still print the fallback urls. The window is two lines because that is all the extension reads, not because every block is that short. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Lift the pattern into dryRunHeaderPattern() so the test exercises it without a hand-built BuildContext. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Fixes #3089
Problem
The
playwrightbuild extension readsnpx playwright install --dry-runto find each browser's install directory and download URL. Playwright 1.58 changed the per-browser header, so the extension'sgrepfinds nothing and the image build fails at that step with exit code 1:There is a second problem hiding behind the first. The old blocks were five lines (install location, download url, two fallback urls, blank), so
grep -A5was exact. The Chrome-for-Testing blocks in 1.58+ (chromiumandchromium-headless-shell, the default install) are three lines (install location, download url, blank; Firefox and WebKit still print the fallbacks), so-A5runs into the next browser'sInstall location:line. The downstreamgrep "Install location:" | cut | xargsthen joins two paths andbasenamereturns the next browser's directory: with the header grep alone fixed,chromium-headless-shellgets unpacked intofirefox-<build>/. Any grep-only fix (including the pnpm patch shared in #3089) has this bug.Fix
grep -E "browser: <name> |\(playwright <name> v". The trailing space /vkeepchromiumfrom matching thechromium-headless-shellblock in either format.-A2, the two lines the extension actually reads. Both formats putInstall location:andDownload url:immediately after the header.I left the
sed "s/mac-arm64/linux/g"rewrite alone, and I do not think the "deadlinux64URLs" report in #3089 is reachable from the extension. The--dry-runexecutes inside the Linux build container, so the URL it prints is already the Linux one and there is nothing for the rewrite to match. Checked by running the same command in a container:Rewriting
mac-arm64tolinux64would also be wrong for < 1.58, where the Linux artifact is…-linux.zip, so changing it would trade a dead branch for an incorrect one.Verification
Ran the generated extraction (
grep -A2 -m1 -E … | grep "Install location:" | cut | xargs | basename, and the same forDownload url:) against real--dry-runoutput from Playwright 1.57.0 and 1.62.0, for all four browser keys:(The webkit 1.62 URL shows the mac name only because my sample output came from a Mac; in the build container the dry-run prints Linux URLs.)
End to end: built a
node:22-bookworm-slimimage (linux/amd64) that runs the extension's generatedRUNsteps verbatim forchromium-headless-shellagainst Playwright 1.62.0, then launched the browser through Playwright withPLAYWRIGHT_BROWSERS_PATH=/ms-playwright:So the Chrome-for-Testing archive layout unpacks into the directory Playwright's registry expects, and the browser starts.
Changeset
@trigger.dev/buildpatch.🤖 Generated with Claude Code