Repository navigation
test(bundle): drive the issue-side OWNERS fallback and the membership probes' 500 arms through dist/index.js - #331
Conversation
… probes' 500 arms through dist/index.js On an issue (not a pull request) assertAuthorizedByOwnersOrMembership reads the root OWNERS file and falls back to org membership or collaborator status when it is absent. No bundle test reached that arm: the only /lgtm on an issue was refused as the author first. Drive it against the fake GitHub: - root OWNERS 404, org read 500 (warns), collaborator 204 -> lgtm applied - root OWNERS 404, org and collaborator 404 -> refused by name - root OWNERS 500 -> refused, no membership read - root OWNERS is a directory (no content) -> refused, no membership read - /unassign whose issue-comments read 500s -> warns, removes nothing auth.ts end-to-end lines 63.1% -> 81.55% under npm run test:coverage:e2e. Signed-off-by: quality <quality@hive.kubestellar.io>
|
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 Hive will keep the |
jeefy
left a comment
There was a problem hiding this comment.
Four of the five cases add coverage.
rootOwnersFallback.test.ts:64and:133: check a fragment, e.g.some(w => w.includes('status=500')), instead of comparing the whole::warning::line withtoEqual.- Drop
:71. Its root-OWNERS 404 fallback lines are already reached by L53, and the "not a org member or collaborator" refusal is covered on main.
…hip refusal Signed-off-by: quality <quality@hive.kubestellar.io>
|
Addressed: both 🐝 Hive Agent: — hive: agent=quality backend=copilot model=claude-fable-5.1 |
|
Addressed in 8eff51a: both warning checks use a CI is green on the new head. 🐝 Hive Agent: — hive: agent=quality backend=copilot model=claude-fable-5.1 copilot=1.0.88 |
|
/kind cleanup |
🔒 Hold-gate integrity: branch changed while hold-gated — fresh review requiredThis PR's branch moved while it sat hold-gated: the head recorded when the hold was applied was Commits not present in the hold-time snapshot (2):
A human should review the FULL diff at the current head — a rebase or force-push renames every commit, so everything above needs eyes even if it looks familiar. Removing the hold label after that review is the fresh approval: the guard has re-pinned its snapshot to the current head, so a clean lift re-opens the merge lanes. |
Test Improvement
Adds
__tests__/bundle/rootOwnersFallback.test.ts, a bundle (end-to-end) suite that drivessrc/utils/auth.ts's issue-sideassertAuthorizedByOwnersOrMembershiparm throughdist/index.jsagainst the fake GitHub. On an issue (not a pull request) the plugin reads the rootOWNERSfile viaretrieveOwnersFile→assertRootOwnerand falls back to org membership / collaborator status when it is absent; no existing bundle test reached that arm (the only/lgtmon an issue is refused as the author before authorization runs).Five tests,
/lgtmby a non-author on issue #1 unless noted:OWNERS404, org-membership read 500, collaborator 204::warning::encountered unexpected error: status=500, message=boom,lgtmapplied, then the post-command config readsOWNERS404, org and collaborator both 404Codertocat is not a org member or collaborator, exit 1, no label writeOWNERS500error checking for an OWNERS file at the root of the repository: HttpError: boom, no membership readOWNERSis a directory (contents API lists it withoutcontent)invalid OWNERS file returned from GitHub API, no membership read/unassign @octocatby a non-member whose issue-comments read 500s::warning::encountered unexpected error checking issue comments: status=500, message=boom, noDELETE …/assigneesEach test also asserts the exact request sequence (
contents/OWNERS→orgs/…/members→collaborators/…→ write/comment → config reads viaexpectCommandThenConfig).Measured with
npm run test:coverage:e2eonmain@ 3fc21f2:auth.tsend-to-end 63.1 % → 81.55 % lines (62.85 → 80.95 % stmts, 53.12 → 71.87 % branches, 78.57 → 92.85 % funcs).auth.ts:257, 61, 64, 135-139, 349-350, 353, 358-359go from 0 hits to covered. All files: 77.9 → 78.7 % lines, 6 files / 147 tests.Disjoint from the held PRs: #283 (
ownersAuth.test.ts) covers the root-OWNERS-present arms (auth.ts:277-288, 362-364) and the PR-sideno OWNERS file coversarm (321-322); #306 coverscheckCollaborator's 500 arm (98, 101). Those lines are not asserted here. Files touched:__tests__/bundle/rootOwnersFallback.test.tsonly (new);src/,dist/,vitest.config.mjsand.github/unchanged.Verified locally:
npx vitest run __tests__/bundle/rootOwnersFallback.test.ts(5 passed),npx eslint __tests__/bundle/rootOwnersFallback.test.tsclean.Related Issue
Closes #330
Filed by quality agent (hold-gated mode). Human review required.
— hive: agent=quality backend=copilot model=claude-fable-5.1