Skip to content

fix(mutation): keep umask-setting tests out of Stryker's thread pool - #4782

Merged
thymikee merged 1 commit into
0.22from
fix/0.22-mutation-umask-tests
Nov 20, 2026
Merged

thymikee merged 1 commit into
0.22from
fix/0.22-mutation-umask-tests

Conversation

@thymikee

@thymikee thymikee commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

Summary

Setting process.umask(mask) throws in a worker thread, and Stryker's vitest runner runs tests in a thread pool. packages/host-kit/src/internal/script-destination-ancestry.test.ts (from main, carried into 0.22 by the rebase) sets the umask, so the dry run failed and every shard of the kernel-errors module stopped before a report. This blocked the Mutants checks on #4781.

threadHostileTestFiles in scripts/mutation/test-scope.ts already drops tests that use process.chdir (via the CLI capture harness) or start a worker thread. It now also drops tests that set the umask. Tests that only read it (process.umask()) stay in scope. A mutant only an excluded test could kill still shows as a survivor.

main carries the same test, so main needs the same change.

Validation

  • Head 29bfcfcb71 on 0.22 6534ef3869. pnpm check:affected --run --base origin/0.22 --head 29bfcfcb71 passed: 42 passed, 28 skipped, exact commit, unchanged checkout.
  • scripts/mutation/test-scope.test.ts asserts script-destination-ancestry and atomic-publish (set the umask) are excluded and archive-extraction (only reads it) is not.

Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

View guided diff Turn on auto-fix

Setting process.umask throws in a worker thread, so a test that sets it failed Stryker's dry run and stopped every shard of the module before a report. The thread-hostile exclusion now also drops tests that set the umask; tests that only read it stay in scope.
@github-actions

Copy link
Copy Markdown
Contributor

Size Report

Metric Base Current Diff
Installed (including dependencies) 6.17 MB 6.17 MB 0 B
Package (unpacked) 6.17 MB 6.17 MB 0 B
Package (download) 1.88 MB 1.88 MB 0 B

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 51.2 ms 63.5 ms +12.3 ms
CLI --help 95.8 ms 114.0 ms +18.2 ms

@apex-sentinel-staging

Copy link
Copy Markdown

Apex Sentinel · ✅ Approve · review of 29bfcfc

No open findings.

2 findings below minor hidden (user_settings.min_severity).

Reviewed with this repository's own Sentinel configuration (0b9186494f80).

💬 Talking to Sentinel

In a finding's thread, reply with:

Command What it does
@apex-sentinel-staging note <context> Adds context; Sentinel re-checks the cited code
@apex-sentinel-staging pivot <why> Says the finding is wrong; Sentinel re-checks the cited code
@apex-sentinel-staging like Marks the finding as useful
@apex-sentinel-staging dislike <why> Marks it as not useful, so it is not raised again

On this conversation, comment @apex-sentinel-staging review to run a full review once again.

@thymikee

Copy link
Copy Markdown
Member Author

This PR is ready at 29bfcfc. threadHostileTestFiles now also excludes tests that set the process umask, which throws inside Stryker's worker threads. The pattern matches process.umask(mask) but not the read-only process.umask(), and the test pins both sides with real files. Excluded tests still leave their mutants visible as survivors, so the score is not inflated. As the description says, main carries the same test and needs the same change.

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Nov 20, 2026
@thymikee
thymikee merged commit 9440141 into 0.22 Nov 20, 2026
17 checks passed
@thymikee
thymikee deleted the fix/0.22-mutation-umask-tests branch November 20, 2026 06:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-human Valid work that needs human implementation, judgment, or maintainer merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant