Repository navigation
feat(coderd/database): add saved workflows storage - #335
Conversation
@codex review |
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: Didn't find any major issues. Keep it up! 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". |
…workflows-a # Conflicts: # coderd/database/forkdb/sqlc.yaml
Merged main forward through the stack. @codex review |
|
Codex Review: Didn't find any major issues. Nice work! 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". |
|
|
Codex Review: Didn't find any major issues. Keep it up! 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". |
…workflows-a # Conflicts: # coderd/database/forkdb/sqlc.yaml
Merged main (#339) into the branch. The sqlc.yaml conflict kept both nodes in graph order. @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". |
Merged main (#340) into the branch with no conflicts. @codex review |
|
Codex Review: Didn't find any major issues. Delightful! 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". |
Merged as 6ae6741 (squash of 6016deb). Gates on the merged head:
Not exercised: the node on a copy of production data, and any live server behavior. This PR adds storage only, with no routes or tools. The previous deploy (cdf3579) had landed before this merge. |
Part 1 of the stack for #322 (saved workflows). This PR adds only the storage. Routes and
run_workflowby name come in the next PRs of the stack.What changed
01a1db0e-..._saved_workflowscreatessaved_workflows. It followsagent_definitions:user_idset, one row per user, organization and name.user_idNULL, shared throughgroup_aclanduser_acl.args_schema(a JSON object),phases text[](stored now, used by chatd, site: workflow phases and the phase rail on the run card #325),created_by(who saved it, set NULL when that user is deleted).forkdbqueries for both tiers: insert, get by name, list metadata (no script), partial update, ACL update and delete.user_skillowned by the user.organization_skillwith the row's ACLs. Members get read through the ACL. Create, update, share and delete need org admin rights.RBACObjectmethods.Why
#322 needs a saved workflow resource with personal and organization tiers that mirror agent definitions.
Assumption to review
Mirroring agent definitions means a plain member cannot publish a workflow to the organization tier. Only org admins (and owners) create and share organization workflows. #327 talks about a member sharing their workflow, so this may need a follow-up decision.
Tests
flock ~/.fork-go.lock go test ./coderd/database/dbauthz/ -count=1: ok. Includes 12 newTestForkQueriercases andTestSavedWorkflowRBAC, which runs the real authorizer: a member cannot read, list, edit or delete another member's workflow, cannot publish, edit, share or delete organization workflows, and reads shared rows through the Everyone grant or a direct grant.flock ~/.fork-go.lock go test ./coderd/database/forkdb/ ./coderd/database/migrations/chatdmig/... -count=1: ok.TestSavedWorkflowscovers defaults, unique names per tier, check constraints, both limits, user delete, partial updates and the ACL trigger.flock ~/.fork-go.lock go run ./coderd/database/migrations/chatdmig/cmd/chatdmig check: ok.flock ~/.fork-go.lock golangci-lint run ./coderd/database/forkdb/... ./coderd/database/dbauthz/... ./coderd/database/dbmetrics/...: 0 issues.Size: about 350 lines of code and 485 lines of tests, generated code excluded.
Not covered here: HTTP routes, the experiment gate and the agent tool. They land in the next PRs.
Part of #322.