Repository navigation
test(sweep): pin the delayed-reviewers OWNERS guard on a base branch without OWNERS files (sweep.ts:80) - #561
hivecommons-hive[bot] wants to merge 1 commit into
Conversation
…without OWNERS files Both suites left the false arm of the branchHasOwners guard ahead of requestReviewersIfDue in src/cronJobs/sweep.ts with zero hits: every delayed-blunderbuss case served an OWNERS file on master. Add one unit case and one dist/index.js scenario, each in its own file, that configure blunderbuss.delay, serve an empty master tree and a due pull request, and assert the tree is probed once while the timeline, reviews and requested_reviewers endpoints are never touched. Both fail when the guard is replaced by `|| true`. Fixes #560 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 |
There was a problem hiding this comment.
Read both new test files against src/cronJobs/sweep.ts at merge-base. The guard being pinned is real and the assertions match it:
sweep.ts:80-82: in the delayed-only loop,branchHasOwnersgatesrequestReviewersIfDue, so on an OWNERS-less base branch a due PR produces no timeline read, no reviews read, and norequested_reviewersPOST — exactly what both cases assert from opposite directions (unit:ObserveRequest.notCalledon served-but-unused handlers; bundle:requestsMatchingempty plus a whitelist of the only two non-config requests).- The fixtures (created/updated 70 min ago,
delay: 1h, default lookback) correctly land the PR indelayedOnly(updated_at < sinceatsweep.ts:69), so thesweep: 0 candidates updated since/sweep: 1 more checked for delayed reviewersstdout assertions line up withsweep.ts:70-73. sweepresolving{ candidates: [], …, failures: [] }is right: the skip is silent, not a failure (sweep.ts:80just falls through).
The mutation check in the body (|| true on the guard) is a genuine regressor for both cases. Not a duplicate of #558/#559 — both files are new and pin a different arm (guard false) than those PRs (window bounds, idempotence). Test-only, source unchanged, CI green. Looks correct to me.
— hive: agent=reviewer backend=copilot model=claude-fable-5 copilot=1.0.88
|
Consolidated into #589 (commit cherry-picked unchanged, author and DCO sign-off preserved). |
…solidates #555, #558, #559, #561, #562, #564-#567) (#589) * test: cover paginated OWNERS and review timelines Exercise approval authorization, automatic reviewer selection, and delayed reviewer timing across page boundaries. Hive-Run: #554 Hive-Plan: P2 cross-request contracts Hive-Spec: issue-554#P2-cross-request-contracts Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: mrbobbytables <mrbobbytables@users.noreply.github.com> * test(sweep): pin the inclusive due-window bounds and the timeline-read failure of delayed reviewers Add four cases to the 'sweep with blunderbuss.delay' block of __tests__/cronJobTest/sweep.test.ts, exercising requestReviewersIfDue's window checks at the exact instants and 1 ms past them, for created_at and for the last ready_for_review alike, and the failure path when the timeline read itself fails. Each boundary case fails on a one-character mutant of sweep.ts that the existing suite accepted: '>' to '>=' on the created_at early return, '<' to '<=' or '>' to '>=' on the shifted-window check. The failure case covers the catch in lastReadyForReview (previously unit-uncovered) and pins that the error is reported as a blunderbuss failure of that pull request while the other pull requests still get their reviewers. Signed-off-by: quality <280983584+hivecommons-hive[bot]@users.noreply.github.com> * test(sweep): pin that a second delayed sweep leaves the first run's requested reviewers alone The delayed-blunderbuss bundle suite modelled a pull that already had reviewers only as a static fixture. This drives dist/index.js through two successive sweeps against a fake whose pull list reflects the reviewer request the first sweep made, and asserts the second run neither re-reads the timeline or reviews nor requests reviewers again. Signed-off-by: quality <280983584+hivecommons-hive[bot]@users.noreply.github.com> * test(sweep): pin the delayed-reviewers OWNERS guard on a base branch without OWNERS files Both suites left the false arm of the branchHasOwners guard ahead of requestReviewersIfDue in src/cronJobs/sweep.ts with zero hits: every delayed-blunderbuss case served an OWNERS file on master. Add one unit case and one dist/index.js scenario, each in its own file, that configure blunderbuss.delay, serve an empty master tree and a due pull request, and assert the tree is probed once while the timeline, reviews and requested_reviewers endpoints are never touched. Both fail when the guard is replaced by `|| true`. Fixes #560 Signed-off-by: quality <280983584+hivecommons-hive[bot]@users.noreply.github.com> * test(sweep): pin the reviewer-key fallbacks of delayed blunderbuss on a bare pull listing (sweep.ts:208) requestReviewersIfDue reads requested_reviewers ?? [] and requested_teams ?? [] off the pull list entry, but no unit or bundle test listed a delayed-only pull request without those keys, leaving both fallback arms unreached in coverage/ and coverage-e2e/. Serve a due pull with the keys removed on both harnesses and assert reviewers are still requested. Signed-off-by: quality <280983584+hivecommons-hive[bot]@users.noreply.github.com> * test(owners): pin the fail-closed OWNERS group read when a later members page cannot be fetched (owners.ts:153-162) Let the real octokit paginator walk a team's Link headers instead of the stubbed paginate the existing group tests use. A page-one member is an approver once every page is read; when page two returns 500 the group contributes nobody, the run warns once naming the team, and the page-one member is denied without a fallback to organization membership. Signed-off-by: quality <280983584+hivecommons-hive[bot]@users.noreply.github.com> * test(sweep): pin the delayed-reviewers catch of sweep in its Error and 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> * test(sweep): pin the ignore_drafts=false arm of delayed reviewers (sweep.ts:218) With blunderbuss.delay set and ignore_drafts: false, requestReviewersIfDue must not skip drafts and must time every pull request from created_at alone, never reading the timeline. The unit suite only ever ran the delayed sweep with the default ignore_drafts: true, so that arm was reached by the bundle suite alone. Pins it in its own file so it does not collide with the pending edits to the delay block of sweep.test.ts. Signed-off-by: quality <280983584+hivecommons-hive[bot]@users.noreply.github.com> * test(sweep): pin the no-catch-up recovery of delayed reviewers after missed schedule runs After the schedule misses runs for longer than sweep.lookback, a pull request whose review clock expired before now - delay - lookback is neither listed, read nor requested by the delayed-reviewers step, and a longer sweep.lookback is what recovers it. Pinned in a unit suite (__tests__/cronJobTest/sweepDelayOutage.test.ts) and against dist/index.js (__tests__/bundle/blunderbussDelayOutage.test.ts); the blunderbuss.delay paragraph of docs/configuration.md now records the expectation. Refs #554 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: quality <280983584+hivecommons-hive[bot]@users.noreply.github.com> * test(harness): fail tide and sweep unit tests on unserved requests Completes the #571 wiring that was deferred while #557 and #558 occupied these files: both servers now answer the merge-queue read with noMergeQueue and assert at the end of each test that no request went unserved; sweep's OWNERS scenarios serve the base-branch tip instead of running through the 'could not read the tip' fallback. Refs #570 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Bob Killen <bkillen@linuxfoundation.org> --------- Signed-off-by: mrbobbytables <mrbobbytables@users.noreply.github.com> Signed-off-by: quality <280983584+hivecommons-hive[bot]@users.noreply.github.com> Signed-off-by: Bob Killen <bkillen@linuxfoundation.org> Co-authored-by: mrbobbytables <mrbobbytables@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: quality <280983584+hivecommons-hive[bot]@users.noreply.github.com>
Description
Pins the false arm of the
branchHasOwnersguard that precedesrequestReviewersIfDuein the delayed-reviewers loop ofsrc/cronJobs/sweep.ts(line 80): a pull request that is due for delayed blunderbuss but whose base branch carries no OWNERS files must be left alone — no timeline read, no review read, norequested_reviewerswrite.Files/functions claimed (both new, so #558
__tests__/cronJobTest/sweep.test.ts, #559 / #555__tests__/bundle/blunderbussDelay.test.ts, #553auth.ts, #556 e2e floor and #557tide.test.tsare untouched):__tests__/cronJobTest/sweepDelayWithoutOwners.test.tsblunderbuss.delay: 1h, emptymastertree, one PR created/updated 70 min agosweepresolves{ candidates: [], merged: [], enqueued: [], failures: [] };git/trees/masterread; timeline, reviews andrequested_reviewershandlers never called__tests__/bundle/blunderbussDelayWithoutOwners.test.tsdist/index.json thescheduleevent::error::,sweep: 0 candidates updated since,sweep: 1 more checked for delayed reviewers, exactly onegit/trees/master?recursive=trueread, zero timeline/review reads, zero non-GET requests, and the only non-config requests are the pull list and the tree readSource under test is unchanged.
Fixes #560
Mutation check
if (await branchHasOwners(...))→if (await branchHasOwners(...) || true)insrc/cronJobs/sweep.ts:sweep: 1 pull request(s) failed: #1 (blunderbuss: [MSW] Cannot bypass a request …)— the mutant reaches an endpoint the test deliberately does not servenpm run pack:coverage, run withPROW_BUNDLE_PATH=.coverage-bundle/index.js) fails:::error::… sweep: 1 pull request(s) failed: #1 (blunderbuss: could not read the timeline: HttpError: Not Found (fake))Before this PR the same mutant is accepted by all 46 cases of
sweep.test.tsand by the whole bundle suite.Coverage evidence
npm run test:coverageonmain@e3119ad(2330 tests, 99.92 % lines / 99.35 % branches):sweep.ts98.33 / 92.3;coverage/lcov.infohasBRDA:80,4,1,0. With this PR the same record readsBRDA:80,4,1,1.npm run test:coverage:e2eonmain@e3119ad(528 tests, 100 % lines / 99.46 % branches):sweep.ts100 / 94.87, uncovered80-85,208;coverage-e2e/lcov.infohasBRDA:80,4,1,0. With this PR it readsBRDA:80,4,1,1. Lines 85 and 208 are test(sweep): pin the inclusive due-window bounds and the timeline-read failure of delayed reviewers #558's and test(sweep): pin that a second delayed sweep leaves the first run's requested reviewers alone #559's and are not touched here.docs/contributing.md: their statement/branch maps come from different transforms and do not combine).Testing
npx vitest run __tests__/cronJobTest/sweepDelayWithoutOwners.test.ts— 1 passednpx vitest run __tests__/bundle/blunderbussDelayWithoutOwners.test.ts— 1 passed (against committeddist/index.js)npm run pack:coverage && PROW_BUNDLE_PATH=.coverage-bundle/index.js npx vitest run __tests__/bundle/blunderbussDelayWithoutOwners.test.ts— 1 passednpx eslinton both files — cleanChecklist
dist/change (tests only)Filed by quality agent (hold-gated mode). Human review required.
— hive: agent=quality backend=copilot model=claude-fable-5.1