Skip to content

test(bundle): drive owners-label's early-return and failure arms through dist/index.js - #298

Merged
mrbobbytables merged 5 commits into
mainfrom
quality/test-bundle-owners-label-arms
Oct 9, 2026
Merged

mrbobbytables merged 5 commits into
mainfrom
quality/test-bundle-owners-label-arms

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Test Improvement

Files: __tests__/bundle/ownersLabelArms.test.ts only (new; no src/, dist/, helpers.ts or config change). Cluster: the non-write arms of src/plugins/ownersLabel.ts driven through dist/index.js on pull_request synchronize (require-matching-label, blunderbuss and tide skip that action, so each call list is the OWNERS reads, the plugin's own reads and approve's probe). Disjoint from every open hold-gated bundle PR (#242 cron jobs input, #244 /meow, #246 fixed/prefixed labels + helpers.ts, #283 OWNERS authorization, #286 approve.github_review, #289 tide merge gate, #291 blunderbuss, #293 hold/sweep, #296 close/milestone).

Five cases, one per unreached arm:

  1. the pull request already carries every declared label (Area/SDK vs area/sdk) → no GET /labels, no write (ownersLabel.ts:61-62)
  2. every declared label is unknown to the repository → both owners-label: skipping label … (run label-sync) info lines, no write (77-78, 81)
  3. known/unknown mix → only area/docs posted, in the OWNERS spelling, while the repository's spelling (Area/Docs) decides it is known
  4. GET /labels → 500 → ::error::error handling pull_request event: could not list the repository labels: …boom…, exit 1, and approve's default-branch probe still runs after it (70; runEventHandlers collects the rejection)
  5. payload without pull_request → github context payload missing pull request: …, exit 1, zero API calls (30)

Evidence (main @ 3fc21f2, Node v26.10.0, vitest 5.0.3):

  • npm run test:coverage:e2e: ownersLabel.ts 80 → 100 % lines, 73.33 → 100 % branches; bundle suite 6 files / 147 tests green (was 5 / 142).
  • npx vitest run --coverage (unit): unchanged, 81 files / 1644 tests, ownersLabel.ts already 100 %.
  • npx eslint __tests__/bundle/ownersLabelArms.test.ts and npx tsc --noEmit clean.

Once #246 lands its repoLabels() helper, the local routeRepoLabels here can import it; kept local for now so helpers.ts stays untouched.

Related Issue

Closes #297


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

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

…ugh dist/index.js

Adds __tests__/bundle/ownersLabelArms.test.ts: five pull_request synchronize
runs against the fake GitHub covering the arms of src/plugins/ownersLabel.ts
the bundle suite never reached - already carrying every declared label,
labels the repository lacks, a known/unknown mix, a failing repository label
list and a payload without a pull request.

npm run test:coverage:e2e: ownersLabel.ts 80 -> 100 % lines, 73.33 -> 100 %
branches.

Signed-off-by: quality <quality@hive.kubestellar.io>
@hivecommons-hive
hivecommons-hive Bot requested a review from jpmcb as a code owner October 4, 2026 08:28
@hivecommons-hive hivecommons-hive Bot added the hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 4, 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 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.

@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

build-test on 0c046cb is red for the shared cause tracked in #294, not this diff: all 81 test files pass and the job exits 1 on the vitest Unhandled Error assert(err.code !== "ERR_TLS_CERT_ALTNAME_INVALID") originating in __tests__/issueCommentTest/meow.test.ts (red run); the twin build-test run on the same SHA is green. Deferred until #287 lands and #294 closes — no retries or pushes for this failure.


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

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

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

  • Drop ownersLabelArms.test.ts:87–102. Its only new lines (ownersLabel.ts:77–78) are already reached by :72, and the label write is covered at bundle.test.ts:1030.

@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

Addressed: dropped the known/unknown declared-labels mix case. Merged main too (it brings #287's meow network fix, which is what build-test was failing on).


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

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

@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

Addressed in 60eb572: dropped the known/unknown declared-labels mix case.

CI is green on the new head.


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

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

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

Your earlier asks are done, and all four cases add coverage. One thing left: repoLabels() was added to ./helpers in #246, after the first review.

  • ownersLabelArms.test.ts:46–48: delete the local routeRepoLabels. Import repoLabels from ./helpers and call gh.route('GET', \${repo}/labels`, repoLabels('area/sdk', 'area/docs'))at :57 andrepoLabels('kind/bug')` at :74.

…Labels helper

Signed-off-by: quality <quality@hive.kubestellar.io>
@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

Addressed in 9650d0e: deleted the local routeRepoLabels and both call sites now use gh.route('GET', ${repo}/labels, repoLabels(...)) from ./helpers.


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

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

@mrbobbytables

Copy link
Copy Markdown
Member

/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 9, 2026
@mrbobbytables
mrbobbytables merged commit 11f13bc into main Oct 9, 2026
5 checks passed
@mrbobbytables
mrbobbytables deleted the quality/test-bundle-owners-label-arms branch October 9, 2026 17:58
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] owners-label's early-return and failure arms are never driven through dist/index.js (e2e 80% lines, unit 100%)

2 participants