Skip to content

Document direct-collaborators-only grant and revoke behavior - #200

Merged
johnallers merged 2 commits into
mainfrom
john.allers/CXP-909/document-inherited-access-grant
Nov 23, 2026
Merged

johnallers merged 2 commits into
mainfrom
john.allers/CXP-909/document-inherited-access-grant

Conversation

@c1-squire-dev

@c1-squire-dev c1-squire-dev Bot commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Summary

The direct-collaborators-only option changes how the sync lists repository access. Its effect on repository grant and revoke with inherited access is not documented. A user with access through a team, the organization base permission, or organization ownership can show a fulfilled grant in C1 and have no direct collaborator record on GitHub. A revoke removes only the direct collaborator or invitation, so that user can keep access.

This PR documents that behavior in docs/connector.mdx and docs/docs-info.md. It makes no code or behavior change.

This replaces a code fix that is no longer planned.

🤖 Generated with Claude Code

Describe how repository Grant and Revoke handle inherited access.
Grant returns GrantAlreadyExists when the user already has the
requested permission through a team, the org base permission, or org
ownership. Revoke removes only the direct collaborator or invitation.
No code change.

Co-authored-by: c1-squire-dev[bot] <c1-squire-dev[bot]@users.noreply.github.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@c1-squire-dev
c1-squire-dev Bot requested a review from a team November 23, 2026 21:03
@linear-code

linear-code Bot commented Nov 23, 2026

Copy link
Copy Markdown

CXP-909

@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor
Superseded — see the current review report for commit 6826b7a4949f

Connector PR Review: Document direct-collaborators-only grant and revoke behavior

Blocking Issues: 0 | Suggestions: 1 | Threads Resolved: 0
Criteria: Criteria status: loaded .claude/skills/ci-review.md from trusted base 6716532fafb2.
Review mode: full
View review run

Review Summary

This PR changes only docs. It adds a bullet to docs/connector.mdx and expands two entries in docs/docs-info.md. They say that repository Grant returns "already exists" when the user's effective access (team, org base permission, org ownership) already matches, and that Revoke removes only the direct collaborator or invitation. I scanned the full diff for security and correctness and checked each claim against pkg/connector/repository.go. The claims hold:

  • Grant/Revoke never read directCollaboratorsOnly.
  • IsCollaborator + GetPermissionLevel report effective access, and an exact match returns GrantAlreadyExists (L431-451).
  • Revoke calls only RemoveCollaborator for users (L537).

The repo-local criteria loaded. Sections A–G and S cover code, so they did not apply to a docs-only change. D1–D4 docs staleness doesn't apply either, because the docs are the change itself and no code or config changed. I found no coverage gaps.

Security Issues

None found.

Correctness Issues

None found.

Suggestions

  • New (medium confidence), docs/connector.mdx:503 and docs/docs-info.md:76,172: the docs say "already has the requested permission". Grant returns GrantAlreadyExists only on an exact role match (repository.go:449-451). A user with a higher inherited role, such as an org owner with admin who is granted pull, still gets a direct collaborator added and a GrantReplaced. Readers could take the wording as cumulative.
Prompt for AI agents
Verify each finding against the current code and only fix it if needed.

## Suggestions

In `docs/connector.mdx`:
- Around line 503: The text says grant returns "already exists" when the user "already has the requested permission". pkg/connector/repository.go:449-451 returns GrantAlreadyExists only when the effective role exactly equals the requested role. A user with a higher inherited role (for example an org owner with admin, granted pull) still gets AddCollaborator called and a GrantReplaced annotation. Reword to "already has exactly the requested permission level", or explain what happens when the inherited level is higher or lower.

In `docs/docs-info.md`:
- Around lines 76 and 172: Make the same clarification. GrantAlreadyExists is returned only when the effective permission level matches the requested level exactly.

Comment thread docs/connector.mdx Outdated

- **Direct collaborators only.** GitHub is asked only for users with direct repository access. Team-based access is reconstructed from team membership, which the connector already syncs separately.
- **Skips per-team detail calls.** The `members_count` and `repos_count` profile fields are not synced for team resources.
- **Inherited access in grant and revoke.** Grant and revoke behave the same with or without this option. A repository grant checks the user's effective access first. If the user already has the requested permission, the grant returns "already exists" and no direct collaborator record is created. Effective access includes access through a team, the organization base permission, and organization ownership. With this option on, the sync lists only direct collaborators. A user with only inherited access can show a fulfilled grant in C1 and have no direct collaborator record on GitHub. A repository revoke removes only the direct collaborator or invitation. It does not change team or organization access, so the user can keep access after a revoke.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Suggestion (medium confidence): "already has the requested permission" reads as cumulative, but Grant (pkg/connector/repository.go:449-451) returns GrantAlreadyExists only when the effective role exactly equals the requested one. An org owner (effective admin) who is granted pull still gets AddCollaborator called and a GrantReplaced for admin. Consider wording it as "already has exactly the requested permission level" so operators don't expect a no-op for a lower level.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reworded to say the grant returns "already exists" only when the effective level is exactly the requested level. Higher or lower levels still add a direct collaborator. Fixed in 065f58a, also in docs/docs-info.md.

@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor
Superseded — see the current review report for commit 065f58a5cc83

Connector PR Review: Document direct-collaborators-only grant and revoke behavior

Blocking Issues: 0 | Suggestions: 1 | Threads Resolved: 0
Criteria: Criteria status: loaded .claude/skills/ci-review.md from trusted base 6716532fafb2.
Review mode: full
View review run

Review Summary

This PR changes only docs. It adds a bullet to docs/connector.mdx and expands two entries in docs/docs-info.md. They say that repository Grant returns "already exists" when the user's effective access (team, org base permission, org ownership) already matches, and that Revoke removes only the direct collaborator or invitation. I scanned the full diff for security and correctness and checked each claim against pkg/connector/repository.go. The claims hold:

  • Grant/Revoke never read directCollaboratorsOnly.
  • IsCollaborator + GetPermissionLevel report effective access, and an exact match returns GrantAlreadyExists (L431-451).
  • Revoke calls only RemoveCollaborator for users (L537).

The repo-local criteria loaded. Sections A–G and S cover code, so they did not apply to a docs-only change. D1–D4 docs staleness doesn't apply either, because the docs are the change itself and no code or config changed. I found no coverage gaps.

Security Issues

None found.

Correctness Issues

None found.

Suggestions

  • New (medium confidence), docs/connector.mdx:503 and docs/docs-info.md:76,172: the docs say "already has the requested permission". Grant returns GrantAlreadyExists only on an exact role match (repository.go:449-451). A user with a higher inherited role, such as an org owner with admin who is granted pull, still gets a direct collaborator added and a GrantReplaced. Readers could take the wording as cumulative.
Prompt for AI agents
Verify each finding against the current code and only fix it if needed.

## Suggestions

In `docs/connector.mdx`:
- Around line 503: The text says grant returns "already exists" when the user "already has the requested permission". pkg/connector/repository.go:449-451 returns GrantAlreadyExists only when the effective role exactly equals the requested role. A user with a higher inherited role (for example an org owner with admin, granted pull) still gets AddCollaborator called and a GrantReplaced annotation. Reword to "already has exactly the requested permission level", or explain what happens when the inherited level is higher or lower.

In `docs/docs-info.md`:
- Around lines 76 and 172: Make the same clarification. GrantAlreadyExists is returned only when the effective permission level matches the requested level exactly.

Reviewed commit: 6826b7a4949f

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No blocking issues found — see the full review report

Grant returns already exists only when the effective permission level equals the requested level. Other levels still add a direct collaborator.

Co-authored-by: c1-squire-dev[bot] <c1-squire-dev[bot]@users.noreply.github.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor
Superseded — see the current review report for commit 065f58a5cc83

Connector PR Review: Document direct-collaborators-only grant and revoke behavior

Blocking Issues: 0 | Suggestions: 0 | Threads Resolved: 0
Criteria: Criteria status: loaded .claude/skills/ci-review.md from trusted base 6716532fafb2.
Review mode: incremental since 6826b7a
View review run

Review Summary

This PR changes only documentation: docs/connector.mdx and docs/docs-info.md. It describes how repository Grant and Revoke work for users with inherited access when --direct-collaborators-only is set. The new commit rewrites the grant text: GrantAlreadyExists is returned only when the effective permission level matches the requested level exactly. If the level is higher or lower, a direct collaborator is still added. I scanned the full PR diff for security and correctness issues and compared each claim with pkg/connector/repository.go. The text matches the code:

  • Grant never reads directCollaboratorsOnly.
  • IsCollaborator and GetPermissionLevel are followed by an exact case permission: match that returns GrantAlreadyExists. Any other level falls through to AddCollaborator.
  • Revoke for a user calls only RemoveCollaborator.

I applied the repo-local criteria. The provisioning sections (F/PR1–PR3) and the breaking-change gate (E) were checked against the documented behavior. No code, entitlement or identifier changes, so the code-specific sections (A–D, G, S) do not apply. Nothing in the changed files was left unreviewed.

Security Issues

None found.

Correctness Issues

None found.

Suggestions

None.

Resolved prior findings

  • Fixed: the earlier medium-confidence wording issue. The old docs said "already has the requested permission," which could be read as including higher inherited levels. The new text says "exactly the requested level" and "higher or lower … still adds a direct collaborator" in docs/connector.mdx:503, docs/docs-info.md:76 and docs/docs-info.md:172. This matches repository.go:449-451.

@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Connector PR Review: Document direct-collaborators-only grant and revoke behavior

Blocking Issues: 0 | Suggestions: 0 | Threads Resolved: 0
Criteria: Criteria status: loaded .claude/skills/ci-review.md from trusted base 6716532fafb2.
Review mode: incremental since 6826b7a
View review run

Review Summary

This PR changes only documentation: docs/connector.mdx and docs/docs-info.md. It describes how repository Grant and Revoke work for users with inherited access when --direct-collaborators-only is set. The new commit rewrites the grant text: GrantAlreadyExists is returned only when the effective permission level matches the requested level exactly. If the level is higher or lower, a direct collaborator is still added. I scanned the full PR diff for security and correctness issues and compared each claim with pkg/connector/repository.go. The text matches the code:

  • Grant never reads directCollaboratorsOnly.
  • IsCollaborator and GetPermissionLevel are followed by an exact case permission: match that returns GrantAlreadyExists. Any other level falls through to AddCollaborator.
  • Revoke for a user calls only RemoveCollaborator.

I applied the repo-local criteria. The provisioning sections (F/PR1–PR3) and the breaking-change gate (E) were checked against the documented behavior. No code, entitlement or identifier changes, so the code-specific sections (A–D, G, S) do not apply. Nothing in the changed files was left unreviewed.

Security Issues

None found.

Correctness Issues

None found.

Suggestions

None.

Resolved prior findings

  • Fixed: the earlier medium-confidence wording issue. The old docs said "already has the requested permission," which could be read as including higher inherited levels. The new text says "exactly the requested level" and "higher or lower … still adds a direct collaborator" in docs/connector.mdx:503, docs/docs-info.md:76 and docs/docs-info.md:172. This matches repository.go:449-451.

Reviewed commit: 065f58a5cc83

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No blocking issues found — see the full review report

@johnallers
johnallers merged commit a8b05ef into main Nov 23, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant