Skip to content

chore(coverage): v8-ignore getErrorDetails' bundle-unreachable object folds - #587

Merged
mrbobbytables merged 1 commit into
mainfrom
chore/auth-error-details-v8-ignore
Oct 26, 2026
Merged

mrbobbytables merged 1 commit into
mainfrom
chore/auth-error-details-v8-ignore

Conversation

@mrbobbytables

Copy link
Copy Markdown
Member

Description

getErrorDetails (src/utils/auth.ts:15-17) has two defensive folds — an object without status → 'unknown', and an object without a string message → String(error) — that coverage-e2e has named as the only non-phantom uncovered branches in auth.ts. They cannot be reached through dist/index.js: @octokit/request wraps every rejection the bundle can see in a RequestError, which always carries a numeric status and a string message. __tests__/utils/auth.test.ts drives both arms with hand-built objects.

This marks each statement /* v8 ignore next */ with the same rationale style as #537/#544/#549. The hint is statement-level rather than arm-level because an arm-level hint on the message ternary leaves the && short-circuit branch reported (verified). The production code is unchanged.

The documented phantom branch in docs/contributing.md moved from auth.ts:220 to :225 with the added lines; the reference is updated.

Supersedes #553, which reached these arms only by preloading a .cjs into the bundle child that patches globalThis.fetch to throw a plain object from response.status — a path no real client produces.

Refs #507, #170 (folded finding).

Testing

  • npm run build && npm run lint — passes (one pre-existing jsdoc/check-param-names warning at cc.ts:81, unrelated)
  • npm run test:coverage — 2333 passed, 75 skipped; 99.92 / 99.34 / 100 / 99.91
  • npm run test:coverage:e2e — 86 files / 528 tests passed; 100 / 99.58 / 100 / 100 (was 99.46 branches); auth.ts now lists only line 225, confirmed as the phantom (BRDA:225,10,1,-44 in coverage-e2e/lcov.info)

Checklist

  • I ran npm run all to lint and build my code (ran build, lint, pack and both coverage suites individually)
  • I ran npm run pack and committed dist/
  • 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
  • My changes generates no new warnings (please describe new warnings if unavoidable)

/kind cleanup

… folds

@octokit/request wraps every rejection the bundle can see in a
RequestError carrying a numeric status and a string message, so the
status-less and message-less object arms of getErrorDetails
(auth.ts:15-17) cannot be reached through dist/index.js; auth.test.ts
drives them. Ignore each statement as a whole: an arm-level hint leaves
the && short-circuit branch reported. coverage-e2e now names only the
documented phantom branch, which moved from auth.ts:220 to :225.

Supersedes #553, which reached these arms only by patching
globalThis.fetch in the bundle child to throw a plain object from
response.status.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Bob Killen <bkillen@linuxfoundation.org>
@mrbobbytables

Copy link
Copy Markdown
Member Author

/kind cleanup

@github-actions github-actions Bot added kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. and removed needs-kind labels Oct 26, 2026
@mrbobbytables
mrbobbytables merged commit 663bf53 into main Oct 26, 2026
6 checks passed
@mrbobbytables
mrbobbytables deleted the chore/auth-error-details-v8-ignore branch October 26, 2026 19:42
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