[Dashboard] Guard the vault rotation dialog against losing new keys - #8921
Conversation
Rotation returns an ejected vault's admin key and wallet access token once and keeps no copy. - Make the dialog non-dismissable while the request is in flight and while unconfirmed keys are on screen. The old guard derived from mutation data, so it did nothing during the request. - Warn on unload in those same two states. - Branch the result on isManagedVault rather than on which fields came back. An ejected response missing either credential now renders an explicit error state instead of the managed success panel. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Review limit reached
On-demand reviews are free for the next 25 days. After that, they cost $0.25 per reviewed file. Or wait 3 minutes for your next included review. View limit detailsLimit details: You’ve used all 3 included reviews currently available. Your 43 included PR review attempts over the past 7 days set your current allowance at 3 reviews per hour. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
Included review availability: 1 review is currently available. Your included PR review attempts over the past 7 days set your current allowance at 3 reviews per hour. WalkthroughThe rotation dialog now distinguishes ejected-vault credentials from managed-vault responses. It protects pending and unconfirmed ejected credentials from dialog or browser closure, and reports when rotated credentials cannot be recovered. ChangesVault rotation handling
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to The dialog now keeps newly returned credentials protected during rotation and confirmation, with explicit handling for missing values; no actionable merge-blocking risk remains after normal checks and review. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Description checkExplanation The description explains the problem, lists the implemented changes, states that the API contract is unchanged, and records verification results. It does not use the template headings exactly, but it provides the required information. ✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Comment |
size-limit report 📦
|
Closing the dialog discards the response, and for an ejected vault that response is the only copy of the new keys. Blocking Escape, the backdrop and the close control left the confirm checkbox as the only way out, so an impatient click could still drop them. The checkbox is now disabled until the keys have actually left the screen: either downloaded, or both values copied. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Rotating an ejected vault returns its new admin key and wallet access token in the response and keeps no server-side copy, so the dialog is the only place those values ever exist. Two paths in the dialog could drop them.
Changes
useMutation.data, which isundefineduntil the response lands, so it did nothing during the request — and dismissing there callsmutation.reset()without aborting the POST, discarding a response the server has already committed.data.isManagedVaultinstead of on which credential fields came back. Managed keeps the masked-key panel; ejected always renders both credentials with the existing download and confirmation gate.No API or contract change; the server response shape is unchanged.
Verification
npx tsc --noEmitfromapps/dashboard— exit 0eslinton the changed file — exit 0biome checkon the changed file — only the repo-wide CRLF format complaint this checkout produces on untouched files too; an LF-normalized copy checks cleanPR-Codex overview
This PR enhances the
RotateAdminKeyButtoncomponent by adding new state variables and improving the handling of key rotation responses, including better user prompts for storing keys and handling cases where keys are not returned.Detailed summary
adminKeyCopiedandaccessTokenCopiedstate variables.rotateAdminKeyMutationresponse.Summary by CodeRabbit
New Features
Bug Fixes