Repository navigation
test(bundle): drive the authorization policy arms of auth.ts (members/collaborators/root-OWNERS admits, trusted refusal, config-load failures, empty login) through dist/index.js - #378
Conversation
…dist/index.js policyAllows' member, collaborator and empty-login arms, the trusted fallback to the root OWNERS file (rootOwnersIncludes), closePolicyAllows' and the review fallback's behaviour when the authorization section does not parse, and review: trusted refusing a user outside authorization.users. 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 |
|
/kind cleanup 🐝 Hive Agent: — hive: agent=quality backend=copilot model=claude-fable-5.1 copilot=1.0.88 |
jeefy
left a comment
There was a problem hiding this comment.
All seven cases add coverage, and most of the documented ### authorization behaviour is asserted. Two documented guarantees run but aren't checked:
authorizationPolicyArms.test.ts:162: the docs say the fallback exists "so the configuration error never reaches the public comment", but this case never inspects the reply. After :173, assert there is exactly onePOST …/issues/1/comments, that its body containsnot a org member or collaborator, and that it does not containauthorization. These pass on main.:129: the collaborator read is grouped with the config reads "in any order", so a/closethat read the config first would still pass. The docs say the section is read "only when both refuse". Pincalls()[0]to the collaborator read, or reuse theindexOfcheck at :159.
…n the collaborator read first Signed-off-by: quality <quality@hive.kubestellar.io>
|
Addressed in cb868f1:
🐝 Hive Agent: — hive: agent=quality backend=copilot model=claude-fable-5.1 copilot=1.0.88 |
…and drop the policy-set rows #378 reaches Signed-off-by: quality <quality@hive.kubestellar.io>
… the cross-tier users union through dist/index.js (#381) * test(bundle): drive the authorization section's schema rejections and the cross-tier users union through dist/index.js normalizeAuthorization's non-mapping, unknown-key, bad-policy and users rejections (config.ts 666, 671, 686, normalizeLogins 704) and mergeAuthorization's case-insensitive dedup of users listed by both the organization and the repository tier (753) had unit hits only; this file reaches them through a /triage accepted against a malformed .github/prow.yaml and a two-tier configuration. Signed-off-by: quality <quality@hive.kubestellar.io> * test(bundle): run the users-union case as an organization-only login and drop the policy-set rows #378 reaches Signed-off-by: quality <quality@hive.kubestellar.io> --------- Signed-off-by: quality <quality@hive.kubestellar.io> Co-authored-by: quality <quality@hive.kubestellar.io> Co-authored-by: Bob Killen <bkillen@linuxfoundation.org>
Test Improvement
Adds
__tests__/bundle/authorizationPolicyArms.test.ts: sevenissue_commentruns throughdist/index.jsagainst the fake GitHub covering theauthorizationpolicy arms ofsrc/utils/auth.tsthatauthorization.test.ts(from #367) leaves out —/triage acceptedunderlabels: membersby an org member →policyAllowsadmits on the membership read (L313), no collaborator read/triage acceptedunderlabels: collaboratorsby a collaborator → admits on the collaborator read (L316), no membership read/triage acceptedunderlabels: trustedby a root-OWNERS reviewer who is neither member, collaborator nor inusers→rootOwnersIncludesadmits from the OWNERS file (L460–462)/triage acceptedunderlabels: collaboratorsfrom a payload withoutcomment.user.login→ refused before any read (L304)/closeby a stranger with anauthorizationsection that does not parse (close: everyone) →closePolicyAllowsreturns false (L365) afterloadAuthorizationwarns (L377–378); exit 0, noPATCH/lgtmon a PR without OWNERS files underreview: trusted, users: [friend]byoutsider→ refused with… or listed in authorization.users(L270), configuration read only after the membership reads refuse/lgtmon a PR without OWNERS files with anauthorizationsection that does not parse (review: anyone) → warns and falls back to themembersdefault (the.catch(() => defaultAuthorization)on L265)Measured on
main@ 5061d57 withnpm run test:coverage:e2e:auth.ts70.14 % → 82.08 % lines; newly reachedauth.tslines 265, 270, 304, 313, 316, 365, 377–378, 460–462 (plus theretrieveOwnersFilesuccess lines 480–499, which #283/#331 also reach). Files/functions claimed:__tests__/bundle/authorizationPolicyArms.test.tsonly;policyAllows,closePolicyAllows,loadAuthorization,rootOwnersIncludesand thereviewfallback ofassertAuthorizedByOwnersOrMembership. Disjoint from #283/#331 (assertRootOwneron an issue), #355 (/approvemembership refusals) and #326 (hold.ts).Uses
comment,configReads,helpersFor,membershipReads,ownersReadsfrom./helpers; no helper, source ordist/changes. Error and warning assertions check fragments only.Verified locally:
npx eslint __tests__/bundle/authorizationPolicyArms.test.tsclean;npx vitest run __tests__/bundle/authorizationPolicyArms.test.ts→ 7 passed;npm run test:coverage:e2e→ 222 passed.Related Issue
Closes #377
Filed by quality agent (hold-gated mode). Human review required.
— hive: agent=quality backend=copilot model=claude-fable-5.1