From aa71e9afb575c3a900c0130567e5b3dd2680465b Mon Sep 17 00:00:00 2001 From: quality <280983584+hivecommons-hive[bot]@users.noreply.github.com> Date: Wed, 21 Oct 2026 19:17:36 -0400 Subject: [PATCH] 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> --- __tests__/bundle/blunderbussDelay.test.ts | 27 +++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/__tests__/bundle/blunderbussDelay.test.ts b/__tests__/bundle/blunderbussDelay.test.ts index b771bfe..e9d9c0b 100644 --- a/__tests__/bundle/blunderbussDelay.test.ts +++ b/__tests__/bundle/blunderbussDelay.test.ts @@ -227,6 +227,33 @@ describe('dist/index.js delayed blunderbuss', () => { expect(requested()).toEqual([]) }) + it('a second sweep leaves the reviewers the first one requested alone', async () => { + configure() + // The pull list reflects every reviewer request the fake has accepted so + // far, as GitHub's would once the first sweep's request lands. + gh.route('GET', new RegExp(`^${repo}/pulls\\?`), () => { + const reviewers = requested().flatMap(body => (body as { reviewers: string[] }).reviewers) + return { status: 200, body: [pull({ requested_reviewers: reviewers.map(login => ({ login })) })] } + }) + routeSweep() + + const first = await runSweep() + + expect(first.status, first.stdout).toBe(0) + expect(first.errors).toEqual([]) + expect(requested()).toEqual([{ reviewers: ['bob'] }]) + expect(reviewReads()).toHaveLength(1) + + const second = await runSweep() + + expect(second.status, second.stdout).toBe(0) + expect(second.errors).toEqual([]) + expect(second.stdout).toContain('sweep: #1 already has requested reviewers') + expect(requested()).toEqual([{ reviewers: ['bob'] }]) + expect(reviewReads()).toHaveLength(1) + expect(timelineReads()).toHaveLength(1) + }) + it.each([ ['3600', 'blunderbuss.delay must be a duration string such as 1h or 30m'], ['later', 'invalid blunderbuss.delay \'later\': expected a duration such as 5s, 2m or 500ms'],