Repository navigation
fix(sections): never plan the owner, hedge a concealed team 404, and advise the grant the writes need - #588
Conversation
…advise the grant the writes need A `collaborators` entry naming the repository owner was settled like any other: on a user-owned repository it planned a PUT re-granting the owner at the declared role, and an organization's own login planned an invitation. The declared walk now skips the owner with a note saying to remove the entry, so no write is ever planned for it. Check mode read a 404 on a declared team's access probe as "no access" even when the repository's team list named the team, the state a fine-grained token without the Members organization permission produces. The drift line now names both readings of the 404 and the grant that settles it, in the words the snapshot's note already used. The grant is still planned. A denied team list advised "Administration" (read), the list's own gate. That passes the next apply preflight and is denied again at the grant PUT. A denial on an endpoint whose permission the section's grant covers now advises the section's grant, so the first advice names what the writes need. `LiveCollaborator.permissions` was parsed and never read, and is gone. The collaborators page said a custom role named "push" leaves a partial snapshot: the section fails, which fails the target with no file written, and the page now says so.
File size check0 over a hard cap (fails), 6 warning(s).
Split the file, wrap the line, shorten or exempt the comment, or list the path in 5 managed file(s) skipped; repo-platform owns them. |
Member shape check9 finding(s).
Add the blank lines, make the comment one line directly above the item, comment every field or none, or list the path in 4 generated file(s) skipped. |
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are identified for the collaborator and team handling changes.
No open issues 🎉
What changed in this PR
This PR corrects collaborator and team handling in the settings action: declared repository owners are ignored with a note, listed-team probe 404s receive qualified advice, and permission errors recommend the grant needed for the section's writes.
Changes:
- Prevent writes for declared owners and remove unused collaborator permission parsing.
- Share listed-team 404 wording between planning and snapshots, and improve permission-grant advice.
- Add regression tests and end-to-end scenarios, and update coverage documentation.
| File | Description |
|---|---|
test/sections/teams/teams.test.ts |
Tests listed-team 404 wording and denial advice. |
test/sections/teams/scenarios/teams-list-denied-advice.yml |
Verifies full-grant advice when listing teams is denied. |
test/sections/teams/scenarios/teams-check-concealed-probe.yml |
Verifies check-mode wording for concealed team access. |
test/sections/contract/contract.test.ts |
Tests permission coverage direction and alternatives. |
test/sections/collaborators/scenarios/collaborators-declared-owner-note.yml |
Verifies declared owners receive a note without writes. |
test/sections/collaborators/collaborators.test.ts |
Tests user and organization owner declarations. |
src/sections/teams/index.ts |
Shares 404 wording and checks whether teams are listed. |
src/sections/contract/permissions.ts |
Adds permission coverage comparison. |
src/sections/contract/errors.ts |
Prefers the section grant when it covers the denied endpoint. |
src/sections/collaborators/index.ts |
Skips declared owners and removes unused schema parsing. |
docs/sections/teams.docs.yml |
Documents listed-team 404 behavior. |
docs/sections/collaborators.docs.yml |
Documents owner handling and corrects snapshot failure behavior. |
docs/reference/coverage.md |
Regenerates collaborator and team coverage documentation. |
Review effort: Balanced
Before
After
A file that declares the owner keeps applying. The entry is skipped with a note, not refused.
Only a listed team is hedged. An unlisted team's 404 still reads
no access, since no listing contradicts it.How
settleDeclared, the one place a declared entry earns its op or note.listedProbe404words the 404 once, andplan()andsnapshot()both call it.coversPermissionasks whether the section's grant satisfies the denied endpoint, and if so that grant is advised.LiveCollaborator.permissionsis deleted: it was parsed and never read.Proof
test/sections/{collaborators,teams,contract}, the 4 defect cases seen failing first.Technical details
username: Acmeon an organization repository planned an invitation (collaborators[Acme]: missing - not a collaborator on the repo; apply will send an invitation with "push") and now earns the same note.access_source: organizationis hedged the same way, since the list states its access either way.listedProbe404.coversPermission(grant, asked)holds when every alternative ofgrantis oneaskedaccepts andaskedwants no organization permissiongrantlacks.overrideAdviceLevelunchanged: a denial on the team list no longer reaches it.src/sections/collaborators/index.ts: 2 schema keys namedpermissionsand 4.permissionsreads, all 4 on an invitation.permissions, the invitation's, and the same 4 reads.docs/sections/collaborators.docs.ymlstates the owner rule for a declared entry.docs/sections/teams.docs.ymlstates the listed-team 404 line, anddocs/reference/coverage.mdis the regenerated region of both pages.collaborators-declared-owner-note,teams-check-concealed-probe,teams-list-denied-advice.readLiveAccesswould retire the two olderisOwner()calls, and no input produces a wrong output today.bun capture.mts /repo scenario.yml, the script below, once withsrc/atorigin/mainand once on this branch.#line, against the mock API.admin, and the team cases haveplatformholdingwrite.e2e-owner/e2e-repoare shown asacme/app, and the#lines are labels.preflight failed:summary line, and the script's closing status line.src/sections/{collaborators,teams}/index.ts,src/sections/contract/{errors,permissions}.ts,test/sections/{collaborators/collaborators,teams/teams,contract/contract}.test.ts, the three scenario files, the two.docs.ymlpages,docs/reference/coverage.md.