Repository navigation
test(sweep): pin the delayed-reviewers catch of sweep in its Error and String(e) arms (sweep.ts:85) - #565
test(sweep): pin the delayed-reviewers catch of sweep in its Error and String(e) arms (sweep.ts:85)#565hivecommons-hive[bot] wants to merge 1 commit into
Conversation
…d String(e) arms (sweep.ts:85) Adds __tests__/cronJobTest/sweepDelayFailures.test.ts: two due delayed-only pull requests on a base branch with OWNERS, where one fails. A 500 on the reviews read is recorded as that pull request's `blunderbuss:` failure while the other still gets its reviewer request; a non-Error rejection of requestOwnersReviewers is stringified the same way. Before: coverage/lcov.info BRDA:85,5,0,0 / BRDA:85,5,1,0 (neither arm hit by the unit suite). After: both 1; sweep.ts branches 92.3 -> 94.87 %. Signed-off-by: quality <280983584+hivecommons-hive[bot]@users.noreply.github.com>
|
Important Held for human review by the hive's ACMM level gate. This PR was opened by the "quality" agent while Hive policy required a human checkpoint for that agent. Agent PRs are held at ACMM L3–L5; an Hive will keep the |
|
/kind cleanup 🐝 Hive Agent: — hive: agent=quality backend=copilot model=claude-fable-5.1 copilot=1.0.88 |
Test Improvement
Adds
__tests__/cronJobTest/sweepDelayFailures.test.ts(new file; no existing test is edited) for thecatchof the delayed-reviewers loop insweep(src/cronJobs/sweep.ts, line 85 atmain@e3119ad):result.failures.push({ number, message: \blunderbuss: ${e instanceof Error ? e.message : String(e)}` })`.Two due delayed-only pull requests (
created_at/updated_at70 min ago,blunderbuss.delay: 1h) on a base branch with an OWNERS file, where one of them fails:GET /pulls/1/reviews→ 500{ message: 'reviews unavailable' }sweeprejects withsweep: 1 pull request(s) failed: #1 (blunderbuss: reviews unavailable);POST /pulls/2/requested_reviewerswas still made and nothing was posted for #1requestOwnersReviewersrejects once with the string'secondary rate limit'(vi.mock('../../src/plugins/blunderbuss', { spy: true }), the technique of__tests__/utils/configSweep.test.ts)blunderbuss: secondary rate limit; the other pull request was still requested;requestOwnersReviewerswas called twiceThe first case also pins that the loop continues past a failing pull request instead of aborting (
forEachLimited+ per-itemtry/catch).Files/functions claimed:
__tests__/cronJobTest/sweepDelayFailures.test.tsonly; source under test is the delayed-onlyforEachLimitedbody ofsweep. Disjoint from #553 (auth.ts), #555/#559 (__tests__/bundle/blunderbussDelay.test.ts), #556 (e2e floor), #557 (tide.test.ts), #558 (__tests__/cronJobTest/sweep.test.ts, which states line 85 is out of its scope), #561 (line 80, newsweepDelayWithoutOwnersfiles), #562 (line 208, newsweepDelayBareListingfiles), #563 (config.ts), #564 (owners.ts).Coverage evidence
npm run test:coverageonmain@e3119ad(2330 tests, 99.91 % lines / 99.35 % branches):coverage/lcov.infoBRDA:85,5,0,0andBRDA:85,5,1,0— neither arm reached;sweep.ts98.33 / 92.3, uncovered85,244. With this PR (2332 tests): bothBRDA:85,5,*,1;sweep.ts99.16 / 94.87, uncovered244(that is test(sweep): pin the inclusive due-window bounds and the timeline-read failure of delayed reviewers #558's timeline-read case); all files 99.35 → 99.46 % branches.npm run test:coverage:e2eonmain@e3119ad(528 tests, 100 % / 99.46 %):coverage-e2e/lcov.infoBRDA:85,5,0,1/BRDA:85,5,1,0— the Error arm is hit once by the bundle suite, theString(e)arm never. This PR adds no bundle scenario: octokit only ever rejects withRequestError, so theString(e)arm is bundle-unreachable; whether tov8 ignoreit for the e2e run as chore(coverage): v8-ignore lgtm.ts's unreachable String(e) arm after bindLgtm (bindLgtm only ever throws Error) #537/chore(coverage): v8-ignore the bundle-unreachable fallback arms in run.ts:40, command.ts:23 and config.ts:657 #544/chore(coverage): v8-ignore requireMatchingLabel's bundle-unreachable non-Error arm at the rule loop's catch #549 did is a production-file change outside this test PR.vitest.e2e-coverage.config.mjs).Related Issue
Refs #560 — lands the folded
sweep.ts:85variant the hive attached to that tracker (comment<!-- hive-finding-folded -->of 2026-10-22); the tracker's originalsweep.ts:80finding is delivered by #561 and the folded:208variant by #562, so #560 stays open until those merge.Tests
npx vitest run __tests__/cronJobTest/sweepDelayFailures.test.ts— 2 passed, no::warning::outputnpx eslint __tests__/cronJobTest/sweepDelayFailures.test.ts— cleannpm run test:coverage— 2332 passed, 75 skipped; thresholds metFiled by quality agent (hold-gated mode). Human review required.
— hive: agent=quality backend=copilot model=claude-fable-5.1