Repository navigation
fix(site): hold the save action while a cached permission check refetches - #417
Conversation
…ches The Save workflow dialog held its submit only while the organization permission check loaded for the first time. A cached answer that refetches on open counted as resolved, so a grant revoked while the cache looked fresh could take a submission. isPermissionChecking now follows orgPermissionQuery.isFetching, which covers both a first load and a refetch. When the fresh answer denies or fails, effectiveTier settles the submitted tier to personal-only, so a selection made while the answer was in flight does not survive. Also drops hook state no consumer read (saveTarget and saved.organizationId) and derives SaveTier from SavedWorkflowScope["tier"] instead of a re-declared union. Closes #413.
@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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 14126d17f5
ℹ️ 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 of 14126d1 flagged that a refetch of a cached denial held the submit with no loading state, because the loader sat inside the tier-choice block the cached denial hides. The loader now renders whenever the permission check is in flight, independent of what the cached answer shows.
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3623ba7c95
ℹ️ 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".
…ons, trim narration
@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". |
Merged at head Gates on this exact head:
What this changes: the save dialog holds submission while any permission check is in flight, including a refetch of a cached answer. A stale Organization selection falls back to Personal once the choice goes away. It also fixes the form-adapter comment, removes the unused Not exercised: a live server and browser session. Everything above is unit tests. Pre-commit hook: the workstream used the worktree-only opt-out from #407 and ran the targeted checks above. |
Closes #413.
What and why
The Save workflow dialog added in #411 held its submit only while the organization permission check loaded for the first time. A cached answer that refetches on open counted as resolved, so a grant revoked while the cache looked fresh could still take a submission.
useForkWorkflowSave: the hold now followsorgPermissionQuery.isFetching, which covers a first load and a refetch of a cached answer. The prop renames fromisPermissionPendingtoisPermissionCheckingbecause the meaning widened.ForkWorkflowSaveDialog: when the fresh answer denies or fails,effectiveTiersettles the submitted tier to personal-only, so a selection made while the answer was in flight does not survive as the submitted tier.saveTargetfrom the hook return andsaved.organizationId.SaveTieris now derived fromSavedWorkflowScope["tier"]instead of a re-declared"user" | "organization"union.formValues(the run does carry phases; they are run state, not the declared list the form wants) and the stale React-Compiler note.How tested
holds the submit while a cached permission answer refetchesinForkWorkflowRunDetail.test.tsx: seeds a stale cached grant, opens the dialog, asserts the loader and disabled submit while the refetch is in flight and a click sends nothing, resolves the refetch with the grant confirmed, selects Organization, invalidates the query, asserts the submit holds again during the fresh refetch, resolves it with a denial, asserts the radio is gone and the stale selection does not land, re-submits, and asserts only the personal create API was called.isPending && !isErrorexpression makes the new test fail (1 failed of 13); restoringisFetchingmakes all 13 pass.pnpm exec vitest run --project unitonForkWorkflowRunDetail.test.tsx(13/13) andForkWorkflowTool.test.tsx(24/24).pnpm lint:types(tsc) clean.pnpm exec biome checkclean on the three touched files.pnpm formatno changes.seedCreatePermissiongained an options param with astaleflag that keeps the seeded answer alive but stale (the test client'sgcTime: 0would otherwise evict it before the dialog observes it) and returns the query key.Pre-commit hook
Pre-commit was opted out in this worktree per the interim rule in #407 (
git config --worktree coder.pre-commit false); the hook's own classification would run the site checks this PR already ran by hand:pnpm lint:types): cleanNote on full
pnpm lint: it fails atlint:compiler(check-compiler.mjs) onForkAgentMentionMenu.tsxandForkHtmlAttachmentViewer.tsx. This is pre-existing on a clean checkout of the parent commit of this branch (verified by stashing and re-checking out), those files and the compiler script are byte-identical tomain, and this PR touches neither. All other lint stages pass.Not exercised
CompletedSaveDialogPermissionPendingalready covers the loader state visually.pnpm checksuite was not run green because of the pre-existinglint:compileritem above.