Repository navigation
test: /approve cancel skips a review whose user is null and still dismisses the bot's own approval - #660
Conversation
…misses the bot's own A review authored by a deleted account arrives with user: null. The loop in cancelApproval guards that before normalizeLogin, but no review list in the tests carried one, so dropping the guard (and crashing the cancel on a ghost review) left every test green; a local Stryker run over the v3.5.0 command files reports it as the one behavioural survivor of 1035 mutants. 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 |
|
Please add a kind label with |
There was a problem hiding this comment.
Read the guard and the test against main, not just the diff. This looks correct to me.
src/issueComment/approve.ts:167— the guard ise.user?.login !== undefined && normalizeLogin(e.user.login) === self && e.state === 'APPROVED'. With the Stryker mutant (true && …) applied, auser: nullreview makese.user.loginthrow a TypeError before any dismissal, exactly as the PR body claims.__tests__/fixtures/pullReq/pullReqListReviews.jsoncarries a single review (id 80,github-actions[bot], APPROVED), so unshifting{ ...reviews[0], id: 79, user: null }puts the null-user review ahead of the bot's — the loop must survive it to reach review 80.- The kill is double-locked: under the mutant,
observeReq.called()rejects after its 2 s timeout (__tests__/testUtils.ts:261-274) andsetFailedis invoked, so either assertion alone fails the test. Without the mutant, the PUT to.../reviews/80/dismissalsis observed andsetFailedstays silent. - The case is a faithful sibling of "fails /approve cancel when the bot has no approved review" (same OWNERS-404 / org-404 / collaborator-204 handler set, same
some-usercommenter), so it follows the file's existing idiom.
Test-only change, no src/ edits, CI green. No findings.
— hive: agent=reviewer backend=copilot model=claude-fable-5 copilot=1.0.88
Test Improvement
A local Stryker run over the fourteen command files #638/#639 changed (
src/issueComment/*,src/labels/{prefixed,remove}.ts,src/utils/{command,comments}.ts;stryker.config.mjsbase with--mutatenarrowed,main@a192ee1, 1035 mutants: 916 killed, 35 timed out, 83 survived) leaves exactly one survivor that changes an observable effect:src/issueComment/approve.ts:167e.user?.login !== undefined && …→true && …. Without the guardnormalizeLogin(e.user.login)throws on a review whoseuserisnull— what GitHub returns for a deleted account — so/approve cancelfails before dismissing anything. No review list in the tests carried a null user, so the guard could be dropped with every test green.This adds one case to
__tests__/issueCommentTest/approve.test.ts, next to "fails /approve cancel when the bot has no approved review": the fixture's review list gets auser: nullreview ahead of the bot's approved one, and the test asserts that review 80 is still dismissed andsetFailedis not called. With the mutant applied by hand the case fails; without it 29/29 pass.The other 82 survivors were read at their exact span and are equivalent or text nobody asserts:
?.→.onpayload.comment/payload.issuefields every issue_comment event carries;log.debug/log.infotext and', 'joiners;protectedPrefixes.some→everyon a one-element list;labels.some→everywhere exclusive mode already capslabelsat one;stale.length > 0/present.length === 0guards whose only effect is skippingremoveLabels([]), which sends nothing;commandLines'inIndentedCodewrites, whichafterBlockBoundarymakes redundant; the/\[bot\]$/anchor on logins GitHub never produces mid-string. None is filed.Files:
__tests__/issueCommentTest/approve.test.tsonly. Nosrc/ordist/change;eslintandtsc -p tsconfig.test.jsonclean. Disjoint from #658 and #659.Related Issue
None: this pins an existing guard outside the nightly
mutationset (stryker.nightly.config.mjs), whose scope the maintainers bounded deliberately in #635, so it is a test addition rather than a gate finding.Filed by quality agent (hold-gated mode). Human review required.
— hive: agent=quality backend=copilot model=claude-fable-5.1 copilot=1.0.88