Skip to content

test(utils): cover the error and edge branches of labelMatch, labeling, comments and config - #198

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

mrbobbytables merged 1 commit into
mainfrom
quality/test-utils-error-paths

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Test Improvement

Adds __tests__/utils/utilsErrorPaths.test.ts (14 tests) — the only file this PR touches. Covers the seven previously unexercised branches in src/utils/{labelMatch,labeling,comments,config}.ts:

  • matchesLabelPattern — a middle * part absent between the anchored ends, or present only inside the tail (a*b*bc vs abc)
  • assertLabelsExist — wrapped listLabelsForRepo failure (could not list the repository labels)
  • getCurrentLabels — plain-string label entries and objects without name; wrapped issues.get failure
  • createCommentOnce — returns false and does not POST when a bot comment already carries the marker; a human comment carrying it is ignored and the bot posts
  • loadProwConfig explicit sources — non-404 getContent failure wrapped; directory / non-string content payload → is not a file; https:// fetch network failure (HttpResponse.error()) wrapped
  • parseProwConfig — max_request_count compared against the default request_count of 1

All branches are reached through msw; no source, fixture or dist/ changes.

Coverage (npm run test:coverage, origin/main 187c5e3 + this commit): labelMatch.ts, labeling.ts, comments.ts 100% lines/branches (were 94.4/96.2/100 lines, 91.7/90/87.5 branches); config.ts 100% lines, 99.0% branches (was 98.5/98.1). Overall lines 96.16% → 96.42%, branches 94.55% → 94.94%. Full suite 59 files / 1305 tests green; eslint clean.

Disjoint from open PRs #173/#175/#177/#179/#181/#183/#185/#187/#190/#192/#194/#196 (pullReq, issueComment handlers, labels, cronJobs, sleep, trigger, tide, mergeQueue, approve plugin, auth).

Related Issue

Closes #197


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

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

…g, comments and config

Adds __tests__/utils/utilsErrorPaths.test.ts (14 tests):

- matchesLabelPattern: middle glob part absent or only inside the tail
- assertLabelsExist: wrapped listLabelsForRepo failure
- getCurrentLabels: string label entries, wrapped issues.get failure
- createCommentOnce: bot marker dedup returns false; human marker ignored
- loadProwConfig explicit sources: non-404 getContent wrapped, directory
  payload is not a file, https fetch network failure wrapped
- parseProwConfig: max_request_count against the default request_count

labelMatch, labeling, comments: 100% lines/branches; config: 100% lines.

Closes #197

Signed-off-by: hivecommons-hive[bot] <hivecommons-hive@hive.kubestellar.io>
@hivecommons-hive
hivecommons-hive Bot requested a review from jpmcb as a code owner September 27, 2026 06:03
@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

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.

@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

/kind cleanup

🐝 Hive Agent: quality | Instance: hosted-available-lke648397-260827-5q9t | SHA: unknown

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

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

[quality] cover the remaining error/edge branches of utils labelMatch, labeling, comments and config

1 participant