Repository navigation
test(bundle): drive /close, /reopen and /approve on an issue whose user is null through dist/index.js - #505
Open
hivecommons-hive[bot] wants to merge 1 commit into
Open
hivecommons-hive[bot] wants to merge 1 commit into
hivecommons-hive[bot] wants to merge 1 commit into
Conversation
…er is null through dist/index.js GitHub's issue schema types user as nullable-simple-user (a deleted account), so the ?.user?.login author shortcut in close.ts and reopen.ts and the ?? '' in approve.ts' require_self_approval check each carry a null arm. No bundle scenario sent an authorless issue, so approve.ts:94 was the last branch of src/issueComment/approve.ts that npm run test:coverage:e2e did not reach. The new file sends payload.issue.user = null through dist/index.js: /close and /reopen by a collaborator are decided by the collaborator read (and /close by a non-collaborator falls to authorization.close), and an issue_comment /approve with require_self_approval on is not refused as a self-approval and approves. Signed-off-by: quality <280983584+hivecommons-hive[bot]@users.noreply.github.com>
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 Hive will keep the |
Contributor
|
Please add a kind label with |
This was referenced Oct 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Test Improvement
Files claimed:
__tests__/bundle/nullIssueUser.test.ts(new, test-only). Functions:src/issueComment/approve.tsapproveByCoverage(line 94,issue?.user?.login ?? ''),src/issueComment/close.ts:33andsrc/issueComment/reopen.ts:30(theissue?.user?.loginauthor shortcut). Nosrc/,dist/or workflow change.GitHub's REST
issueschema typesuserasnullable-simple-user(@octokit/openapi-typestypes.d.ts:16085): an issue whose author's account was deleted arrives withuser: null. Every issue_comment bundle scenario builds its payload withcomment()orprCommentEvent(), both of which assignissue.user.login, so the null arm never ran throughdist/index.js. Atmain@1062ce7,npm run test:coverage:e2ereportssrc/issueComment/approve.tsat 96.15 % branches, line 94 uncovered — the file's last bundle-uncovered branch (unit: 100 / 100 / 100 / 100).Four cases, each sending
payload.issue.user = null:/closeby a collaborator: not the author, so the collaborator read decides;PATCH{ state: 'closed' }; request sequence asserted./closeby a non-collaborator: falls toauthorization.close(the configuration reads), nothing written./reopenby a collaborator: collaborator read, thenPATCH{ state: 'open' }./approvewithrequire_self_approval: trueby an OWNERS approver (alice): not refused as a self-approval,approvedis added and the notifier names her.Verification (local, this branch,
main@1062ce7+ this commit)npx vitest run __tests__/bundle/nullIssueUser.test.ts: 4 passed.npm run test:coverage:e2e: 491 → 495 tests;src/issueComment/approve.ts96.15 → 100 % branches,close.ts/reopen.ts100 %; suite branches 97.96 → 98.02 % (lines/functions/statements unchanged at 99.95 / 100 / 99.96).npm run test:coverage: 2124 passed, unchanged (unit does not run__tests__/bundlecoverage).npx eslinton the new file: clean.Related Issue
None: the hive's issue relay consolidated the finding into #499 twice (a false match on shared file names — #499 is the unit threshold floor, carried by #500), so this PR carries the finding itself. Disjoint from held PRs #497 (
src/plugins/approve.ts,meow.ts), #498 (tideOptionalFields.test.ts), #500/#502 (thresholds), #501 (docsYamlExamples.test.ts), #504 (githubApiUrlDefault.test.ts).Filed by quality agent (hold-gated mode). Human review required.
— hive: agent=quality backend=copilot model=claude-fable-5.1 copilot=1.0.88