ci: webviews dev server files run at once, each on its own warm Vite cache (no bead)

Merged
TE
25d ago
+186-26

Summary

#19812 fixed a race: files that start a Vite dev server shared one node_modules/.vite, and two running at once lost each other's optimized files. To fix it, #19812 ran all 41 of those files one at a time after the rest, and the web test phase went from 7m18s to 9m44s. This PR keeps them off any shared cache but runs them in parallel again:

  • Cache per process: the dev configs (vite.config.ts and therefore gallery-dev, vite.config.acpmux-pane.mjs, vite.config.settings-page.mjs) take cacheDir from CMUX_VITE_CACHE_DIR (dev-server/viteCacheDir.mjs). When it's unset, they keep Vite's default.
  • Warm, then copy:
    • run-webviews-tests.sh first runs one file per Vite config (pane, gallery, settings, default), alone. Each warms its config's own cache.
    • The remaining files then run CMUX_WEB_TEST_DEV_JOBS at once (default: half the jobs, 4 on react-apps-check).
    • Each runs on its own copy of its config's warm cache, deleted when it finishes.
    • No two processes ever share a cache, and none starts the cold first bundle beside another. Three cold starts at once was the stall the old comment describes.
  • Fallback: if a config's warming file fails, its cache can't be trusted, so that config's other files run one at a time on cold caches.

Testing

  • python3 tests/test_webviews_tests_per_file.py. The fake bun records each dev server file's cache, whether it found its config's warm marker, and how many ran at once.
    • Red on 982afd90b6aa: test_dev_server_files_run_at_once_each_on_its_own_warm_vite_cache failed. All 9 files shared one cache (1 != 9).
    • Green: 6 tests OK.
  • shellcheck is clean.
  • The real effect, the web phase wall time, is measured by this PR's react-apps-check. Numbers are in the comment below.

Changelog

none

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.


Summary by cubic

Restores parallel execution for webviews test files that start a Vite dev server, which #19812 had serialized to fix a race on the shared node_modules/.vite cache at the cost of 2.5 extra minutes on the web test phase.

  • Every dev config a test serves now optimizes into the cache CMUX_VITE_CACHE_DIR names via dev-server/viteCacheDir.mjs, and the dev server plugin prefers it over its per-port cache, which had been overriding vite.config.ts and leaving default-config files to start cold. A new test resolves each config and asserts its cacheDir.
  • run-webviews-tests.sh runs one warming file per config alone, then the remaining dev-server files run CMUX_WEB_TEST_DEV_JOBS at once (default a quarter of the jobs; half was CPU bound on the 8-core runner and broke frame-budget and attach-timing tests), each on its own copy of that config's warm cache, deleted when the file finishes. Files that call createServer now count as dev server files, and failed cache copies or cleanups no longer stop the lane.
  • A config whose warming file fails runs its other files one at a time on cold caches.