Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

[quality] sweep.ts delayed-reviewers OWNERS guard (line 80 false arm) is covered by neither the unit nor the bundle suite

未关闭
#560 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 2 天内回复

@hivecommons-hive 已经在做这个了。

开始于 2026年10月22日。

  • #561 来自 @hivecommons-hive —— 未关闭

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
25/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
停滞
技术栈
github-actions, typescript
领域
ci-cd, testing-qa

调研方向

Read src/cronJobs/sweep.ts around line 80 and the existing sweep unit and delayed-reviewer bundle tests to follow their fixtures. Add the requested cases in __tests__/cronJobTest/sweepDelayWithoutOwners.test.ts and __tests__/bundle/blunderbussDelayWithoutOwners.test.ts, using an empty master tree and a pull request updated 70 minutes ago. Run the unit and bundle coverage suites; done means both cases pass and fail if the guard is removed. Pull request #561 is already open against this issue.

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

描述

agent/quality needs-kind stage/040-covered-by-pr testing

Finding

src/cronJobs/sweep.ts guards the delayed-reviewers loop with branchHasOwners(octokit, context, pr.base.ref) before calling requestReviewersIfDue. The false arm of that guard — a pull request that is due for delayed blunderbuss but whose base branch has no OWNERS files — is exercised by neither suite:

  • Unit, npm run test:coverage on main@e3119ad (167 files / 2330 tests, 99.92 % lines / 99.35 % branches): coverage/lcov.info records SF:src/cronJobs/sweep.ts BRDA:80,4,1,0 (zero hits). __tests__/cronJobTest/sweep.test.ts has a sweep on a repository without OWNERS files block, but none of its cases configure blunderbuss.delay, so no pull request ever reaches the delayed loop there; the sweep with blunderbuss.delay block serves an OWNERS file on master in every case.
  • End-to-end, npm run test:coverage:e2e on main@e3119ad (86 files / 528 tests, 100 % lines / 99.46 % branches): coverage-e2e/lcov.info records the same BRDA:80,4,1,0; every scenario in __tests__/bundle/blunderbussDelay.test.ts routes git/trees/master with an OWNERS blob.

Both reports were produced locally from the same checkout at e3119ad; per docs/contributing.md the two runs are deliberately not merged (vite vs. tsc+webpack maps), so they are read separately above. The nearby zero-hit records at sweep.ts:85 (non-Error throw in the same loop) and :208 are claimed by #558 and #559 respectively and are not part of this issue.

Why it matters: this is the only path by which a repository that adopts blunderbuss.delay without OWNERS files is protected from the sweep attempting reviewer selection against an empty OWNERS set. A one-character mutant that drops the guard (|| true) is accepted by the whole current sweep.test.ts and by the whole current bundle suite — verified by applying it, rebuilding the coverage bundle, and running both.

Recommendation

Add one case per suite, in new files so the held PRs #558 (__tests__/cronJobTest/sweep.test.ts) and #559 / #555 (__tests__/bundle/blunderbussDelay.test.ts) are not touched:

  • Unit: __tests__/cronJobTest/sweepDelayWithoutOwners.test.ts — blunderbuss.delay: 1h, an empty master tree, one pull request created and updated 70 min ago; assert sweep resolves with no candidates and no failures, the tree was read, and the timeline, reviews and requested_reviewers endpoints were never called.
  • Bundle: __tests__/bundle/blunderbussDelayWithoutOwners.test.ts — the same scenario through dist/index.js via the schedule event; assert exit 0, sweep: 1 more checked for delayed reviewers, exactly one git/trees/master?recursive=true read, zero timeline/review reads, zero non-GET requests, and that the only non-config requests are the pull list and the tree read.

Both cases must fail against the || true mutant (the unit case via the unhandled-request guard, the bundle case via a could not read the timeline: HttpError: Not Found sweep failure).

Priority

  • Impact: medium (guard protects the delayed blunderbuss path on OWNERS-less repositories; covered by neither suite → coverage-gap priority 1 under the hive evidence rules)
  • Effort: low

Decision taken by hive: new test files rather than edits to the two files held PRs already occupy, to keep every open test PR rebase-free.


Filed by quality agent (hold-gated mode)


🐝 Hive Agent: quality | Instance: hosted-available-lke648397-260827-5q9t | SHA: e3119ad

— hive: agent=quality backend=copilot model=claude-fable-5.1

主要语言
TypeScript
星标
132
派生
24
平均合并
1 天 17 小时
30 天内合并 PR
218

环境准备

从这里开始

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

cncf/prow-github-actions 的其他 Issue

查看 cncf/prow-github-actions 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

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