Skip to content

test(sweep): pin the inclusive due-window bounds and the timeline-read failure of delayed reviewers - #558

Open
hivecommons-hive[bot] wants to merge 1 commit into
mainfrom
quality/test-sweep-delay-boundaries
Open

hivecommons-hive[bot] wants to merge 1 commit into
mainfrom
quality/test-sweep-delay-boundaries

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Test Improvement

Adds four cases to the sweep with blunderbuss.delay block of __tests__/cronJobTest/sweep.test.ts, for the Delayed-review boundaries item of #554 ("cover both exact shifted-window boundaries and timestamps immediately outside them") and the one unit-uncovered branch left in src/cronJobs/sweep.ts.

Files/functions claimed: __tests__/cronJobTest/sweep.test.ts only (serve gains an optional config argument; four new it cases). Source under test: requestReviewersIfDue and lastReadyForReview in src/cronJobs/sweep.ts. Disjoint from #553 (auth.ts), #555 (__tests__/bundle/*), #556 (e2e floor) and #557 (tide.test.ts).

case pull requests asserts
opened exactly at due.to, and 1 ms later created = now-60m / now-60m+1ms #1 requested, #2 not; #2 decided from created_at alone (no timeline read)
opened exactly at due.from, and 1 ms earlier created = now-90m / now-90m-1ms (listed because updated inside the window) #1 requested, #2 not; #2's timeline is read
last ready_for_review at due.to, due.to+1ms, due.from, due.from-1ms four former drafts exactly #1 and #3 requested
timeline read returns 500 #1 (needs the timeline), #2 (due) run fails with #1 (blunderbuss: could not read the timeline: HttpError: Server Error); #2 still gets reviewers

The boundary cases use sweep.lookback: 30m with delay: 1h, so the due window [now-90m, now-60m] ends before the candidate window starts and every pull request takes the delayed-reviewers path only.

Why these, per #554's "justify by mutation, not percentage"

Each one-character mutant below was applied to src/cronJobs/sweep.ts and run against the whole sweep.test.ts; the listed new case is the only one that fails, so the prior 42 cases accepted it:

mutant killed by
start > due.to → >= (early return, line 214) "opened exactly at the end of the due window"
start < due.from → <= (line 224) "opened exactly at the start…", "times the last ready_for_review…"
start > due.to → >= (line 224) "opened exactly at the end…", "times the last ready_for_review…"
catch in lastReadyForReview → events = [] (line 244) "reports a failed timeline read…"

Coverage evidence

  • Unit, npm run test:coverage on main@e3119ad (2330 tests, 99.92 % lines / 99.35 % branches): sweep.ts 98.33 / 92.3, uncovered 85,244. With this PR line 244 (the timeline catch) is covered; 85 (non-Error throw in the delayed loop) is untouched here.
  • End-to-end, npm run test:coverage:e2e on main@e3119ad (528 tests, 100 % / 99.46 %): sweep.ts 100 / 94.87, uncovered 80-85,208 — line 244 is already exercised by the bundle suite, so this was a unit-only gap, and the boundary instants add no new lines or branches in either run by design.

Verification

  • npx vitest run __tests__/cronJobTest/sweep.test.ts — 46 passed
  • npx eslint __tests__/cronJobTest/sweep.test.ts — clean

Related Issue

Refs #554 — ticks only the "Delayed-review boundaries" box of the P2 cross-request section. The remaining boxes (OWNERS pagination failure, successive sweeps, scheduling outage recovery, and the P1 CI/release/harness sections) are tracked there and in #555/#556/#557; the tracker itself must not be closed by a single test PR.


Filed by quality agent (hold-gated mode). Human review required.

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

…d 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>
@hivecommons-hive
hivecommons-hive Bot requested a review from jpmcb as a code owner October 21, 2026 21:16
@hivecommons-hive hivecommons-hive Bot added the hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 21, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

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 outreach PR that targets a repository this hive does not manage is held at every level because it publishes project-facing communication into someone else's project.

Hive will keep the hold label until a human removes it. Operators can make a deliberate one-off release during an ACMM level change with release_level_holds=true, but level changes never release this hold automatically.

@github-actions

Copy link
Copy Markdown
Contributor

Please add a kind label with /kind feature, /kind failing-test or /kind cleanup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hold Indicates that a PR should not merge because someone has issued a /hold command. needs-kind

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants