Repository navigation
ci: one reader for the pinned Playwright version, validated once - #464
Conversation
Three jobs keyed one Chromium cache on the pinned Playwright version and read it two ways. The gate validated `devDependencies.playwright` as exact semver before writing its step output, because a step output is repository text and a newline inside one forges further outputs on a fork's pull request. The browser lane and the warm job wrote an unvalidated command substitution over the installed `@playwright/test`. So one key had two sources, and only one of them refused a range pin. `scripts/playwright-version.mjs` is the only reader now, and it carries that validation. `ci-workflows.test.ts` pins that each consumer's key reads its output and that no job writes a second one, in place of the two-pin equality assertion #461 needed: with one reader, a divergent `@playwright/test` pin fails the lane loudly instead of keying the cache on a version nothing wrote. The browser lane also installs Chromium unconditionally, as the gate does. Its `if: cache-hit != 'true'` branch ran `install-deps` alone on a hit, so a partially restored entry was handed on as a browser — the hazard the gate's own step comment documents. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjXWmAFgogYjJfzh1se
Measured: `readPackage()` from `_wrangler-config.mjs` loads the TypeScript compiler for the wrangler JSONC configs, which this read has no use for. `node scripts/playwright-version.mjs` went from 380 ms to 35 ms, and the spec's own run from 645 ms to 166 ms. The reader now parses `package.json` itself and exports `readPinnedPlaywrightVersion`, so the spec covers the real file read rather than asserting a value it supplied. The spec's refusal table drops the two rows that died on a character a row beside them already covered, and the live-pin case asserts it does not throw rather than re-matching the pattern the function returns through. `ci-workflows.test.ts` gains one `describe` for the key all three jobs share, in place of three per-job copies of the same `it`. Its reader assertion now pins the step the key names and the key literal, rather than counting step outputs of any kind — the gate job writes others, so the old shape would have reddened a test whose name says the version grew a second read. And the two-pin equality assertion is rewritten rather than deleted. Its old reason is gone, but `pnpm exec playwright install` resolves the `playwright` pin the key names while both consumers launch through `@playwright/test`: a one-sided bump installs a nested second copy, and the lane then hunts a Chromium revision nothing downloaded. Prose: one fact had six homes. The newline-forges-an-output why now lives in the reader alone, and each workflow comment keeps only what its own step decides. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjXWmAFgogYjJfzh1se
…le on it `/code-review high` found the one gap the two commits before this left: no spec ran the command the workflows run, so the entry guard, the `version=` prefix and the newline were uncovered. A guard that stopped firing writes nothing and exits 0, and because all three jobs share the reader every key degrades to the same `playwright-chromium-<os>-` at once — the cache keeps hitting while it tracks no version, with nothing red. Watched failing both ways: the guard forced false, and the prefix dropped. `docs/testing.md`'s `paths:` now names the reader, so the rule loads for whoever edits it. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjXWmAFgogYjJfzh1se
sydevs-bot
left a comment
There was a problem hiding this comment.
1 question for the reviewer, one per thread.
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
sydevs-bot
left a comment
There was a problem hiding this comment.
🧐 Adversarial review
The diff is the size of #462 and no bigger: three read lines collapse into one script. The browser lane's install change is joined, not smuggled — same file, same cache entry, same verification step — and it ends an asymmetry with the gate rather than papering over one. Keeping the two-pin equality assertion against criterion 4 is right: the key names playwright while both lanes launch through @playwright/test, so a one-sided bump still breaks the lane and nothing else pins it.
Findings
should-fix—scripts/playwright-version.mjs:16:ROOTand the localpackage.jsonread duplicatereadPackage()in_wrangler-config.mjs.should-fix—scripts/playwright-version.mjs:39:readPinnedPlaywrightVersionis a middle layer with one production caller.should-fix—docs/testing.md:423: the added ⚠ block restatesci.yml's own comment and retells the spec's cases.consider—scripts/ci-workflows.test.ts:342: two describes are left holding one assertion each.
Second opinion — the key=/path= question: A, the built option. Resolved.
What was checked. #462 criterion by criterion: 1–3 met, 4 deviated with a reason that holds. Read whole on the branch: the new script, both specs, both workflow files, scripts/_wrangler-config.mjs, docs/testing.md. Ladder walked for the pieces new-pieces.mjs left under skipped — the test file's ciWorkflow/browserJob/SCOPES and the three workflow run lines — and for the invokedAs/realpathSync guard, which five sibling scripts/*.mjs write verbatim, so it stays. Streamliner: 5 pieces covered, 3 kept. No preview surface, and this repo declares no fixture block; every path the body names is on the branch. No consumer side to follow — neither contractSync nor docs/embedding.md is touched.
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
`_wrangler-config.mjs` exists to own the script-side `package.json` read, and the reader grew a second root and a second parse to avoid its cost: the module imports the TypeScript compiler for the wrangler JSONC configs, which this read has no use for and three CI steps would pay. Requiring the compiler inside `readWranglerConfig` keeps the saving and drops the duplication. Measured here, 5 runs each: the script takes 35-42 ms either way, against 362-421 ms for an eager `import ts from 'typescript'`. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjVLqoXwaEoCcv9hoGM
`readPinnedPlaywrightVersion` stood between the print and the validator with one production caller, and the spec case that covered it asserted the printed line against the very function the script called, so it could not fail. The print composes the two directly, and the command case asserts the pin as `package.json` has it — watched failing against a hard-coded `1.64.0`, which the old form passed. It keeps the live pin's own coverage: a `^1.65.1` entered in `package.json` fails the command, and the case with it. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjVLqoXwaEoCcv9hoGM
Both held `expectRestoresWarmedCache` alone, one per consumer, while the table below them already names those two as `SCOPES.slice(0, 2)`. The assertion is a row there now, watched failing for each scope against an `actions/cache` that saves in place of the restore-only one. The gate describe's #459 reasoning moves onto that row, which is the only thing left reading it. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjVLqoXwaEoCcv9hoGM
The install block's `if:` reason is the comment beside that step in `ci.yml`, where whoever edits it reads it, and the two trailing clauses retold `ci-workflows.test.ts`'s cases — which the paragraph above already points at in one line. What is left is the claim the file owns: one reader, and why a step output refuses an inexact pin. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjVLqoXwaEoCcv9hoGM
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
sahajatlas-design | 601b855 | Nov 23 2026, 12:17 AM |
|
Four critic threads, all adopted. One commit each, on
The body's 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
Summary
scripts/playwright-version.mjs, produces the version every Chromium cache key is built from, and refuses a pin that is not exact.Change outline
How each job's cache key gets its version. One key had two sources, and only one of them refused a range pin — or a newline, which forges a further step output on a fork's pull request.
The browser lane's install, which branched on the restore's outcome.
What the spec holds, as one cross-job describe instead of three per-job copies.
Preview
No preview surface: the diff is two CI workflows, two scripts, two specs and a doc. No deployed artifact changes.
Test results
test:run(189 files, 2372 passed, 1 skipped)scripts/playwright-version.test.ts(7),scripts/ci-workflows.test.ts(38),scripts/wrangler-config.test.tsandscripts/assert-preview-host.test.ts— all passedManual verification
playwright-chromium-Linux-1.65.1), so the entrybrowser-cache.ymlwarmed onmainshould serve both.Notes for reviewer
lookup-onlyrestore, downloads without--with-deps, and saves, so one action covering all three needs asaveinput plus three conditionals — the warm job's divergence moves inside rather than disappearing. Its reader could only be pinned as YAML text, never executed, and the ticket's own verification step wants the reader called directly. Two silent costs decided it:ci-workflows.test.ts's SHA-pin gate globs.github/workflows/*.y(a)mlonly, and.github/dependabot.yml'sdirectory: /does not reach a composite action's subdirectory — so everyactions/cachepin moved into one would quietly stop being gated and stop being bumped.pnpm exec playwright installresolves theplaywrightpin the key names, while the browser lane and the accessibility gate launch through@playwright/test, which nothing else pins. Bump one alone and pnpm installs a second, nestedplaywright; the lane then hunts a Chromium revision nothing downloaded and tells the reader to run the install that just ran. One unit assertion catches that in seconds, so it moved to the new describe with that reason. Say the word and it goes.readPackage()from_wrangler-config.mjs, the module that owns this parse, and the compiler that made duplicating it tempting is now required insidereadWranglerConfiginstead of imported at module scope. Measured here, 5 runs each: the script takes 35–42 ms either way, against 362–421 ms for an eagerimport ts from 'typescript'. Three CI steps import this module forreadPackagealone, two of them on a required check's critical path, and none of them parses JSONC.^1.65.1pin, the equality against a one-sided bump, each scope's reader pin against its old read restored, the key assertion againsthashFiles('package.json'), the install pin against theif:put back, the step-output assertion against both a guard forced false and theversion=prefix dropped, each restore row against anactions/cachethat saves in place of the restore-only one, and the printed pin against a hard-coded1.64.0.comment-lint.mjs: clean. Security review: skipped — the diff matches neithersecurityReview.triggerPatternnorcontentPattern.Detail
Dropping the lane's
if:adds no work on a hit. Read out of the installed[email protected]:install --with-depsreturns at the top ofdownloadBrowserWithProgressBaron theINSTALLATION_COMPLETEmarker inside the restored directory, so a hit downloads zero bytes; and the apt set is identical, becauseregistry.installDepskeys on_dependencyGroup, which ischromiumfor bothchromiumandchromium-headless-shell— so--no-shellnarrows the executable list and not the package list. New work on a hit is a dirlock, a.linkswrite and the installation-cache validation, all sub-second. Step count on the hit path is unchanged.Per-edit budget. Editing the reader selects one spec, at 0.69 s.
_wrangler-config.mjsgoes from 4 selected specs to 5 — the new spec joins it, since it reads the pin back throughreadPackage— timed at 1.23 s against the 12 s budget.scripts/select-unit-specs.test.ts's width ceiling of 22 is untouched: the widest edit is stillsrc/test-support/repo-source.tsat 22, and the new spec reaches no repo file through it.Considered and not done: having the reader print
key=andpath=too, so the four copies of each literal across the two workflow files collapse to one. It would make the key true by construction rather than held by regex pins, at the cost of moving the key out of sight of anyone readingci.yml— and~expansion in a cachepathtaken from a step output is a silent-miss risk no local run can settle. Asked as a question thread on the diff.Closes #462