From 085959923376975d33bbb782f478f76268a973e5 Mon Sep 17 00:00:00 2001 From: quality <280983584+hivecommons-hive[bot]@users.noreply.github.com> Date: Sun, 8 Nov 2026 20:40:48 -0500 Subject: [PATCH] test(sweep): pin that a timeline without ready_for_review keeps the creation time as the review clock requestReviewersIfDue only moves the review clock forward when the timeline carries a ready_for_review event. Nothing in the suite failed when that guard was replaced by an unconditional assignment: every existing case either had the event or opened inside the due window, so an undefined clock slipped past both window checks and the pull request was handed reviewers. The new case opens the pull request long before the window, touches it inside, and serves a timeline with only a labeled event; it must be read once and request nobody. Signed-off-by: quality <280983584+hivecommons-hive[bot]@users.noreply.github.com> --- __tests__/cronJobTest/sweepDelayGuards.test.ts | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/__tests__/cronJobTest/sweepDelayGuards.test.ts b/__tests__/cronJobTest/sweepDelayGuards.test.ts index 0eb1d497..66332293 100644 --- a/__tests__/cronJobTest/sweepDelayGuards.test.ts +++ b/__tests__/cronJobTest/sweepDelayGuards.test.ts @@ -58,9 +58,10 @@ function json(body: unknown, status = 200) { return new Response(JSON.stringify(body), { status, headers: { 'Content-Type': 'application/json' } }) } -// Pins three guards of `requestReviewersIfDue` (src/cronJobs/sweep.ts) that +// Pins four guards of `requestReviewersIfDue` (src/cronJobs/sweep.ts) that // the other delayed-blunderbuss suites reach but never distinguish: the -// `ready_for_review` filter on the timeline, the draft skip before any +// `ready_for_review` filter on the timeline, a timeline without one leaving +// the creation time as the review clock, the draft skip before any // timeline read, and `explicit: false` carrying `ignore_authors` into the // delayed path. describe('sweep with blunderbuss.delay: guards of requestReviewersIfDue', () => { @@ -130,6 +131,18 @@ describe('sweep with blunderbuss.delay: guards of requestReviewersIfDue', () => expect(requested).toEqual([1]) }) + it('keeps the creation time as the review clock when the timeline has no ready_for_review', async () => { + // opened long before the due window and touched inside it; with nothing on the + // timeline to move the clock, the pull request was due an hour after it opened + // and is not due again now + servePulls([pull({ number: 1, createdMinutesAgo: 5 * 60, updatedMinutesAgo: 70 })]) + timeline[1] = [{ event: 'labeled', created_at: ago(10) }] + + await expect(sweep(context)).resolves.toEqual({ candidates: [], merged: [], enqueued: [], failures: [] }) + expect(timelineReads).toEqual([1]) + expect(requested).toEqual([]) + }) + it('leaves a draft alone before reading its timeline when ignore_drafts is on', async () => { servePulls([pull({ number: 1, createdMinutesAgo: 70, draft: true })]) timeline[1] = [{ event: 'ready_for_review', created_at: ago(70) }]