refactor(coderd): restore agents-access cleanup migration - #28587
Conversation
…Agents access control
…urrent Coder Agents copy
Keep this PR migration-free so it backports cleanly across diverged migration numbers. Stale agents-access grants may now linger in role arrays and org default role lists, so treat retired role names as grants of nothing: role expansion drops them and assignment validation ignores them. A follow-up PR will clean up the stale data.
Reinstate the data cleanup that the base PR dropped to stay backportable, renumbered to 000587 because main advanced past 585. With stale grants migrated away, revert the temporary RBAC tolerance for retired role names: role expansion is strict again and assignment validation no longer filters legacy names. The migration test steps to the highest existing version below the target because this branch does not contain migrations 585 and 586 from main.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b722a80a34
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
# Conflicts: # docs/ai-coder/agents/getting-started.md
|
@codex review |
…-default' into HEAD # Conflicts: # coderd/members_test.go
|
@codex review |
…ment listings Also renames IsLegacyRoleName to IsRetiredRoleName so the helpers are named for behavior rather than history.
…-default' into HEAD # Conflicts: # coderd/database/db2sdk/db2sdk.go # coderd/database/dbauthz/dbauthz.go # coderd/members.go # coderd/members_test.go # coderd/rbac/roles.go # coderd/rbac/roles_test.go # coderd/rbac/rolestore/rolestore.go # coderd/rbac/rolestore/rolestore_test.go
|
@codex review |
…-default' into HEAD # Conflicts: # coderd/members_test.go
|
@codex review |
1 similar comment
|
@codex review |
|
@codex review |
💡 Codex ReviewLines 103 to 104 in 86b3eef On deployments where a custom role named ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
…s-access-cleanup # Conflicts: # coderd/rbac/roles.go
Addressed in b33e339 (the branch is also restacked onto
|
|
@codex review |
|
Codex Review: Didn't find any major issues. Bravo. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Summary
agents-accessdata cleanup migration as000587(renumbered from000585; main advanced past that number)000585/000586Stack context
Stacked on #28186, which retires the
agents-accessrole but intentionally ships without a migration so it can be backported across diverged migration numbers. This layer completes the retirement on main: it cleans up stale role grants inusers.rbac_roles,organization_members.roles, andorganizations.default_org_member_roles, then reverts the interim leniency (role expansion dropping legacy names, assignment validation ignoring them) that existed only to keep the migration-less base safe.rbac.ReservedRoleNamestill reserves the retired name so custom roles cannot shadow it on rollback. Do not backport this PR alongside the base PR.Rollback note
The down migration restores effective access broadly because it cannot reconstruct which users previously held the removed role.
Validation
go build ./coderd/... ./enterprise/...coderd/database/migrations,coderd/rbac/..., andcoderd/database/dbauthzsuitescoderdlint/go,lint/ts, etc.)