fix(build): playwright extension parses the Playwright 1.58+ install --dry-run output - #7
Conversation
… --dry-run` output Source PR: triggerdotdev#4881 Source head: 3720e4b
⛔ Shipwright · BlockedRecommendation: do not merge PR #7 · Tier
Findings (5)
Fireworks usage: 7,191 input · 776 output · 7,967 total tokens · $0.0021 · 13s · 0 fix iteration(s) Open the Shipwright check for full evidence and the audit bundle. Use |
| */ | ||
| export function dryRunHeaderPattern(browser: string): string { | ||
| return `browser: ${browser} |\\(playwright ${browser} v`; | ||
| } |
There was a problem hiding this comment.
Shipwright · CRITICAL
The new regex pattern 'browser: ${browser} |(playwright ${browser} v' is built by interpolating the browser name directly into a regex string without escaping regex metacharacters
Impact: The new regex pattern 'browser: ${browser} |(playwright ${browser} v' is built by interpolating the browser name directly into a regex string without escaping regex metacharacters. If a browser name ever contains a regex special character (e.g., a dot, plus, or parenthesis), the generated RegExp will either fail to compile or match unintended text, breaking the deploy image build. The existing code already interpol…
Suggested fix: Review the cited evidence, fix the risk if confirmed, and rerun Shipwright.
Fixes triggerdotdev#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 triggerdotdev#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 triggerdotdev#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
Source merge-base:
e3db7a820f6166dba740dd7849029c31d040b03aSource head:
3720e4b1e9769380db87783cc3c5e3238696fb1b