Skip to content

pnpm mutate cannot finish on main: the data directory tests call process.umask() in a Stryker worker thread #1937

Done

Description

@V3RON

What happened

pnpm mutate cannot finish its first test run on unmodified main. Stryker runs every test file in a worker thread, and the the data directory tests call process.umask(), which Node refuses in a worker thread. The first run fails or times out, so no mutation result exists.

The calls: src/daemon/main.test.ts:197 and src/daemon/connection-host.test.ts:180 (at 6552987c6).

What you expected

pnpm mutate finishes on main with no local edit. vitest.mutate.config.ts already leaves out one test for the same reason (it sets process.env.TZ, which a worker thread ignores).

How to reproduce

On main, run pnpm mutate scoped to any changed range under src/daemon/. The first test run does not pass.

Environment

macOS, Node from .node-version, main at 6552987c6.

Logs and evidence

A refactor needs a mutation line in its PR body, so each delivery of a refactor meets this:

Found by the agent workflow review of 2026-11-27.

Written by an agent.

Activity

  1. added
    bug:new
    on Nov 28, 2026
  2. self-assigned this
    on Nov 28, 2026
  3. V3RON commented on Nov 28, 2026

    @V3RON
    ContributorAuthor

    Reproduction

    Defect, and wider than reported: 13 unit tests in 7 files fail in Stryker's pool, not 2. Twelve call process.umask(). One (history.test.ts, the JSON.stringify overflow) expects a stack overflow that a worker's larger stack does not hit. Outside the DOM files (#1938), nothing else in the mutation suite fails in threads (whole suite run, 9969 tests).

    src/mutate-pool.test.ts, "runs the tests that set the umask or overflow the stack, and passes them, in the pool Stryker runs it in", on bug/1937-repro. It runs those 7 files with vitest.mutate.config.ts in the pool stryker.config.mjs selects, and requires all 13 to pass, not be skipped.

    pnpm exec vitest run --project unit src/mutate-pool.test.ts
    AssertionError: expected { …(13) } to deeply equal { …(13) }
    -   "src/daemon/main.test.ts > the data directory creates a missing data directory owner-only, …": "passed",
    +   "src/daemon/main.test.ts > the data directory creates a missing data directory owner-only, …": "failed",
        (all 13 entries: "failed")
    TypeError: Setting process.umask() is not supported in workers
    

    Root cause

    stryker.config.mjs:4 sets vitest: { configFile } and no pool. The vitest runner defaults pool to threads (its schema, "default": "threads"). Every other lane runs these files in processes, where they pass: the same 7 files pass 140/140 with --pool forks. The tests are right. The pool is wrong. The TZ exclusion in vitest.mutate.config.ts:11-13 works around the same cause.

    Simplest fix

    Set pool: "forks" in stryker.config.mjs. Then drop the TZ testNamePattern and its comment, which become false. The clock-face test passes in forks.

    vitest: { configFile: "vitest.mutate.config.ts", pool: "forks" },
    

    Tried, then discarded: the repro, src/mutate.test.ts and src/test-lanes.repo.test.ts pass (28/28). ui/src/model/events.test.ts passes under the mutate config in forks (13/13).

    Alternatives rejected

    • Add the 13 tests to testNamePattern: their mode code then gets no mutation coverage, and the list keeps growing.
    • vmForks: the runner supports it, but nothing here needs a VM context.

    Risk

    • Not checked by a real Stryker run: the tool guard refuses pnpm mutate for agents. Confirm one scoped run finishes and that perTest coverage still works under forks.
    • A fork may cost more per mutant than a thread.

    Fast track

    • Defect: yes
    • Fix tried: yes
    • Nothing public added or broken: yes
    • No ADR or rule changed: yes
    • One fix: yes

    Side findings

    Written by an agent.

  4. removed their assignment
    on Nov 28, 2026
  5. added
    bug:ready
    fast-track
    and removed
    bug:new
    on Nov 28, 2026
  6. self-assigned this
    on Nov 28, 2026
  7. V3RON commented on Nov 28, 2026

    @V3RON
    ContributorAuthor

    Handoff

    Done: triage, fast track (bug:ready), build and audit on PR #1939 (pool: "forks" in stryker.config.mjs, TZ exclusion removed, src/mutate-pool.test.ts guards the pool). Review round 1 at 7971e0c.

    Not done: fix run, fix-check, gate.

    Findings: R1 open: src/mutate-pool.test.ts:42 says the umask cases skip on Windows, but five of the 13 run there (src/ports/filesystem.test.ts:62,151,194, src/history/history.test.ts:239). Narrow the skip and comment, or drop the skip.

    Blocked on: the review assessment is incomplete (REVIEW.md: stop and escalate). The claims lens could not read @stryker-mutator/vitest-runner in its worktree, so it did not verify "Stryker's default pool is threads"; it also did not check each PROCESS_ONLY title. The code lens confirmed both. The maintainer decides whether that coverage suffices, then re-runs /deliver #1937 for the fix run and fix-check.

    Written by an agent.

  8. added
    bug:blocked
    on Nov 28, 2026
  9. removed their assignment
    on Nov 28, 2026
  10. removed
    bug:ready
    on Nov 28, 2026
  11. V3RON commented on Nov 28, 2026

    @V3RON
    ContributorAuthor

    Delivery run

    Merged: none
    Parked: #1937 — review assessment incomplete (claims lens lacked a dependency); R1 open on PR #1939

    Written by an agent.

  12. V3RON commented on Nov 30, 2026

    @V3RON
    ContributorAuthor

    Maintainer decision (2026-11-30): the code lens's check of "Stryker's default pool is threads" is enough coverage for review round 1 of PR #1939. Continue with the fix run for R1, resolve the conflict with main and the red Windows check, then do the fix-check.

    Written by an agent.

  13. added
    bug:ready
    and removed
    bug:blocked
    on Nov 30, 2026
  14. self-assigned this
    on Nov 30, 2026
  15. V3RON commented on Nov 30, 2026

    @V3RON
    ContributorAuthor

    Handoff

    Done: main merged into PR #1939, R1's comment reworded (10cea7f). Audit: 1/1 green; the guard test is red without pool: "forks".

    Not done: a fix-check of 7971e0cd0..10cea7fd2, the gate.

    Findings: #1954 already set pool: "forks" on main. The PR now adds only src/mutate-pool.test.ts and a comment. deliver-step.mjs stores no commit or ledger from an incomplete review, so its fix-check prompt lacked both and the reviewer started no lens. R1's Windows skip stays, with a new comment; not reviewed. The red Windows check was a 20 s timeout in src/worktree-script.test.ts, outside the diff; not fixed, CI is running on the new head.

    Blocked on: the maintainer: close the PR, run a full round 1, or allow a fix-check prompt with the missing lines added.

    Written by an agent.

  16. added
    bug:blocked
    and removed
    bug:ready
    on Nov 30, 2026
  17. removed their assignment
    on Nov 30, 2026
  18. V3RON commented on Nov 30, 2026

    @V3RON
    ContributorAuthor

    Delivery run

    Merged: none
    Parked: #1937 — the fix-check had no reviewed commit or ledger and started no lens; main already has the pool fix (#1954)

    Written by an agent.

  19. V3RON commented on Nov 30, 2026

    @V3RON
    ContributorAuthor

    Fixed by #1954, which set pool: "forks" in stryker.config.mjs. The maintainer closed PR #1939, so no test guards that setting. A full pnpm mutate run was not checked; #1938 (console DOM tests) is still open.

    Written by an agent.

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

    bug:blockedfast-track

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions