Skip to content

fix(registry): evaluate defaultCacheDirectory lazily#41942

Open
dcrousso wants to merge 1 commit into
microsoft:mainfrom
dcrousso:fix-41852
Open

fix(registry): evaluate defaultCacheDirectory lazily#41942
dcrousso wants to merge 1 commit into
microsoft:mainfrom
dcrousso:fix-41852

Conversation

@dcrousso

@dcrousso dcrousso commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

defaultCacheDirectory used to be computed inside the PLAYWRIGHT_BROWSERS_PATH branch of registryDirectory, so setting that variable skipped the platform check

#39423 hoisted it into an eagerly evaluated module constant, so it now throws Unsupported platform: <platform> at import, before registryDirectory consults PLAYWRIGHT_BROWSERS_PATH

this regressed setups that point PLAYWRIGHT_BROWSERS_PATH at their own browsers on platforms without a default cache directory, such as Android/Termux

evaluate defaultCacheDirectory, defaultRegistryDirectory, and baseDaemonDir lazily so an explicit PLAYWRIGHT_BROWSERS_PATH is honored before any default cache directory is computed

registryDirectory still throws eagerly when no override is set, since there is nowhere to place browsers

fixes #41852

`defaultCacheDirectory` used to be computed inside the `PLAYWRIGHT_BROWSERS_PATH` branch of `registryDirectory`, so setting that variable skipped the platform check

a later refactor hoisted it into an eagerly evaluated module constant, so it now throws `Unsupported platform: <platform>` at import, before `registryDirectory` consults `PLAYWRIGHT_BROWSERS_PATH`

this regressed setups that point `PLAYWRIGHT_BROWSERS_PATH` at their own browsers on platforms without a default cache directory, such as Android/Termux

evaluate `defaultCacheDirectory`, `defaultRegistryDirectory`, and `baseDaemonDir` lazily so an explicit `PLAYWRIGHT_BROWSERS_PATH` is honored before any default cache directory is computed

`registryDirectory` still throws eagerly when no override is set, since there is nowhere to place browsers
@dcrousso
dcrousso requested review from pavelfeldman and yury-s July 22, 2026 21:32
@github-actions

Copy link
Copy Markdown
Contributor

Test results for "MCP"

2 failed
❌ [chrome] › mcp/annotate.spec.ts:269 › should start dashboard and annotate when no dashboard is running @mcp-windows-latest-chrome
❌ [chromium] › mcp/cli-navigation.spec.ts:43 › tab-new with url @mcp-macos-latest-chromium

7784 passed, 1262 skipped


Merge workflow run.

@github-actions

Copy link
Copy Markdown
Contributor

Test results for "tests 1"

4 flaky ⚠️ [chromium-library] › library/video.spec.ts:736 › screencast › should work with video+trace `@chromium-ubuntu-22.04-arm-node20`
⚠️ [chromium-library] › library/popup.spec.ts:260 › should not throw when click closes popup `@chromium-ubuntu-22.04-node24`
⚠️ [firefox-page] › page/page-goto.spec.ts:81 › should work with Cross-Origin-Opener-Policy `@firefox-ubuntu-22.04-node20`
⚠️ [playwright-test] › ui-mode-trace.spec.ts:827 › should update state on subsequent run `@windows-latest-node22`

50213 passed, 1190 skipped


Merge workflow run.

@github-actions

Copy link
Copy Markdown
Contributor

Hi, I'm the Playwright bot and I took a first look at the CI failures here.

🟢 Both failures are pre-existing flakes — the PR looks clear

The two MCP failures are known low-rate flakes on tests this PR doesn't touch. This PR only changes lazy evaluation of defaultCacheDirectory/registry paths, which the MCP annotate and tab-navigation flows don't exercise.

Details

Pre-existing flake / infra

  • [chrome] › mcp/annotate.spec.ts:269 › should start dashboard and annotate when no dashboard is running — flake. In the test-results DB this test passes overwhelmingly and fails rarely across unrelated SHAs (e.g. 1 fail / 413 runs on chrome, 0 fails on 410 chromium / 403 firefox / 414 webkit runs), including a failure on the unrelated PR feat(test-runner): add httpCache config option #41687 where this branch can't be responsible.

  • [chromium] › mcp/cli-navigation.spec.ts:43 › tab-new with url — flake. Same pattern: passes on the vast majority of runs and fails occasionally on unrelated SHAs (e.g. 2 fails / 413 chrome runs, 1 / 410 chromium, 0 on firefox/webkit), including a failure on the unrelated PR fix(webview): support input for elements inside cross-origin <iframe> #41463.

Neither test reaches the changed code: the diff is confined to registry/index.ts, serverRegistry.ts, cli-client/registry.ts, and browserFactory.ts (browser cache-directory resolution), plus a new browsers-path.spec.ts. The MCP dashboard/navigation paths don't depend on defaultCacheDirectory.

Triaged by the Playwright bot - agent run

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.

[Regression]: "PLAYWRIGHT_BROWSERS_PATH=0" no longer prevents evaluation of "defaultCacheDirectory" on Android/Termux

1 participant