Skip to content

Resolve backend E2E server launches through the installed TSX package #194

Description

@alexeygrigorev

Resolve backend E2E server launches through the installed TSX package

Status: pending
Tags: bug, backend, testing, P1
Depends on: None
Blocks: None

Scope

Make every backend Playwright server launch work in the standard agent worktree layout without a hand-created node_modules link.

Replace the current mix of repository-root .bin/tsx paths and npx tsx launches with one shared resolver in backend/e2e/helpers/. The resolver shall locate tsx/cli from backend/package.json using Node's normal dependency lookup and return:

[process.execPath, [resolvedTxCliPath, backendTestServerScript]]

Update all backend E2E users of scripts/test-server.ts to use it: global setup and the 11 specs that currently launch isolated servers. Keep each spec's own environment, readiness polling, and process teardown unchanged; this issue centralizes executable resolution only, not general server lifecycle management.

Also change the ignore pattern from node_modules/ to node_modules so an accidental symlink or file with that name cannot escape .gitignore.

The selected strategy is direct Node execution of a resolved tsx/cli entrypoint, not npx. It avoids dependence on shell lookup behavior while allowing dependencies installed at the enclosing workspace root to be discovered from a worktree beneath that checkout. Missing dependencies must fail loudly with a clear TSX/module-resolution error; do not add a fallback or auto-install behavior.

CI is unaffected: it runs npm ci, which installs the workspace dependencies normally.

Acceptance Criteria

  • No backend E2E code spawns npx tsx or a node_modules/.bin/tsx path to launch scripts/test-server.ts; all such launches use the shared resolver.
  • backend/e2e/global-setup.js and all isolated-server specs use the same resolved TSX launcher.
  • In a fresh detached Git worktree created beneath this checkout, with no worktree-local backend/node_modules, both formerly broken specs start their servers and pass.
  • The full backend E2E workflow passes in that same clean worktree.
  • git check-ignore -v node_modules matches the updated ignore rule.
  • No tracked compatibility shim, dependency installation fallback, or worktree-specific path remains.

Test Scenarios

Scenario: Standard agent worktree has no local backend dependencies

Given: main has Node workspace dependencies installed, and a detached worktree exists under .tmp/worktrees/ from that checkout.
When: verify that the worktree has no backend/node_modules, then from the worktree's backend/ run:

npx playwright test e2e/frontend-module-characterization.spec.js --reporter=line
npx playwright test e2e/planning-surfaces-design.spec.js --reporter=line

Then: both commands pass without spawn ... ENOENT, manual symlinks, or environment-specific setup.

Scenario: Complete backend browser suite

Given: the same clean worktree.
When: run:

npm --prefix backend run test:e2e

Then: the full Playwright workflow passes, including global setup/teardown and capability evidence collection.

Scenario: Ignore safety net

Given: the repository changes are checked out.
When: run:

git check-ignore -v node_modules

Then: Git reports the node_modules ignore rule.

Out of Scope

  • Consolidating readiness polling, environment construction, or stop/teardown logic into one server lifecycle abstraction.
  • Changing application runtime startup, CI installation, infrastructure, or deployed Lambda packaging.
  • Making arbitrary worktrees outside this checkout inherit dependencies from another checkout; those still need a normal dependency install.
  • Product UI or behavioral changes.

Dependencies

  • None. The enclosing checkout used to create standard worktrees must have completed its normal npm ci/dependency setup, as today.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1ImportantbackendBackend/APIbugSomething is brokentestingTests and QA

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions