Repository navigation
feat(coderd/database): store agent definitions for users and organizations - #62
Conversation
…nt on its function
…d ACL objects Adds a per-owner limit subtest, asserts that user-tier queries stay in their organization and organization-tier update and delete skip user-tier rows, and makes the organization-tier TestForkQuierer cases assert an explicit RBAC object with non-empty ACLs instead of the row's own RBACObject.
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@codex review
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: dbb2af51be
ℹ️ 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".
…tion ACLs on insert Owner deletes cascade by user_id and organization_id, so the user unique index now leads with user_id and a plain organization_id index serves organization deletes. InsertOrganizationAgentDefinition takes group_acl and user_acl like InsertOrganizationSkill, so the route can seed the Everyone read grant.
|
@codex review
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ef9cd18d82
ℹ️ 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".
The head is unchanged ( |
What I checked before merging head
|
Part of #7
Adds storage for stored agent definitions (scope item 4, first of three PRs): a
chatd.agent_definitionschatdmig node and authorized forkdb queries for the user and organization tiers. It has no routes, catalog resolution or UI. PR6 adds the user and organization routes behindfork-agent-definitionsand resolves rows into the spawn catalog. PR7 adds organization ACL routes and the project tier.Schema
public.skills: tier columns, a name format equal toworkspacesdk.SkillNamePattern, size limits, ACL columns that are allowed only on organization-tier rows, per-owner unique names, and a 100-row per-owner limit trigger (enforce_agent_definitions_per_owner_limit).organization_id NOT NULL. A row is in the organization tier whenuser_idandproject_idare both NULL, the user tier whenuser_idis set, and the project tier whenproject_idis set.Authorization
ResourceUserSkill.WithOwner(user)withoutInOrg.policy.regoskips user-level permissions on objects that have an organization owner, and no org role grantsResourceUserSkill, so withInOrgset, members could not reach their own rows. dbauthz enforces the organization scope instead: every user-tier method, the list included, also authorizesActionReadonResourceOrganization.WithID(org).InOrg(org).ResourceOrganizationSkill.InOrg(org)with the row's group and user ACLs, following the upstream skill wrappers. The list usesfetchWithPostFilter, which is enough for at most 100 rows per organization. The insert takesgroup_aclanduser_acl, likeInsertOrganizationSkill, so the PR6 create route can seed the Everyone read grant.coderd/rbacfiles change.Tests
TestForkQuerier: one case per method. Each asserts the exact objects and actions.TestUserAgentDefinitionOrganizationMembership: uses the real authorizer. For create, read, list, update and delete, a member is allowed, a non-member is denied, and a member removed from the organization loses access to their row.TestAgentDefinitions: a DB test of per-owner uniqueness, the check constraints, the per-owner limits, cascade on user delete, update, and organization filtering.Size
About 680 non-generated lines: 307 production (node, queries, dbauthz, dbmetrics, model methods, sqlc.yaml) and 370 tests. The rest is generated by sqlc and mockgen.