Skip to content

test(bundle): cover non-Error rejection paths including auth - #528

Merged
mrbobbytables merged 3 commits into
mainfrom
quality/test-bundle-non-error-rejection
Oct 21, 2026
Merged

mrbobbytables merged 3 commits into
mainfrom
quality/test-bundle-non-error-rejection

Conversation

@hivecommons-hive

@hivecommons-hive hivecommons-hive Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Description

Adds controlled non-Error rejection scenarios through dist/index.js using a one-shot NODE_OPTIONS=--require preload. A proxied fetch response throws a string from its status getter, after Octokit's fetch catch, while still recording the request against the fake GitHub API.

The four scenarios exercise:

  • runEventHandlers on a rejected pull-request read.
  • Per-command normalizeError on a rejected milestone listing.
  • Label-sync's write catch, including continuation to later labels.
  • getErrorDetails through /retitle's collaborator check: one warning with status=unknown and the exact primitive message, a successful action exit, no unhandled rejection, and no issue update.

Fixes #507

The auth scenario supersedes the coverage-ignore approach in #510 once this PR merges: auth.ts now reaches 100% bundle line coverage without adding an ignore or removing its defensive fallback. Other findings formerly folded into #507 have their own canonical PRs; the upstream V8 report is preserved in #550.

Related: #548 adds distinct plugin scenarios using the byte-identical preload. It can remain a separate PR; neither scenario set should be discarded. Truly wrapped/unreachable arms are separately owned by #537, #544 and #549.

Testing

  • npx vitest run __tests__/bundle/nonErrorRejectionArms.test.ts — passed: 4 tests.
  • npx eslint __tests__/bundle/nonErrorRejectionArms.test.ts __tests__/bundle/nonErrorRejectionPreload.cjs — passed.
  • npm run test:coverage:e2e — passed; 100% statements, lines and functions; 99.03% branches (1640/1656). src/utils/auth.ts has 100% lines without an ignore annotation.

Checklist

  • I ran npm run all to lint and build my code — used the focused lint/tests and full e2e coverage command above instead.
  • I ran npm run pack and committed dist/ — not needed: this PR changes only bundle tests and their preload; committed production source/bundle are unchanged.
  • Commits are signed off (DCO)
  • Note any new dependencies these changes bring in — none.
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation — behavior is unchanged; the test and this PR describe the controlled fault injection.
  • My changes generates no new warnings (please describe new warnings if unavoidable)

… normalizeError and label-sync's write through dist/index.js

A 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 client call unwrapped. Three runs pin that the step still
fails once naming the string: pull_request synchronize (events.ts:50),
/milestone (handleIssueComment.ts:217) and the label-sync job (labelSync.ts:107).

Signed-off-by: quality <280983584+hivecommons-hive[bot]@users.noreply.github.com>
@hivecommons-hive hivecommons-hive Bot added the hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 19, 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.

This was referenced Oct 19, 2026
mrbobbytables and others added 2 commits October 21, 2026 09:12
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Bob Killen <bkillen@linuxfoundation.org>
Exercise getErrorDetails through /retitle, asserting the warning and denied write while keeping the action green.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Bob Killen <bkillen@linuxfoundation.org>
@mrbobbytables mrbobbytables changed the title test(bundle): drive the non-Error String(e) arms of runEventHandlers, normalizeError and label-sync's write through dist/index.js test(bundle): cover non-Error rejection paths including auth Oct 21, 2026

@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.

Reviewed the shared one-shot preload and four bundle scenarios. The added auth case reaches auth.ts:24, reports the exact primitive warning and denies the title write. Local full e2e coverage passed with 100% lines and 99.03% branches; no auth ignore or production change is needed.

Verified successful build-test, e2e-coverage and DCO results on head f0e2394. 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 4a65fcf into main Oct 21, 2026
13 checks passed
mrbobbytables pushed a commit that referenced this pull request Oct 21, 2026
… sweep, trigger and approveReview through dist/index.js (#548)

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

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.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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-bundle-non-error-rejection 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

1 participant