Skip to content

test(auth): cover the getErrorDetails fallback branches for string, empty-object and bare Error rejections - #194

Merged
mrbobbytables merged 1 commit into
mainfrom
quality/test-auth-error-details
Sep 28, 2026
Merged

mrbobbytables merged 1 commit into
mainfrom
quality/test-auth-error-details

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Test Improvement

Adds three tests to __tests__/utils/auth.test.ts — the only file touched — covering the private getErrorDetails helper in src/utils/auth.ts (lines 12–22), which every checkOrgMember / checkCollaborator / checkIssueComments catch routes through:

  • checkOrgMember rejecting with a plain string → status=unknown, message=socket hang up (non-object branch, line 22)
  • checkCollaborator rejecting with {} → status=unknown, message=[object Object] (no status, no string message)
  • checkIssueComments rejecting with a bare Error('network down') → status=unknown, message=network down (no status)

Each asserts the exact core.warning text so a formatting regression in the fallback path is caught.

Result on this branch: getErrorDetails is 100% line/branch covered; the only remaining uncovered lines in auth.ts (179, 208, 215, 222) are dead defensive catches around functions that never reject, as noted in the issue.

Disjoint from every open test PR (#173, #175, #177, #179, #181, #183, #185, #187, #190, #192) — none touch auth.test.ts or utils/auth.ts.

Verification: npx vitest run __tests__/utils/auth.test.ts → 22 passed; npx eslint __tests__/utils/auth.test.ts clean.

Related Issue

Closes #193


Filed by quality agent (hold-gated mode). Human review required.

— hive: agent=quality backend=copilot model=claude-fable-5.1 copilot=1.0.88

…mpty-object and bare Error rejections

checkOrgMember, checkCollaborator and checkIssueComments route every
caught error through getErrorDetails, but only the { status, message }
shape was exercised. Add one rejection per fallback branch: a plain
string (non-object), an empty object (no status, no message) and a bare
Error (no status), asserting the exact core.warning text.

Signed-off-by: hivecommons-hive[bot] <hivecommons-hive@hive.kubestellar.io>
@hivecommons-hive hivecommons-hive Bot added the hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 27, 2026
@hivecommons-hive
hivecommons-hive Bot requested a review from jpmcb as a code owner September 27, 2026 01:55
@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. Non-outreach agents are held at ACMM L3–L5; the outreach agent is always held because it publishes project-facing communication.

Hive will automatically remove the hold label once current policy no longer requires a level hold for "quality". If this is an outreach PR, a human must review it and remove the label.

@github-actions

Copy link
Copy Markdown
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hold Indicates that a PR should not merge because someone has issued a /hold command. needs-kind

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[quality] auth.ts: getErrorDetails fallback branches for non-object / status-less / message-less rejections are untested

1 participant