Repository navigation
fix(platform): disable add-credential Back while its save is pending - #4269
Merged
Merged
Conversation
The add-credential wizard, which Connectors and AI providers share, refused to close and disabled Cancel while a create was in flight, but the header's Back still cleared every field. A refusal arriving later, such as a 409 for a name already taken, then landed on a fresh, empty form, and the name, login and servers the request was sent from were gone. Back now waits out the save the same way: the shared Dialog takes a `backDisabled` flag for its back control, and the wizard sets it while the create is pending. Its handler checks the same pending state, which also covers the consent pane's back and close hand-offs. An idle Back still starts over, as before. The connectors manual suite gains CONN-B12 for the throttled round, and the automation register names the component tests that own its logic. Closes #3674
Contributor
Author
|
✅ Independent review — ACCEPT Reviewed exact head Evidence against TALE-212 / #3674:
Checks run (targeted only, no CI rerun/cancel):
No merge, push, or CI action taken. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
Connectors and AI providers share the add-credential wizard (
credentials/credential-add-dialog.tsx). While a create was in flight it refused to close (handleOpenChangereturns early) and disabled Cancel. The header still receivedonBack: backToPickerwith no check, though, andbackToPickerclears the vendor and every setup field. ThehandleSubmitthat was still running then wrote its refusal into whatever form was mounted. In #3674's sequence (submit a taken name, Back, pick the connector again), the server's 409CREDENTIAL_NAME_TAKENlanded on a fresh, empty form, and the name, login and servers it was sent from were gone.@tale/uiDialogtakes an optionalbackDisabled. It putsdisabledon the back control, styleddisabled:pointer-events-none disabled:opacity-50as insegmented-control, so a sub-view can hold Back the way it holds its Cancel. The defaultfalseleaves every other caller as it was. The prop is in the props table inservices/ui-docs/content/components/dialog.md.backDisabled: create.isPending. Back's handler (leaveSetup) also returns early while the create is pending. The consent pane'sonBackuses the same handler, and itsonClosechecks the same state. No shipped consent pane calls either one today, but the adapter contract hands them over, and they were the remaining exits out of step two.backToPickerstays the unguarded internal reset, used after a successful save and on an accepted close.CONN-B12intests/manual/suites/connectors.mdcovers the throttled real round;reference/automation.mdnames the component tests that own the logic.Tests
app/features/settings/credentials/credential-add-dialog.test.tsx(new). It runs at the issue's seam: the real wizard, the connectors adapter, the realuseCreateCredential(react-query'sisPending) and its HTTP adapter row. Onlyfetchis stubbed. It holds the create POST, then answers it with the server's own 409 body for a taken name (assertNameFree's sentence).onBackandonClosewhile the create is pending neither leaves nor closes, and the refusal keeps the draft.packages/ui/src/components/dialog/dialog.test.tsx:backDisableddisables the back control and never callsonBack. Without it, the control is enabled and callsonBack.How I verified it
Everything ran locally and stayed light, as the dispatch asked: targeted jsdom tests at head
e77204b6437efd5553f4bf5d44513044c7cef793, on a shared host with load average 14–37. I ran no stack, browser, full suite or workspace-widetsc; CI runs those.Reproduced on
mainfirst. The new platform test againstorigin/maina9a19afdcsources: test 1 failed atexpect(back).toBeDisabled(), test 2 (the control) passed.The issue's exact sequence, replayed by an uncommitted probe on the same harness:
mainsources: Cancel was disabled and Back was not. Back showed the picker, and re-picking openedname="IMAP / SMTP Mailbox" username="" password="" imapHost="" smtpHost="". The held 409 then showed its "Office mailbox is taken" sentence over that empty form.name="Office mailbox" username="[email protected]" password="mailbox-secret" imapHost="imap.example.com" smtpHost="smtp.example.com".Base control and single-layer mutants at the pushed head.
mutation-check.shswaps one layer tomainor drops one guard line, then restores the head withgit checkout --; the worktree was clean afterwards.Dialogtests (18)maintoBeDisabled, 2 ✓, 3 ✗ (consent back showed the picker)backDisabledcase ✗DialogfrommaintoBeDisabled, 2 ✓, 3 ✓backDisabledcase ✗leaveSetuppending checkonClosecheckonOpenChangecalled)backDisabledtoBeDisabledNeighbours at head:
credentials/(add, edit, error mapper, picker),providers-settings.test.tsxandconnectors-settings.test.tsx, run together on two workers, passed 76/78.connectors-settings.test.tsxpassed 31/31, those two in 2.6 s and 2.9 s.packages/uidialog,view-dialogandentity-view-dialogtests passed 31/31.Lint and format:
bunx oxlint --type-awareon the four changed TS files, from each workspace, came back clean.oxfmt --check,commitlintandlint:conflictswere clean.Types: a scoped
tsc --noEmitof the changed platform files came to 2,673 program files,Dialogincluded, and was clean. One ofdialog.tsxand its test, underpackages/uipaths (440 files), was clean too.Manual-layer gates:
check-guide.ts suites/connectors.mdprinted OK, andbun run lint:manualwas ok (5 trees, 1,448 boxes).Not run: a real browser on a throttled network (
CONN-B12), the AI providers surface in a browser, SAST, and the full suites. The visual gate is unrun under this light-jsdom admission.Closes #3674