Skip to content

feat(coderd): return per-caller actions on saved workflows - #430

Merged
ibetitsmike merged 5 commits into
mainfrom
mike/issue-423-workflow-row-actions
Nov 23, 2026
Merged

ibetitsmike merged 5 commits into
mainfrom
mike/issue-423-workflow-row-actions

Conversation

@ibetitsmike

@ibetitsmike ibetitsmike commented Nov 23, 2026 •

Copy link
Copy Markdown
Owner

Coder Agents opened this PR on behalf of @ibetitsmike.

Closes #423

What changed

The saved workflows page guessed which row actions a caller could use. It showed Share on every row and inferred edit rights from created_by. The server now computes the actions per caller and returns them on every saved workflow, and the page shows only those.

  • codersdk: ForkSavedWorkflowMetadata gains permissions with update, delete and share booleans.
  • coderd/fork_saved_workflows.go: forkSavedWorkflowPermissions runs the same RBAC checks the update, delete and share handlers run, against the row already loaded. No extra database queries. Organization rows check update, delete and share on the row's RBAC object. Update also requires read, because the patch handler reads the row first. Personal rows require organization read, then update, delete and share on the owner's user skill resource, and share additionally requires the caller to be the author and to hold delete and read, as the share handler does.
  • The organization list now carries the row ACLs into the RBAC object, so a member who was granted access through a share sees the matching actions, and loses them after a revoke.
  • Every list, create, get, patch and share response returns the permissions for the calling user.
  • site: ForkSavedWorkflowsPage builds row access from workflow.permissions for both tables. The table shows Share only when permissions.share is true. The created_by guess is gone.
  • Docs: docs/fork/workflows.md and docs/fork/workflow-administration.md describe the permissions object and the row menu.
  • make gen output for the new type only: coderd/apidoc, docs/reference/api/schemas.md, site/src/api/typesGenerated.ts.

The feature stays behind the fork-workflows experiment. All logic is in fork files.

One finding from the tests: a site owner can delete a member's personal workflow but cannot update or share it, because the update and share handlers check ownership. The permissions match the handlers, so the site owner sees only Delete on those rows.

Tests

  • flock ~/.fork-go.lock go test ./coderd/ -run 'TestForkSavedWorkflowPermissions|TestForkShareUserSavedWorkflow|TestForkOrganizationSavedWorkflows|TestForkUserSavedWorkflows|TestForkSavedWorkflow' -count=1: pass.
  • New TestForkSavedWorkflowPermissions covers the personal owner (all true), a site owner on a member's personal row (delete only, checked against the real handlers), an organization member (none), organization admin and site owner on organization rows (all), an author whose shared workflow is revoked (edit rights, then none), and a scoped key with organization skill create and update but no read (update false, and the patch fails).
  • pnpm test src/pages/AgentsPage/AgentSettingsPage/ForkSavedWorkflowsPage src/pages/AISettingsPage/ForkWorkflowsPage: 3 files, 46 tests pass. Two new cases assert the delete request for an organization workflow another member made and for a delete-only personal workflow. The existing share test asserts the share request.
  • pnpm test:storybook on ForkSavedWorkflowsPage.stories.tsx: 9 stories pass. New stories open the row menu for full rights, delete only, and an editable organization row, so the screenshots cover which items show.
  • pnpm lint:types and biome check --error-on-warnings on the changed directories: clean.

Negative controls

Each was applied, run, and reverted.

  • Helper returns the zero value: PersonalOwner fails, expected all true, got all false.
  • Organization list drops the ACLs: SharedThenRevoked fails, expected edit rights, got none.
  • Share skips the author check: PersonalSiteOwner fails, expected Share false, got true.
  • Organization update skips the read check: OrganizationUpdateWithoutRead fails, expected update false.
  • Production ForkSavedWorkflowsPage.tsx and ForkSavedWorkflowsTableView.tsx restored to the base: the organization delete case fails, the other 14 pass. The personal delete-only case passes either way, because the old page also allowed delete on personal rows.

Not exercised

  • Storybook stories ran in the story test runner but were not inspected visually.
  • The AI settings ForkWorkflowsPage is unchanged and still uses its own access rules.
  • make lint fails on issues already on main (golangci-lint, react compiler check, typos), none in the files this PR changes. lint/go/new-code and lint/markdown pass.

The saved workflow responses now carry permissions with update, delete
and share, computed for the caller with the same RBAC checks the
handlers use. The member workflows page shows only those row actions
instead of guessing from created_by, so a revoked author loses Edit
and Delete and a caller with broader rights keeps them.

Closes #423
@ibetitsmike

Copy link
Copy Markdown
Owner Author

Coder Agents acted on behalf of @ibetitsmike.

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-23T07:33:07.956673Z c37c432 Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cfbdf1714d

ℹ️ 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".

@ibetitsmike

Copy link
Copy Markdown
Owner Author

Coder Agents acted on behalf of @ibetitsmike.

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 287c035f00

ℹ️ 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".

Comment thread coderd/fork_saved_workflows.go Resolved
@ibetitsmike

Copy link
Copy Markdown
Owner Author

Coder Agents acted on behalf of @ibetitsmike.

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep them coming!

Reviewed commit: 24def7539c

ℹ️ 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".

@ibetitsmike

Copy link
Copy Markdown
Owner Author

Coder Agents acted on behalf of @ibetitsmike.

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Delightful!

Reviewed commit: c37c4328aa

ℹ️ 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".

@ibetitsmike
ibetitsmike merged commit 720ef7b into main Nov 23, 2026
10 checks passed
@ibetitsmike
ibetitsmike deleted the mike/issue-423-workflow-row-actions branch November 23, 2026 08:15
@ibetitsmike

Copy link
Copy Markdown
Owner Author

Coder Agents acted on behalf of @ibetitsmike.

Merged at head c37c4328aa0bf21ab91564a51b4d3c7091c56e7b as 720ef7b, on main 7321fdabfee8bab2f1329f7fc19345a5c902e050, with the server running that main.

Gates on this exact head:

  1. The head matched the SHA I verified (--match-head-commit).
  2. Every check run passed. fork-ci run 45131372935 passed on this head.
  3. Codex receipt for this head: feat(coderd): return per-caller actions on saved workflows #430 (comment) ("Didn't find any major issues", Reviewed commit c37c4328aa).
  4. No unresolved review thread. The workstream fixed the earlier P2 (organization update needs read, since the patch handler reads first) and resolved its thread.
  5. 0 commits behind main.
  6. Test evidence I ran in the PR worktree at this head:
    • flock ~/.fork-go.lock go test ./coderd/ -run 'TestForkSavedWorkflowPermissions|TestForkShareUserSavedWorkflow|TestForkOrganizationSavedWorkflows|TestForkUserSavedWorkflows' -count=1 -v: ok, 24 tests and subtests passed.
    • Go negative control: with the organization update check set to true and the personal share owner check removed in forkSavedWorkflowPermissions, the PersonalSiteOwner, OrganizationMember, OrganizationUpdateWithoutRead and SharedThenRevoked subtests fail.
    • pnpm exec vitest run --project unit on ForkSavedWorkflowsPage.test.tsx: 15 tests passed.
    • Site negative control: with the row update and delete actions hardcoded to true, "lets a member manage personal workflows and only read organization ones" fails.
    • Both controls reverted, and the worktree was clean afterwards.

What this changes: saved workflow responses carry permissions (update, delete, share) for the caller, computed with the same authorizer checks as the handlers that change the row, on rows already loaded, so the list makes no extra queries. The member settings page shows only the actions those allow, instead of deciding from created_by. Closes #423.

Not exercised: a live browser session, and Storybook opened by hand (the stories ran as tests). The AI settings workflows page is unchanged.

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.

saved workflows: derive row actions from effective permissions, not created_by

1 participant