[GH-ISSUE #3778] [Issue]: Playwright startup can crash an existing dev server while rebuilding shared #2037

Closed
opened 2026-10-21 05:44:48 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @Xelvanis on GitHub (Jul 18, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/3778

Originally assigned to: @SpicyMarinara on GitHub.

Summary

Running a Playwright smoke test while a normal pnpm dev session is active can crash the existing API server with ERR_MODULE_NOT_FOUND. Both development stacks share packages/shared/dist, and the Playwright-started stack removes that directory while rebuilding it.

Expected behavior

The isolated Playwright web server should be able to start on its configured test ports without disrupting an existing development server.

Actual behavior

The original server exits when it attempts to resolve @marinara-engine/shared during the second stack's rebuild window:

Error [ERR_MODULE_NOT_FOUND]: Cannot find module 'C:\Users\Melis\AppData\Local\MarinaraEngine\packages\server\node_modules\@marinara-engine\shared\dist\index.js' imported from C:\Users\Melis\AppData\Local\MarinaraEngine\packages\server\src\routes\chats.routes.ts

The workspace junction itself is valid. After the second shared build finishes, importing @marinara-engine/shared succeeds again, but the original server process has already exited.

Steps to reproduce

  1. From a source checkout with dependencies installed, run pnpm dev and wait for the server and client to start on the normal development ports.
  2. In another terminal, run a Playwright smoke test such as pnpm smoke:ui or pnpm exec playwright test <test-file> --project=desktop-chromium --workers=1.
  3. Observe the original API server terminate with ERR_MODULE_NOT_FOUND while the Playwright web server runs pnpm dev and rebuilds @marinara-engine/shared.

Environment

  • Marinara Engine version: 2.3.3, source checkout based on origin/staging
  • Install type: source
  • OS + version: Windows 11 Pro, 10.0.26200
  • Browser or app shell: Chromium via Playwright; Vite development server
  • Node.js: 24.15.0
  • pnpm: 10.33.2

Logs, screenshots, or video

Observed process timing:

  • Existing pnpm dev started at 20:22:09.
  • Playwright started its configured pnpm dev web server at 20:24:38 using the isolated ports.
  • packages/shared/dist/index.js was recreated at 20:24:41.
  • The original tsx watch server child disappeared after emitting the module-resolution error.

The relevant script behavior is:

  • Root pnpm dev always invokes build:shared before starting the server.
  • The shared package build first removes dist and then runs registry generation and tsc.
  • Playwright uses a distinct base URL, so reuseExistingServer does not reuse the ordinary development server and starts another pnpm dev process.

Additional context

Temporary workaround: stop the normal development server before running Playwright, then restart it afterward.

A durable fix should prevent the test startup build from destructively replacing the same shared output directory consumed by another running development server. An atomic build/output swap or a test-specific build path may avoid the race.

Template check

  • I DID NOT read this template and provide the requested details.
Originally created by @Xelvanis on GitHub (Jul 18, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/3778 Originally assigned to: @SpicyMarinara on GitHub. ## Summary Running a Playwright smoke test while a normal `pnpm dev` session is active can crash the existing API server with `ERR_MODULE_NOT_FOUND`. Both development stacks share `packages/shared/dist`, and the Playwright-started stack removes that directory while rebuilding it. ## Expected behavior The isolated Playwright web server should be able to start on its configured test ports without disrupting an existing development server. ## Actual behavior The original server exits when it attempts to resolve `@marinara-engine/shared` during the second stack's rebuild window: ```text Error [ERR_MODULE_NOT_FOUND]: Cannot find module 'C:\Users\Melis\AppData\Local\MarinaraEngine\packages\server\node_modules\@marinara-engine\shared\dist\index.js' imported from C:\Users\Melis\AppData\Local\MarinaraEngine\packages\server\src\routes\chats.routes.ts ``` The workspace junction itself is valid. After the second shared build finishes, importing `@marinara-engine/shared` succeeds again, but the original server process has already exited. ## Steps to reproduce 1. From a source checkout with dependencies installed, run `pnpm dev` and wait for the server and client to start on the normal development ports. 2. In another terminal, run a Playwright smoke test such as `pnpm smoke:ui` or `pnpm exec playwright test <test-file> --project=desktop-chromium --workers=1`. 3. Observe the original API server terminate with `ERR_MODULE_NOT_FOUND` while the Playwright web server runs `pnpm dev` and rebuilds `@marinara-engine/shared`. ## Environment - Marinara Engine version: 2.3.3, source checkout based on `origin/staging` - Install type: source - OS + version: Windows 11 Pro, 10.0.26200 - Browser or app shell: Chromium via Playwright; Vite development server - Node.js: 24.15.0 - pnpm: 10.33.2 ## Logs, screenshots, or video Observed process timing: - Existing `pnpm dev` started at 20:22:09. - Playwright started its configured `pnpm dev` web server at 20:24:38 using the isolated ports. - `packages/shared/dist/index.js` was recreated at 20:24:41. - The original `tsx watch` server child disappeared after emitting the module-resolution error. The relevant script behavior is: - Root `pnpm dev` always invokes `build:shared` before starting the server. - The shared package build first removes `dist` and then runs registry generation and `tsc`. - Playwright uses a distinct base URL, so `reuseExistingServer` does not reuse the ordinary development server and starts another `pnpm dev` process. ## Additional context Temporary workaround: stop the normal development server before running Playwright, then restart it afterward. A durable fix should prevent the test startup build from destructively replacing the same shared output directory consumed by another running development server. An atomic build/output swap or a test-specific build path may avoid the race. ## Template check - [ ] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-21 05:44:48 +07:00
  • closed this issue
  • added the
    in-pr
    label
Author
Owner

@SpicyMarinara commented on GitHub (Jul 18, 2026):

Addressed in #3779. The PR is ready for review, required CI checks are green, the two-stack Playwright reproduction passes without restarting the original API, and all CodeRabbit feedback has been applied.

<!-- gh-comment-id:5010985360 --> @SpicyMarinara commented on GitHub (Jul 18, 2026): Addressed in #3779. The PR is ready for review, required CI checks are green, the two-stack Playwright reproduction passes without restarting the original API, and all CodeRabbit feedback has been applied.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#2037
No description provided.