[quality] Unit suite's call-through @actions/core emits workflow commands: green build-test runs carry 10 failure + 10 warning fixture annotations
维护者通常 1 天内回复
已经有一个关联 PR 被合并了。
- #605 来自 @hivecommons-hive —— 已合并
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 72/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- github-actions, typescript
调研方向
阅读共享的 Vitest 设置,以及配置 setupFiles 和 mockReset 的 Vitest 配置。添加 __tests__/setupQuietActionsCore.ts 并在那里注册,同时保留 @actions/core 的 spy,并在每个测试前将列出的输出函数重置为 no-op。运行 npx vitest run;当测试套件不再输出 workflow 命令行,且 fixture 输出不再创建 runner 注释时,即为完成。
由索引模型根据 Issue 内容生成。
描述
Finding
The suite's shared vitest setup file mocks @actions/core with vi.mock('@actions/core', { spy: true }), so the real implementation still runs under every spy. Its output functions (debug, info, warning, error, setFailed, setSecret, …) write ::debug::, ::warning::, ::error:: and ::add-mask:: lines straight to process.stdout, which bypasses vitest's console capture. Under GitHub Actions the runner parses those lines as workflow commands, so the unit suite's error-path fixtures drive the runner.
Evidence from a green run (build-test, job 121828647038, head 6bac9cc of #591, conclusion success), Run npm run test:coverage step:
| what the runner saw | count |
|---|---|
| step log lines | 16,255 |
##[debug] (from ::debug::; rendered because step debug was on) |
3,208 |
##[warning] (from core.warning) |
61 |
##[error] (from core.error / core.setFailed) |
18 |
::add-mask:: applied (meow's secret-key fixture, redacted for the rest of the log) |
1 |
GET /repos/cncf/prow-github-actions/check-runs/121828647038/annotations lists 10 failure and 10 warning annotations (the runner's per-step cap) on a passing run, all test fixtures: Cannot apply the lgtm label because Error: Codertocat is not a org member or collaborator, TypeError: error handling issue comment: …, encountered unexpected error: status=500, message=Internal Server Error, you cannot LGTM your own PR., each attributed to .github:<line>. The one genuine annotation in that run (an eslint jsdoc warning at src/issueComment/cc.ts:81) sits among them. core.setFailed also sets process.exitCode = 1 inside the vitest worker.
Locally, npx vitest run --reporter=dot at main @ 9acb046 printed 12,801 non-empty lines (2,946 ::debug::, 57 ::warning::, 17 ::error::; the rest is octokit's request-log console.error, which the default reporter already hides). The only real anomaly in the run — MaxListenersExceededWarning: 11 secureConnect listeners added to [TLSSocket], from @mswjs/interceptors 0.45.6 TlsSocketController.claim during meow.test.ts — is invisible among them and had not been noticed.
The bundle suite is unaffected (e2e-coverage on the same head carries only the runner's ubuntu notice): it runs dist/index.js in a child process and captures its output.
Recommendation
Keep the spies (tests assert core.warning / core.setFailed calls) but drop the writes: add a second setup file that, in beforeEach, installs a no-op implementation on the 14 @actions/core output functions (debug, info, warning, error, notice, setFailed, setSecret, setOutput, exportVariable, addPath, saveState, startGroup, endGroup, setCommandEcho). It has to be per test because the vitest config sets mockReset: true, which restores a spy's original implementation. getInput and the rest stay real.
Decision taken by hive: a new __tests__/setupQuietActionsCore.ts listed in setupFiles rather than an edit to the existing setup file, because held PR #595 already edits that file; the contributor guide is likewise left to the held PRs #595/#598/#599/#603 that edit it, and the rationale lives in the new file's header comment.
-
__tests__/setupQuietActionsCore.ts+ itssetupFilesentry in the vitest config;npx vitest runprints no::line andbuild-testruns carry no fixture annotations
Priority
- Impact: medium — every PR's Checks tab shows 20 fake failure/warning annotations and the test step log is dominated by fixture output, so a real
::error::or runtime warning is lost - Effort: low — one new 30-line setup file and one config line; 191 files / 2,473 tests pass unchanged with it
Filed by quality agent (hold-gated mode)
🐝 Hive Agent: quality | Instance: hosted-available-lke648397-260827-5q9t | SHA: b7ae47a
— hive: agent=quality backend=copilot model=claude-fable-5.1 copilot=1.0.88
- 主要语言
- TypeScript
- 星标
- 135
- 派生
- 24
- 平均合并
- 1 天 6 小时
- 30 天内合并 PR
- 232
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
cncf/prow-github-actions 的其他 Issue
-
agent/quality kind/cleanup stage/045-needs-decision testing
难度 3/5 1-2 天 新手友好度 15/100
cncf/prow-github-actions#672 · 1 条评论 ·
维护者通常 1 天内回复
-
[quality] chart: CronJob name exceeds the 52-character API limit for release names of 32+ characters; no test pins resource-name length可能已有人在做 @mrbobbytables 于 2 天前认领。 未关闭agent/quality kind/cleanup stage/040-covered-by-pr testing
难度 3/5 半天 新手友好度 50/100
cncf/prow-github-actions#667 ·
维护者通常 1 天内回复
-
hive/advisory kind/cleanup
难度 5/5 一周以上 新手友好度 15/100
cncf/prow-github-actions#170 · 9 条评论 ·
维护者通常 1 天内回复
查看 cncf/prow-github-actions 的全部 Issue
相似的 Issue
-
area: infrastructure bug priority: low
难度 2/5 1-3 小时 新手友好度 88/100
snapotter-hq/SnapOtter#4575 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 88/100
维护者通常 1 天内回复
-
documentation server-memory v2
难度 2/5 1-3 小时 新手友好度 68/100
modelcontextprotocol/servers#5457 ·
维护者通常 1 天内回复
-
comp: ssr comp: zones type: feature version: current (v17+)
难度 2/5 1-3 小时 新手友好度 84/100
angular/angularfire#3836 ·
维护者通常 3 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复