Skip to content

Make e2e server spawning work in a git worktree without a hand-made node_modules symlink #194

Description

@alexeygrigorev

Raw intake from PM acceptance of #192.

Two e2e specs spawn the test server through an absolute path into the repo-root
node_modules, which does not exist inside a git worktree checkout:

  • backend/e2e/frontend-module-characterization.spec.js:141
    spawn(path.join(ROOT, "node_modules", ".bin", "tsx"), ["scripts/test-server.ts"], …)
  • backend/e2e/planning-surfaces-design.spec.js:97
    spawn(path.resolve(__dirname, "..", "..", "node_modules", ".bin", "tsx"), …)

Both are pre-existing and were not modified by #192.

Why it matters

Every agent worktree under .tmp/worktrees/ is a real working tree without its
own node_modules, so both specs fail there with spawn … ENOENT before the
server ever starts. That is the standard pipeline layout: Software Engineer and
Tester both run the full e2e suite from a worktree. During #192 the engineer had
to hand-create node_modules -> /home/alexey/git/dataops/node_modules inside the
worktree just to run npm run test:e2e:backend, and the Tester had to keep that
symlink to reproduce. An untracked manual symlink is not a reproducible harness.

Two secondary consequences seen in #192:

  • .gitignore line 1 is node_modules/ with a trailing slash, which matches
    directories only, so the symlink shows up as ?? node_modules in
    git status and is one careless git add -A away from being committed.
  • backend/e2e/docs-outage.spec.js (added by Show a docs outage as an outage on the operations surfaces, not as an empty corpus #192) already uses
    spawn('npx', ['tsx', 'scripts/test-server.ts'], { cwd: BACKEND_ROOT }),
    which needs no symlink, so a working pattern already exists in the same
    directory.

Things to settle during grooming

  • Whether every spec that spawns a server should use one shared helper rather
    than three hand-rolled spawn call sites (docs-outage.spec.js also has its
    own startServer).
  • Whether npx tsx is the right resolution strategy, or a resolved
    require.resolve('tsx/cli')-style lookup that still works when the package
    lives in a parent directory.
  • Whether .gitignore should ignore node_modules without the trailing slash
    so a symlinked workaround cannot be staged accidentally, or whether the
    workaround should simply stop being necessary.
  • Whether CI is affected at all (it clones a normal repo with a real
    node_modules, so this is a local/worktree reproducibility problem, not a
    CI-red problem).

Verification hints

Reproduce by running npx playwright test e2e/frontend-module-characterization.spec.js
from backend/ inside a fresh git worktree with no node_modules symlink.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething is brokenneeds groomingRaw intake that needs PM groomingtestingTests and QA

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions