• wwwillchen-bot's avatar
    fix: use per-worker port for fake LLM server in parallel tests (#2557) · c337156d
    wwwillchen-bot 提交于
    ## Summary
    - Pass `fakeLlmPort` through `preLaunchHook` so each parallel worker
    uses its own fake LLM server instance
    - Dynamically generate webServer configs in `playwright.config.ts` based
    on parallelism setting
    - Allow fake-llm-server to accept port via command line argument
    (`--port=XXXX`)
    
    This ensures parallel Playwright tests don't conflict when accessing the
    fake LLM server.
    
    ## Test plan
    - [x] Lint checks pass
    - [x] All 784 unit tests pass
    - [ ] Run E2E tests in parallel to verify no port conflicts
    
    🤖 Generated with [Claude Code](https://claude.com/claude-code)
    <!-- devin-review-badge-begin -->
    
    ---
    
    <a href="https://app.devin.ai/review/dyad-sh/dyad/pull/2557"
    target="_blank">
      <picture>
    <source media="(prefers-color-scheme: dark)"
    srcset="https://static.devin.ai/assets/gh-open-in-devin-review-dark.svg?v=1">
    <img
    src="https://static.devin.ai/assets/gh-open-in-devin-review-light.svg?v=1"
    alt="Open with Devin">
      </picture>
    </a>
    <!-- devin-review-badge-end -->
    
    <!-- This is an auto-generated description by cubic. -->
    ---
    ## Summary by cubic
    Fixes parallel E2E conflicts by running a dedicated fake LLM server per
    Playwright worker and passing its port through preLaunchHook, env vars,
    and app/test URLs so all requests hit the worker’s server.
    
    - **Bug Fixes**
    - Compute per-worker fakeLlmPort (FAKE_LLM_BASE_PORT + parallelIndex),
    expose via preLaunchHook, set FAKE_LLM_PORT, and pass into PageObject,
    Settings, GitHubConnector; Azure tests use it for TEST_AZURE_BASE_URL.
    - Use worker-scoped URLs for Azure, GitHub test APIs, Ollama, LM Studio,
    Engine, Gateway, and OpenAI provider; Electron GitHub/Vercel handlers
    read FAKE_LLM_PORT instead of hardcoded 3500.
    - Generate one webServer per worker with build+start to avoid startup
    races; health checks target each worker; reuse servers locally; extract
    FAKE_LLM_BASE_PORT to e2e-tests/helpers/test-ports.ts.
    - fake-llm-server accepts --port or PORT with NaN validation; docs
    updated with parallel port isolation and rebase workflow notes.
    
    <sup>Written for commit 407923e90ddc9cf4d9ec98ccc56849154d2ad932.
    Summary will update on new commits.</sup>
    
    <!-- End of auto-generated description by cubic. -->
    
    ---------
    Co-authored-by: 's avatarWill Chen <willchen90@gmail.com>
    Co-authored-by: 's avatarClaude Opus 4.5 <noreply@anthropic.com>
    Co-authored-by: 's avatarclaude[bot] <41898282+claude[bot]@users.noreply.github.com>
    c337156d