Repository navigation
test(bundle): drive lgtmBinding's failure arms and /lgtm cancel's failed reads and writes through dist/index.js - #318
Conversation
…led reads and writes through dist/index.js
Adds __tests__/bundle/lgtmBindingArms.test.ts, which runs the shipped bundle
against the fake GitHub API for the arms the e2e suite never reached:
- /lgtm when POST /statuses/{sha} fails with 500 (refused, no label, the
sweep still runs), and when the refusal comment fails too
- /lgtm cancel when the labels read fails and when the removal is refused
- pull_request labeled lgtm when GET /commits/{sha}/status answers 500 or
403 (the 403 names statuses: write), when the stale-lgtm comment read
fails (stripped, warned, run passes), and on a payload with no head
e2e lines (npm run test:coverage:e2e): src/plugins/lgtmBinding.ts
88.63% -> 100%; src/labels/lgtm.ts 88.88% -> 97.77%.
Closes #317
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: quality <quality@hive.kubestellar.io>
|
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. Non-outreach agents are held at ACMM L3–L5; the Hive will keep the |
jeefy
left a comment
There was a problem hiding this comment.
Six of the eight cases add coverage.
- Drop
lgtmBindingArms.test.ts:64, or move itscomments()assertion into L81. L81 already reaches lgtm.ts:68 and lgtmBinding.ts:73. :152adds nothing only because:209doesn't stubGET commits/${head}/status. That 404 reaches the same non-403 branch (lgtmBinding.ts:117–118) and raises a second error the test never checks. Stub that read in:209so:152is the only case reaching that branch.- Minor:
:179says the failure is a warning, but the test only checks the text. Assert the::warning::prefix too.
…mment case, stub the status read in the headless case and assert the warning prefix Signed-off-by: quality <quality@hive.kubestellar.io>
|
Addressed all three: the non-permission bind-failure case is dropped and its 🐝 Hive Agent: — hive: agent=quality backend=copilot model=claude-fable-5.1 |
|
Addressed in 1f7d33c: the non-permission bind failure is folded into the failed-comment case (its CI is green on the new head. 🐝 Hive Agent: — hive: agent=quality backend=copilot model=claude-fable-5.1 copilot=1.0.88 |
|
/kind cleanup |
Test Improvement
Adds one file,
__tests__/bundle/lgtmBindingArms.test.ts(8 tests), which runs the shippeddist/index.jsagainst the fake GitHub API for the failure arms ofsrc/plugins/lgtmBinding.tsandsrc/labels/lgtm.tsthat no bundle suite reached:/lgtmby a member reviewer whenPOST /statuses/{sha}answers 500: refused withcould not bind lgtm to …(not the 403 permission hint), no label applied, and the post-command sweep still runs; and the same when the refusal comment itself fails (both errors logged, run fails)/lgtm cancelwhenGET /issues/1fails and whenDELETE /issues/1/labels/lgtmis refused: run fails naming the step, head never unboundpull_requestlabeledlgtm by a human whenGET /commits/{sha}/statusanswers 500 and 403: run fails naming the read (403 namesstatuses: write), nothing merged or strippedpull_requestlabeledlgtm by a bot when the stale-lgtm comment read fails: label stripped, status setpending, the comment failure is a warning, run passespull_requestlabeledlgtm on a payload with nopull_request.head: run fails, no status writtenNo production code,
dist/,helpers.ts,fakeGithub.tsor config changes.Coverage (
npm run test:coverage:e2e, main @ 3fc21f2)src/plugins/lgtmBinding.tssrc/labels/lgtm.tshandleIssueComment)Disjoint from the open bundle PRs: #289 routes only a successful
prow/lgtmstatus read, #310 covershandlePullReq'sjobsinput (onPrLgtm), #246 holdshelpers.ts/bundle.test.ts— none of them drive these arms.Related Issue
Closes #317
Filed by quality agent (hold-gated mode). Human review required.
— hive: agent=quality backend=copilot model=claude-fable-5.1 copilot=1.0.88