Skip to content

test(bundle): drive the non-Error String(e) arms of tide, mergeQueue, sweep, trigger and approveReview through dist/index.js - #548

Merged
mrbobbytables merged 1 commit into
mainfrom
quality/test-non-error-plugin-arms
Oct 21, 2026
Merged

mrbobbytables merged 1 commit into
mainfrom
quality/test-non-error-plugin-arms

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Test Improvement

npm run test:coverage:e2e on main @ 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 the String(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:

arm site what rejects with a string
mergeOnce's status fold and String(e) src/plugins/tide.ts:137-138 PUT /pulls/1/merge on a check_suite
errorMessage's String(e) src/utils/mergeQueue.ts:190 the POST /graphql queue-state read, then the direct-merge fallback
sweepPullRequest's step catch src/cronJobs/sweep.ts:132 blunderbuss's GET /pulls/1/reviews?per_page=1 on a scheduled sweep
statusOf's non-object arm src/issueComment/trigger.ts:323 POST /actions/runs/1/rerun-failed-jobs on /retest
errorStatus's non-object arm and errorMessage's String(e) src/plugins/approveReview.ts:226,230 POST /pulls/1/reviews on /approve with approve.github_review

Octokit wraps every fetch rejection in a RequestError, so no fake-GitHub status can reach these arms. The preload hands the bundle one Response whose status getter throws a plain string — fetchResponse.status is the first read @octokit/request's fetchWrapper makes after its try/catch — so the string rejects the octokit.* 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 through dist/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 without NON_ERROR_REJECT.

No src/, dist/ or docs change. Disjoint from every open hold PR: #528 names events.ts, handleIssueComment.ts and labelSync.ts; #544 names run.ts, command.ts and config.ts; #510/#537 name auth.ts:24 and lgtm.ts:68; the test(...) 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 committed dist/index.js): 5/5 pass
  • npm run test:coverage:e2e: 84 files / 507 tests pass; e2e branches 98.79 % → 99.21 %; coverage-e2e/lcov.info no longer carries zero-hit BRDA records at tide.ts:137, tide.ts:138, mergeQueue.ts:190, sweep.ts:132, trigger.ts:323, approveReview.ts:226 or approveReview.ts:230
  • npx eslint on both files: clean

Not in this PR

src/plugins/requireMatchingLabel.ts:167 (${rule.missing_label}: ${e instanceof Error ? e.message : e}) is the one remaining zero-hit String(e)-shaped arm, and it is bundle-unreachable: every call apply() makes — labelIssue (could not add labels: …, labeling.ts:66), removeLabels (labeling.ts:185), createComment (comments.ts:34), botCommentsWithMarker (requireMatchingLabel.ts:245) and deleteMissingComments (requireMatchingLabel.ts:233) — rewraps its rejection in new Error(...) first. A scenario faulting POST /issues/1/labels was written and dropped from this PR because the arm still read could not add labels: <string>. It belongs to the #544 class (/* v8 ignore */ on a src/ 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

… 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>
@hivecommons-hive
hivecommons-hive Bot requested a review from jpmcb as a code owner October 21, 2026 10:59
@hivecommons-hive hivecommons-hive Bot added the hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 21, 2026
@hivecommons-hive

Copy link
Copy Markdown
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 outreach PR that targets a repository this hive does not manage is held at every level because it publishes project-facing communication into someone else's project.

Hive will keep the hold label until a human removes it. Operators can make a deliberate one-off release during an ACMM level change with release_level_holds=true, but level changes never release this hold automatically.

@github-actions

Copy link
Copy Markdown
Contributor

Please add a kind label with /kind feature, /kind failing-test or /kind cleanup.

@mrbobbytables mrbobbytables left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@mrbobbytables mrbobbytables added kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. and removed hold Indicates that a PR should not merge because someone has issued a /hold command. needs-kind labels Oct 21, 2026
@mrbobbytables
mrbobbytables merged commit 274c731 into main Oct 21, 2026
17 checks passed
mrbobbytables pushed a commit that referenced this pull request Oct 26, 2026
…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>
@mrbobbytables
mrbobbytables deleted the quality/test-non-error-plugin-arms branch October 26, 2026 20:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant