Repository navigation
feat(site): send expect_id with saved workflow saves and deletes - #400
Conversation
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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7e60df3f83
ℹ️ 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".
@codex review |
|
Codex Review: Didn't find any major issues. More of your lovely PRs please. 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". |
- only an absent id writes unconditionally; an empty string reaches the throwing search-param builder instead of being dropped - the 409 editor test asserts the conflict refetch of the list - the axios test exposes hoisted spies and asserts the encoded URLs - the architecture prose limits the write-only-scope claim to the member PATCH and organization DELETE routes
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6127bdd402
ℹ️ 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".
- Treat a params object without expect_id, not only an absent params argument, as an unconditional write; only an explicit empty expect_id still fails closed (Codex round 3, finding 1). - Drop the explicit refetchForEdit from the 409 save handler: the mutation's own non-exact invalidation already refetches the list and detail queries. Proved with a TEMP-disabled refetch: the list spy still advances without it (finding 2). - Strengthen the 409 page test: after the conflict, edit the retained draft and save again, asserting the retry still targets the workflow the editor loaded with the same expect_id (finding 3). - Report the stale-write toast for a 404 as well as a 409, so a workflow deleted after the editor loaded it explains why the save was rejected and that the draft was kept (finding 4).
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2d524052ae
ℹ️ 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 stale-write toast now covers 404 as well as 409, but only the 409 arm had a page test. Add the 404 case: a workflow deleted after the editor loaded it keeps the draft in the open editor, fires the explanatory toast, and the mutation invalidation refetches the list.
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 74ba6f36d3
ℹ️ 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".
- ARCHITECTURE.md now says the 409 only covers a stored workflow whose id differs, and that a workflow deleted before the write, or one the caller may not see or touch, answers the plain not-found 404, which okAfterConditionalWrite does (Codex round 5, finding 1). - The URL boundary suite runs over both route families, personal and organization, so a dropped params forward or a wrong organization URL fails a test (finding 2). - The 404 page test drops its dialog-presence claim and proves the retained editor through a second conditional save, like the 409 test (finding 3).
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e6260f510e
ℹ️ 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".
- UpdateSavedWorkflowArgs.id now states the guard in its true direction: the write goes through only when the stored workflow still has that id, and the server rejects it with 409 otherwise (Codex round 6, finding 1). - Add the StaleSaveError story to the editor dialog, capturing the retained draft with the stale-save message a 404 or 409 leaves (finding 2).
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4502a2bf56
ℹ️ 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".
Codex round 7 found the conflict mocks kept returning the original workflow after the save was rejected, so the asserted retry could not distinguish the stale guard from a plain success, and the boundary test file missed its trailing newline. The mocks now flip to the server state the first rejected save implies: the 409 test refetches a replacement under the same name and asserts the replacement lands in the cache before a second submit, which the stale guard then blocks with no second request and the explanatory banner; the 404 test refetches a list without the row and asserts the same. The boundary test file ends with a newline.
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 11918b3c05
ℹ️ 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".
Align the ARCHITECTURE.md 403 prose with okAfterConditionalWrite: the probe that forwards a denial answers 403 for a readable but unwritable row, and 404 only when the row is hidden. Document that the query layer rejects an empty expect_id locally. Drop the banner text assertions from the 409 and 404 page tests; the stale guard there is non visual and the StaleSaveError story covers the banner.
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 874db4adc1
ℹ️ 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".
…e toast The 409 branch reports a replacement under the same name and the 404 branch reports deletion or a hidden row, so the comment now says that. A scope change or a replaced editor can discard the draft while the request is pending, so the toast asks the user to copy unsaved changes from the editor if it is still open instead of promising the draft.
@codex review |
|
Codex Review: Didn't find any major issues. Hooray! 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 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b1b627cb86
ℹ️ 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".
A mismatch answers 409 only when a workflow the caller may write holds the name, and 404 when the name holds nothing or a row the caller may not see, so the type doc says that instead of calling every failed match a conflict.
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 677f054bc9
ℹ️ 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".
A mismatch answers 409 only when a workflow the caller may write holds the name, and 404 when the name holds nothing or a row the caller may not see, matching the revision guard docs on the query layer.
@codex review |
|
Codex Review: Didn't find any major issues. More of your lovely PRs please. 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 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 90dc174fd6
ℹ️ 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".
Valid finding, fixed in 1a0206f: the 404 branch of the stale-delete handler now says the name no longer resolves to the picked workflow because it was deleted, or because the server hides the stored row or its hidden replacement from the caller and answers not-found for that. |
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1a0206f3b1
ℹ️ 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".
@codex review |
|
Codex Review: Didn't find any major issues. Breezy! 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 at head Gates on this exact head:
Tests I ran on
Review notes:
Not exercised: the race in a dev build. Coverage uses mocked API calls. |
…ork-workflows) (#404) * feat: members share personal saved workflows with the organization (fork-workflows) Adds POST .../members/{user}/workflows/{workflow}/share, which moves a personal workflow to the organization tier in one statement. The owner keeps read, update and delete through user_acl, and the Everyone group gets read. The member Workflows page gains a Share action and lets the owner edit and delete the organization workflows they shared. Closes #395 Closes #327 * fix: only the owner shares a saved workflow, clearer share errors (fork-workflows) * refactor(site): extract the share dialog, behavior-only share tests (fork-workflows) * fix(site): keep a shared workflow listed in the organization cache (fork-workflows) * chore(site): document the share dialog, trim the share tests (fork-workflows) * fix(site): share uses the conditional write params from #400 (fork-workflows) * fix(site): drop a stale shared row before its dialog closes (fork-workflows) * chore(site): name share test fixtures Mock*, narrow the share state contract (fork-workflows)
Closes #392.
What changed
The saved workflows pages now use the conditional-write guard the server gained in #394.
loadedFrom). The server rejects the save with 409 when the stored workflow under that name has another id, so a stale editor cannot overwrite a replacement.SavedWorkflowChangedError, whose handling already shows the info toast and refetches. The conditional write on the server makes the client-side check redundant, and it closes the window where the workflow changed between the check and the delete.coderd/x/chatd/ARCHITECTURE.mdreplaces its expect_id TODO with final prose describing the shipped behavior.Why the delete fast path went away
The GET-then-compare was the only guard the server offered before #394. Keeping it would add a request and still race; the conditional delete now does the same check atomically on the server. The 404 case (workflow already gone) keeps the same user-visible outcome.
How it was tested
pnpm exec tsc --noEmitclean;biome lintclean on the touched files.vitest runonsrc/api/queries/forkSavedWorkflows.test.ts(15 tests),src/pages/AISettingsPage/ForkWorkflowsPage/ForkWorkflowsPage.test.tsx(19 tests), andsrc/api/forkSavedWorkflows.test.ts(1 test): all pass. New coverage asserts expect_id on the save and the delete, the unconditional-write negative control, the 409 delete refusing with an info toast and no list change, the 409 save keeping the draft and refetching, and the empty-expect_id rejection.