Mutation gate job mixes its self-test's CI-format output lines with real findings

未关闭 适合新手
#2,717 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 3 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
68/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
github-actions, node.js, typescript

调研方向

阅读运行 pnpm test:mutation-ci 的自测步骤,以及 scripts/stryker-diff.mjs 中的输出处理。检查测试如何捕获并打印包含 GitHub 工作流命令语法的 fixture 输出,然后从建议的解决方法中选择一种:隔离自测、明确标记 fixture 行,或抑制通过的测试输出。完成标准是:通过的 gate 日志不再将 fixture 警告呈现为实际发现,同时失败的自测仍能提供有用的诊断信息。

由索引模型根据 Issue 内容生成。

描述

What happened

In a mutation-diff job log, four lines look like gate findings but come from the workflow's own passing test suite:

  • L1045 # ::warning title=Mutation test advisory::core Stryker preflight could not start: spawnSync /tmp/stryker-launch-Fw8RbA/node_modules/.bin/stryker ENOENT
  • L1046 # ::warning file=packages/core/src/value.ts,line=1,title=Mutation test advisory::packages/core/src/value.ts:1: Survived BooleanLiteral mutant (replacement: false). See the job summary for the complete list ...
  • L1048 # ::warning title=Mutation test advisory::Could not write the job summary: EISDIR: illegal operation on a directory, open '/tmp/stryker-summary-J1Taa7'
  • L1049 # ::warning title=Mutation test advisory::manifest advisory

All four sit inside the earlier step Run pnpm test:mutation-ci (its log group opens at L1028, its output ends at L1841), interleaved with its own fixture output - e.g. L1040 # Switched to a new branch 'feature'. Each of those strings occurs exactly once in the whole 1,894-line log.

The step that actually failed is the next one, L1842 Run BASE_SHA="$(git rev-parse "$HEAD_SHA^1")" followed by node scripts/stryker-diff.mjs ci --base "$BASE_SHA" --head "$HEAD_SHA". Its entire output is a single line:

L1852 Mutation gate failed: extension has 675 changed executable lines (limit 500). Split the PR or obtain a maintainer-reviewed narrow exclusion.
L1853 ##[error]Process completed with exit code 1.

So the ENOENT / EISDIR / Survived BooleanLiteral text is not the failure cause: it is the tool's own self-test talking in GitHub-workflow syntax, and it is describing its own fixtures. The only ##[error] in the whole log is the one above, after the sizing step; the self-test step produced none and the job proceeded past it, which is how we know those tests passed.

The synthetic survivor is another tell worth keeping in mind: packages/core/src/value.ts is not a file the pull request changes at all (the pull request in question touches 58 files and packages/core/* is not among them), yet the fixture prints a surviving mutant for it with line=1.

Why it matters

Two independent agent lanes read this same log and both mis-triaged it, in the same direction: one concluded "the red is a Stryker start defect (ENOENT + EISDIR), no cap was hit"; the other first mistook self-test titles such as fails rather than skipping a package over the changed-line cap for failure lines. Neither conclusion was reachable from annotations alone, and neither was reachable without re-reading the primary artifact and mapping ##[group] step boundaries. A reader who only looks at annotations is unaffected; a reader pointed at the job log - which is where a failing step sends everyone - is misled.

Measured limit of the damage: because those lines are printed with a # prefix, GitHub did not register them as annotations (the annotations endpoint for that check run returns exactly one item, the exit-code line). The cost is log legibility, not a wrong surface on the pull request.

Reproduction

Every run of the gate executes this self-test step first, so the fixture text is always in the log. Evidence pointers from one such run: job 139687440390 in run 45753763067 (log 148,723 B / 1,894 lines); the identical gate message and the identical count 675 appear on an earlier head of the same branch in job 133379246289 (2026-11-16).

What would fix it

Options in rough order of cost:

  1. Run the self-tests in their own job, or at least a step whose name makes their output obviously unrelated to findings.
  2. Stop the self-test harness from emitting workflow-command-shaped payloads (::warning title=...::...) into the step's stdout. The escaping that prevents annotation registration is already in place; what is missing is anything that marks those lines as fixture output rather than findings.
  3. Print self-test output only when it fails, so a green self-test step contributes nothing to the log a triager reads.

Source order, for whoever prices the gate

scripts/stryker-diff.mjs sizes the delta first (selectFromGit -> buildManifest, whose cap throw is at lines 265-269 with MAX_CHANGED_LINES = 500 at line 11) and only then launches Stryker (runManifest, invoked at line 858). The prefix Mutation gate failed: is printed only by the catch at line 865. That is why "Stryker never started" is a consequence of the size gate, not an independent defect - and it is the fact a log reader has to reconstruct from source today.

主要语言
TypeScript
星标
2k
派生
301
平均合并
3 天 14 小时
30 天内合并 PR
103

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

Zoo-Code-Org/Zoo-Code 的其他 Issue

查看 Zoo-Code-Org/Zoo-Code 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。