Repository navigation
fix(platform): raise one toast per failed write and guard the rule - #3806
Merged
Merged
Conversation
A save through `useFormEditor`'s `submit` (Enter in a field, a `type="submit"` Save) only logged a server failure: the write's own toast was its only report, so a write that stays quiet left the failure silent. `submit` now raises the one toast `EditorActions` raises on the button path, through a shared `toastSaveFailure`. `BulkArchiveBar` and `EntityDeleteDialog` take a `describeFailure`, as `BulkDeleteBar` does, so their one failure toast can carry the refusal's words once the row's own write stays quiet.
`firstFailureDetail` reads a batch surface's refusals the way the teams table's local helper did: the first refusal's words, through `failureDetail`. The bulk bars of the other tables pass it too once their rows' writes stay quiet.
Closing, reopening, spam, delete, assignment, the outbound-message undo, retry and discard, and the improve-message action each raised the write's default toast beside the header's, the panel's, the picker's or the editor's own. Those writes keep their toast quiet now, and the callers' toasts say why. The connector send stays quiet at the hook: the editor and the bulk send's summary toast report it.
A knowledge entry's or a website's create, edit or delete, and a contact or product import, raised the write's default toast beside the dialog's, the delete dialog's or the bulk bar's own. Those writes keep their toast quiet now. The delete dialogs and bulk bars of contacts, products, knowledge entries, websites and API keys pass `describeFailure`, so their one toast names the refusal.
A folder create, a retried index, a stopped sync, a folder's teams, a cloud disconnect, an automation settings save and the upload writes of the uploads panel, the chat and task attachments raised the write's default toast beside the caller's own toast or batch summary. Those writes keep their toast quiet now, and the callers' toasts say why; a folder the uploads panel adopts because it already exists no longer toasts a failure at all. The cloud pickers' listings run their write as a query that retries it twice, so one failed folder raised up to three toasts, and a listing the backend answered with `success: false` raised none. Their writes stay quiet, and the import dialog raises one toast for the query's final error (`useListingFailureToast`), leaving a lapsed grant to the connect dialog.
Every project write raised its default toast beside the dialog's, the tab's, the row menu's, the Save cluster's or the bulk archive bar's own report of the same failure. The project hooks and the files tab's upload and re-index writes keep their toast quiet now. A caller's fallback toast says why, a refusal it knows by code keeps its house sentence, and the projects table's bulk archive names the first refusal.
`useUpsertGovernancePolicy` already took `errorToast`, but 19 of its 22 callers left it on while reporting the failure themselves: a toggle's or a section's own toast, or the Save cluster for the editors whose `save` rethrows. They pass `errorToast: false` now. The DSAR proposal (whose comment already said its editor toasts), the retention save, the moderation key, the bounds proposal, the legal-hold and data-subject request dialogs, the trash restore and the pending-retention cancel keep their toast quiet at the hook for the same reason.
The profile name, branding, data-residency and enterprise SSO saves raised the write's toast beside the Save cluster's, and their removals, tests, imports and tokens, the notification toggles, member adds, WebDAV app passwords, sandbox controls and the SSO app reuse beside the page's own toast. Those writes keep their toast quiet now, and the pages' toasts say why. The connector and provider credential writes opt out as the header comments of their hooks already claimed: the dialogs show a refusal inline, the row menu in its own toast. Where some callers only log, the hook takes the option instead: the members table's bulk remove and the image upload field pass `errorToast: false`, while the single remove dialog and the logo's derived favicon keep the default toast. The members table's comment promised one batch toast while each failed row raised its own.
The task modal, the subject panel, the dependency, label, archive and delete dialogs, the agent-run controls and the attachment uploads each toasted a failure the write had already toasted. Those writes keep their toast quiet now, and the callers' fallback toasts say why. Where a caller only said "Something went wrong", it leaves the report to the write instead: the comment thread, the request-changes box, the watch toggle and the assignee hand-off, and the modal's assignee picker, whose failure `useAssignTask`'s toast already names (a live run holding the task). `useUpdateTask` and `useCancelTaskAgentRun` take the option, since the board card, the list row and a status move still rely on the default toast.
The skill detail pane's save and delete and the upload pane toasted a failure the write had already toasted: the save's publish-refusal feedback, the delete's default toast, and one from each of the bundle upload's three hops. `useSaveSkill` takes `errorToast: false`, spread after its refusal feedback so the opt-out wins while a refused audience still refreshes the listing; the detail pane passes it and names the refusal in its own toast. The delete and the upload hops keep their toast quiet, and the delete toast says why. The skills hook test now pins the upload hop's opt-out.
A failed `useBackendMutation` / `useBackendAction` raises its own destructive toast unless the call passes `errorToast: false`, and 182 callers on main reported the same failure again: their catch, `.catch` or `onError` toast, a batch summary toast, `EditorActions` for a rejected editor `save`, the bulk bars or `EntityDeleteDialog` for a rejected callback, or a query retrying the write. The guard parses every app source file with the TypeScript compiler, indexes each write that toasts on failure (a direct call, a hook returning one, resolving option-forwarding hooks by their call-site argument, a hook returning a function that rethrows one, and a hook an adapter object names), and follows each invocation's rejection through awaits, returns, rethrowing catches, local functions and their callers to the place that reports it. It fails on a second toast, naming the write and the caller. Five pairs stay allowlisted with #3784, which fixes its bulk verbs; the entries turn stale when it lands. `.agents/repo.md` states the rule.
yannickmonney
force-pushed
the
fix/one-failure-one-toast
branch
from
September 29, 2026 05:31
2113f35 to
0627d95
Compare
The header, the panel and the assignee picker reported a refused close,
reopen, spam mark, delete, undo, retry, discard or assignment only from
`mutate(args, { onError })`, with the write's own toast quiet. React
Query drops that callback once another `mutate` starts on the same hook,
or once the caller unmounts before the write settles: Retry on two
failed messages with the first refused, or a second pick in the picker,
said nothing.
Each of these writes now raises its own failure toast, under the verb's
title with the refusal's words, which fires for every call; the callers
drop their own.
A write that opts out of its own toast was reported by the caller's
`mutate(args, { onError })` alone in the knowledge-entry, product and
website dialogs, the document and folder deletes, the OAuth app reuse
and remove, and the voice-output and routing-rule saves. React Query
drops that callback once another `mutate` starts on the same hook or the
caller unmounts first, so a quick second toggle, or a dialog closed
while it saved, left the refusal unreported (and a refused routing rule
unreverted).
Each now reads the outcome from its call's own promise,
`mutateAsync(args).then(onSuccess, onError)`, which always settles.
A cloud listing the provider answered `success: false` threw a plain
Error carrying `result.error`, which the backend builds from the
provider's raw response (`OneDrive API error: 403 {…}`). The listing
toast read it as a sentence meant for display, so a Graph or Drive
refusal put its English body under the localized "Couldn't load items".
The listings now throw a `CloudListingError`: its message keeps the raw
answer for the log and the lapsed-grant check, and the toast carries its
title alone. A refusal the door answered still says why.
The Microsoft 365 picker handed a lapsed grant to the connect dialog only when the files or the SharePoint sites listing saw it. One that first showed on the drives or the SharePoint files listing was skipped by the listing toast and never handed off, so the picker said nothing. The dialog test runs the real listings, their retries and the adapter rows: a failed listing raises one toast after three attempts (the title alone for a `success: false` answer, the words of a refusal), and a lapsed grant, on the drives listing too, opens the connect dialog with no toast.
A failed cancel on a task's agent run said "The agent run could not start" (`agentRun.notStarted`). That toast is the failure's one report, so it now reads `agentRun.cancelFailed` in en, de and fr, with the refusal's words beneath.
The single-failure-toast guard counted a `mutate` call-site `onError` as the caller's report, so it could not see a quiet write whose only report React Query drops once another call starts or the caller unmounts. It now fails on a quiet write reported only from `mutate`'s `onError`, and on a `BulkDeleteBar`, `BulkArchiveBar` or `EntityDeleteDialog` handed no `describeFailure`: removing one used to fail no test. A hand-written controller declared an `EditorController` counts as an editor even without `reset`, and the sample table holds one. The member table's bulk remove proves the wiring end to end: two refused rows raise one toast naming the first refusal's words.
The rule named the bulk bars, the delete dialog and `EditorActions` as a caller's report, but the guard also follows `EnvVarListEditor` and a write run as a query's `queryFn`. It now names both, a hand-written `EditorController`, and says a write that opts out is reported from its call's own promise or keeps its own toast, never from `mutate`'s `onError` alone.
SET-B22 judges a save refused on Enter in one toast with its reason, and KNOW-B16 a failed cloud listing in one localized toast, never one per retry nor the provider's own answer: the toaster shows one toast at a time, so a second one taking the first's place is judged by hand. automation.md names the specs that own the rest, and the guard.
This was referenced Sep 29, 2026
yannickmonney
added a commit
that referenced
this pull request
Sep 29, 2026
This was referenced Sep 29, 2026
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.
Follow-up to #3763 / #3795, which set the rule "one failure → one toast". A failed
useBackendMutation/useBackendActionraises its own destructive toast unless the call passeserrorToast: false, and a caller that reported the same failure again showed two (or, for retried queries, up to three). Onmainthe new guard finds 183 such write-to-caller pairs.What changed
Shared surfaces (
packages/ui)useFormEditor'ssubmit(Enter in a field, atype="submit"Save) only logged a server failure, so the write's own toast was its only report. It now raises the same single toastEditorActionsraises on the button path, through a sharedtoastSaveFailure. Without this, opting the editors' writes out would have left the Enter path silent.BulkArchiveBarandEntityDeleteDialogtake adescribeFailure, asBulkDeleteBaralready did, so their one toast keeps the refusal's words once the row's write stays quiet.services/ui-docssettings-page pattern:submitreports a server failure, and the persistence call's own toast stays quiet.Platform
errorToast: false, with a comment naming who reports. This covers conversations, contacts/products imports, knowledge entries, websites, documents and folders, the upload writes, projects, governance, data residency, enterprise SSO, notifications, WebDAV, sandboxes, the connector and provider credential writes (whose header comments already claimed this), and tasks.useUpsertGovernancePolicy(19 call sites);useUpdateTaskanduseCancelTaskAgentRun(the board card, list row and status move keep the default);useRemoveMember(the bulk bar opts out; the single remove dialog keeps the default);useSaveImage(the upload field opts out; the logo's derived favicon keeps the default).useAssignTask's toast already names.failureDetail). A refusal it already names by code keeps its house sentence.describeFailure(firstFailureDetail, now shared with the teams table).useListingFailureToast, skipping the lapsed-grant hand-off. A listing answered withsuccess: falseused to raise no toast at all; it now raises that one.createOrAdoptno longer shows a failure toast for a folder it adopts.useProposeDsarPolicy("its editor toasts", while it didn't opt out), and the provider/connector hooks' header comments (now true).Guard:
services/platform/tests/guards/single-failure-toast.guard.test.tsparsesservices/platform/appwith the TypeScript compiler.mutations: { useUpdate })..catchoronErrortoast, a batch summary toast that reads the recorded failures,EditorActions/useFormEditorfor a rejectedsave, the bulk bars,EntityDeleteDialog,EnvVarListEditor, or a query'squeryFn..agents/repo.mdstates the rule.Coordination with other PRs
mainintests/manual/suites/conversations.md, independent of this PR.) The bulk send double, which fix(platform): make Inbox assignment, selection and activity reliable #3784 leaves, is fixed here at the hook, without touching its lines.useSaveSkillnow takeserrorToast: false, spread after feat(platform): let admins reserve organization-wide skill sharing #3801's publish-refusal feedback, so the opt-out wins and a refused audience still refreshes the listing. The detail pane passes it and names the refusal (publishing.refused) in its own toast; the create pane keeps the hook's toast.useUploadSkillBundletest pinnederrorToastas undefined, which left the hop's default toast on beside the upload pane's own. It now pinsfalse.skill-sharing-policy-editor(anEditorActionscontroller) passes{ errorToast: false }.git merge-tree) of this branch with fix(platform): make Inbox assignment, selection and activity reliable #3784 and fix(platform): keep custom provider edits whole and version-checked #3778 introduce no conflict of this PR's own.How I verified
Guard: on today's
main(a6f7d09) it finds 183 pairs, 178 unexempted, so it fails. The 183 are the 182 of before feat(platform): let admins reserve organization-wide skill sharing #3801 plus feat(platform): let admins reserve organization-wide skill sharing #3801's new editor. On this branch it finds 5, all allowlisted against fix(platform): make Inbox assignment, selection and activity reliable #3784, and all 30 of its tests pass. Before the rebase, the list ond7f1ee080matched the brief's pairs area by area, plus two it lacked (conversation-assignee-picker'sonErrorbesideuseAssignConversation/useAssignConversationTeam).New tests, each red on the old code and green now:
use-form-editor.test.tsx(submit: one toast, never a payload, quiet on validation, cancel and mapped field errors);data-table-bulk-actions.test.tsxandentity-delete-dialog.test.tsx(describeFailure);account-form.name.test.tsx(one toast on Enter).Also new:
use-listing-failure-toast.test.ts,adapters.test.ts(firstFailureDetail), and updated toast expectations in the account, create-folder and team-tags tests.Locally, all passing. On the pre-rebase base (
d7f1ee080):vitest.ui.config.tson the 167 test files importing a changed module (1,571 tests);packages/uieditor, data-table and entity suites (157 tests);After the rebases (onto feat(platform): show who created and last edited a skill #3786, then feat(platform): let admins reserve organization-wide skill sharing #3801): the guard suites, the skills suites and the new skill-sharing editor's suite. CI runs the rest on the rebased tree.
oxlint --type-aware --type-checkis clean on every changed file.A companion audit that follows the quiet writes finds no new path where a failure reaches neither a toast, an inline error nor a summary. It reports the same 14 candidate paths as base
main, all pre-existing and outside this change.Real browser, on a local stack (Postgres, backend and Vite; the backend is the same for both runs, since this PR changes no backend code). A Playwright script refuses one write per flow with a 409
{error, message}, and aMutationObserverrecords every toast the app inserts:main(62f8204)The toaster shows one toast at a time (
TOAST_LIMIT = 1), and React batches toasts raised in the same tick. So onmainthe write's default toast was usually replaced before it painted, and the person saw the caller's toast without the reason the default toast had carried. The double still shows wherever the two toasts land in separate ticks: a query's retries, rows settling at different times. Onmain, one run also caught an unrelated "Tale is ready to work offline." PWA toast.Left open