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
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.
Resolve backend E2E server launches through the installed TSX package
Status: pending
Tags:
bug,backend,testing,P1Depends on: None
Blocks: None
Scope
Make every backend Playwright server launch work in the standard agent worktree layout without a hand-created
node_moduleslink.Replace the current mix of repository-root
.bin/tsxpaths andnpx tsxlaunches with one shared resolver inbackend/e2e/helpers/. The resolver shall locatetsx/clifrombackend/package.jsonusing Node's normal dependency lookup and return:Update all backend E2E users of
scripts/test-server.tsto 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/tonode_modulesso an accidental symlink or file with that name cannot escape.gitignore.The selected strategy is direct Node execution of a resolved
tsx/clientrypoint, notnpx. 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
npx tsxor anode_modules/.bin/tsxpath to launchscripts/test-server.ts; all such launches use the shared resolver.backend/e2e/global-setup.jsand all isolated-server specs use the same resolved TSX launcher.backend/node_modules, both formerly broken specs start their servers and pass.git check-ignore -v node_modulesmatches the updated ignore rule.Test Scenarios
Scenario: Standard agent worktree has no local backend dependencies
Given:
mainhas 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'sbackend/run: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:
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:
Then: Git reports the
node_modulesignore rule.Out of Scope
Dependencies
npm ci/dependency setup, as today.