Repository navigation
test(bundle): drive the non-Error String(e) arms of tide, mergeQueue, sweep, trigger and approveReview through dist/index.js - #548
Conversation
… sweep, trigger and approveReview through dist/index.js Octokit wraps every fetch rejection in a RequestError, so the per-plugin `e instanceof Error ? e.message : String(e)` and `'status' in e` folds in mergeOnce (tide.ts:137-138), queueState's errorMessage (mergeQueue.ts:190), sweepPullRequest's step catch (sweep.ts:132), rerunEach's statusOf (trigger.ts:323) and approveReview's errorStatus/errorMessage (approveReview.ts:226,230) had no e2e scenario. A NODE_OPTIONS preload hands the bundle one Response whose status getter throws a plain string, the one read @octokit/request makes outside its try/catch, so the string rejects the octokit call unwrapped. Five runs through dist/index.js assert the plugin reports the string unwrapped, takes its status-less arm, and the run neither hangs nor leaves an unhandled rejection. 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 |
mrbobbytables
left a comment
There was a problem hiding this comment.
Copilot review performed under the maintainer's explicit authorization to update, review, release reviewed holds, and merge eligible PRs in this cleanup.
The new scenarios cover distinct tide, mergeQueue, sweep, trigger and approveReview outcomes, including status-less failure behavior and no unintended writes. The preload is identical to #528 and is shared rather than duplicated at runtime.
Verified successful build-test, e2e-coverage and DCO results on head d596456. Any folded issue findings remain assigned to the canonical destinations in the updated scope tables.
…overage work landed (#556) Measured npm run test:coverage:e2e on main@e3119ad with #528, #537, #544, #548 and #549 merged: 100 / 99.46 / 100 / 100 (1686/1695 branches). The 97 floor set at 1062ce7 (97.96 measured) now sits 2.46 pp under main; 98 keeps the same just-under-main convention. 99 was considered and not taken: it would leave 8 branches of slack, two of which are already consumed by the negative-count await artifacts at approve.ts:504 and auth.ts:220 that no test can recover. Closes #551 Signed-off-by: quality <280983584+hivecommons-hive[bot]@users.noreply.github.com> Co-authored-by: quality <280983584+hivecommons-hive[bot]@users.noreply.github.com>
Test Improvement
npm run test:coverage:e2eonmain@ 88241f4 reports 99.96 % lines / 98.79 % branches, with 18 zero-hit branches after discounting the two negative-count v8 artifacts #511 documents. #528 drives three of theString(e)arms (events.ts:50, handleIssueComment.ts:217, labelSync.ts:107) and #544 v8-ignores the three that nothing in the bundle can reach (run.ts:40, command.ts:23, config.ts:657). This PR takes the seven per-plugin arms neither of them claims:mergeOnce'sstatusfold andString(e)src/plugins/tide.ts:137-138PUT /pulls/1/mergeon acheck_suiteerrorMessage'sString(e)src/utils/mergeQueue.ts:190POST /graphqlqueue-state read, then the direct-merge fallbacksweepPullRequest's step catchsrc/cronJobs/sweep.ts:132GET /pulls/1/reviews?per_page=1on a scheduled sweepstatusOf's non-object armsrc/issueComment/trigger.ts:323POST /actions/runs/1/rerun-failed-jobson/retesterrorStatus's non-object arm anderrorMessage'sString(e)src/plugins/approveReview.ts:226,230POST /pulls/1/reviewson/approvewithapprove.github_reviewOctokit wraps every fetch rejection in a
RequestError, so no fake-GitHub status can reach these arms. The preload hands the bundle oneResponsewhosestatusgetter throws a plain string —fetchResponse.statusis the first read@octokit/request'sfetchWrappermakes after itstry/catch— so the string rejects theoctokit.*call unwrapped. Each case asserts the plugin reports the string unwrapped (no[object), takes the arm a status-less failure takes (no 409 "head moved" skip, no 403 refusal comment, no::warning::on the approve review), that the faulted request still reached the fake and was recorded, and that the run neither hangs nor leaves an unhandled rejection.Files:
__tests__/bundle/nonErrorRejectionPluginArms.test.ts(new) — the five runs throughdist/index.js__tests__/bundle/nonErrorRejectionPreload.cjs(new) — byte-identical to the file test(bundle): cover non-Error rejection paths including auth #528 adds under the same path, so the two PRs merge cleanly in either order; whichever lands second adds nothing to it. The preload is one-shot and fails closed withoutNON_ERROR_REJECT.No
src/,dist/or docs change. Disjoint from every open hold PR: #528 namesevents.ts,handleIssueComment.tsandlabelSync.ts; #544 namesrun.ts,command.tsandconfig.ts; #510/#537 nameauth.ts:24andlgtm.ts:68; thetest(...)PRs #512–#547 are all unit suites under__tests__/<plugin>/, none under__tests__/bundle/.Verification (this branch, local)
npx vitest run __tests__/bundle/nonErrorRejectionPluginArms.test.ts(against committeddist/index.js): 5/5 passnpm run test:coverage:e2e: 84 files / 507 tests pass; e2e branches 98.79 % → 99.21 %;coverage-e2e/lcov.infono longer carries zero-hitBRDArecords attide.ts:137,tide.ts:138,mergeQueue.ts:190,sweep.ts:132,trigger.ts:323,approveReview.ts:226orapproveReview.ts:230npx eslinton both files: cleanNot in this PR
src/plugins/requireMatchingLabel.ts:167(${rule.missing_label}: ${e instanceof Error ? e.message : e}) is the one remaining zero-hitString(e)-shaped arm, and it is bundle-unreachable: every callapply()makes —labelIssue(could not add labels: …, labeling.ts:66),removeLabels(labeling.ts:185),createComment(comments.ts:34),botCommentsWithMarker(requireMatchingLabel.ts:245) anddeleteMissingComments(requireMatchingLabel.ts:233) — rewraps its rejection innew Error(...)first. A scenario faultingPOST /issues/1/labelswas written and dropped from this PR because the arm still readcould not add labels: <string>. It belongs to the #544 class (/* v8 ignore */on asrc/line), which this lane does not PR.Related Issue
None supplied for this kick; this PR is the finding and the fix for the seven branches it names.
Filed by quality agent (hold-gated mode). Human review required.
— hive: agent=quality backend=copilot model=claude-fable-5.1 copilot=1.0.88