Repository navigation
test(mutation): pin the milestone list separator, isBotUser's login arm, createComment's message and skipReadOnlyForkRun's payload guards - #585
Conversation
…Comment's message and skipReadOnlyForkRun's payload guards A Stryker probe over the issue-comment, label and utility modules left nine behavioural survivors the unit suite reaches but never distinguishes from their mutations. Three new files pin them: - __tests__/issueCommentTest/milestoneAvailableList.test.ts: the not-found error joins the open milestones with ', ' (milestone.ts:66). - __tests__/utils/commentsGuards.test.ts: isBotUser accepts the github-actions[bot] login without a Bot type (comments.ts:67), createComment rewraps a refused post as 'could not add comment: ...' (comments.ts:34), and createCommentOnce honours a login-only bot marker. - __tests__/pullReqTest/readOnlyForkPayloads.test.ts: skipReadOnlyForkRun returns false rather than throwing on a payload without pull_request, head, repository or a string full_name (events.ts:23-25). Closes #584 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 |
There was a problem hiding this comment.
Read the three new test files against the sources they pin; this looks correct to me.
isBotUsertable matchessrc/utils/comments.ts:67-69exactly:user?.type === 'Bot' || user?.login === 'github-actions[bot]'makes{login:'github-actions[bot]'}with no/Usertype a bot, the baregithub-actionsprefix and{}/null/undefinednot. The 403 rewrap assertion matches thecould not add comment: ${e}wrap atcomments.ts:34.skipReadOnlyForkRunpayload cases matchsrc/utils/events.ts:23-25: any non-stringhead/basefull_name (including the numeric42) falls into thetypeof !== 'string'arm, returnsfalsewith no notice; the control case (differing names) returnstruewith one notice. Mock state across cases is safe —vitest.config.mjs:12-14setsclearMocks/mockReset/restoreMocks.- The milestone assertion matches
src/issueComment/milestone.ts:66-68(titles.join(', ')intoAvailable milestones: …), and theObserveRequeston the PATCH pins that no milestone is set.
Diff adds three test files only — no src/, dist/, or existing test edited, so the body's disjointness claim holds. All helpers used (failOnUnhandledRequest, ObserveRequest, MockContext, setupActionsEnv, mockResponse) exist in __tests__/testUtils.ts. CI is green on head 9221ac2. No findings; fine to land once a maintainer lifts the hold.
— hive: agent=reviewer backend=copilot model=claude-fable-5 copilot=1.0.88
|
/kind cleanup 🐝 Hive Agent: — hive: agent=quality backend=copilot model=claude-fable-5.1 copilot=1.0.88 |
Test Improvement
Pins nine behavioural Stryker survivors reported in #584, found by running #572's harness over the issue-comment, label and utility modules no earlier probe had covered (
main@ e3119ad, 643 mutants, 79 survived; the rest are equivalent, see the issue).Files / cluster claimed — three new test files; no
src/,dist/or existing test is edited, so this is disjoint from every held PR (#571 touchesretitle.test.ts,comments.test.ts,milestone.test.tsandreadOnlyFork.test.tsby one import line each; none of those files change here):__tests__/issueCommentTest/milestoneAvailableList.test.ts/milestone v3against three open milestones fails withAvailable milestones: v1, v2, backlogand issues no PATCH (milestone.ts:66,join(', '))__tests__/utils/commentsGuards.test.tsisBotUsertable —github-actions[bot]login with no type / withtype: 'User'is a bot,github-actionsprefix is not,{}/null/undefinedare not (comments.ts:67);createCommenton a 403 rejects with/^could not add comment: HttpError: Resource not accessible by integration/(comments.ts:34);createCommentOnceskips a marker comment whose user has only the login__tests__/pullReqTest/readOnlyForkPayloads.test.tsskipReadOnlyForkRunreturnsfalse, emits no notice and does not throw underpull_requestandpull_request_reviewfor a payload with nopull_request, nohead, norepository, nofull_name, or a numericfull_name; the control case with both names present still skips (events.ts:23-25)Re-running Stryker on those lines with the pins:
milestone.ts15/15 killed,events.ts28/28 killed,comments.ts31/33 killed (the two survivors are the equivalentbody ?? ''fallback at:58and the debug string at:59).Not pinned here:
retitle.ts:34(title === ''guard) — #571'sfailTestOnUnhandledRequestsonretitle.test.tskills it, so it is left to that PR.Checks run locally
npx vitest run __tests__/issueCommentTest/milestoneAvailableList.test.ts __tests__/utils/commentsGuards.test.ts __tests__/pullReqTest/readOnlyForkPayloads.test.ts→ 3 files, 17 tests passnpx eslinton the three files → cleanRelated Issue
Closes #584
Filed by quality agent (hold-gated mode). Human review required.
— hive: agent=quality backend=copilot model=claude-fable-5.1 copilot=1.0.88