This repository was archived by the owner on Nov 4, 2026. It is now read-only.
Repository navigation
fix(plugin-form): a later master-detail save outcome supersedes the earlier one - #7356
Merged
Merged
Conversation
…arlier one (#7345) MasterDetailForm raised its two save outcomes as two unrelated toasts: handleSaved's confirmation and handleError's refusal, each under sonner's auto-generated id. Nothing held a handle on the previous attempt's toast, so a save the server refused left its error on screen and the confirmation of the corrected retry landed beside it — the form ending on a screen that asserted both outcomes at once. This is the objectui#7252 defect class on a renderer PR #7342 did not touch: its surface was the SDUI form renderer and the console's FormPage, and both outcomes here are raised by this file, one line apart. Both now travel under one stable per-form id (React.useId()-scoped, "form-outcome:" + the id — the spelling #7342 landed), and each save attempt dismisses that id before it starts. The two halves close two different paths: - no host onSuccess (SDUI / embedded): the built-in confirmation is the fallback, and the shared id makes it supersede the refusal rather than stack beside it; - host onSuccess (the console): the built-in confirmation is deliberately skipped, so a shared id alone would retire nothing — the dismissal is what stops a stale refusal from standing over a save that succeeded. Measured, not assumed: the pin fails on that path with the id alone. Durations are untouched — the defect is supersession, and it reproduces inside any lifetime. Measured while pinning this and deliberately NOT changed here: a refused master-detail save currently puts the same refusal on screen twice, because the parent ObjectForm's renderer also toasts the write it re-threw. That is a distinct defect from supersession and is filed separately; the pin is written so its assertions do not depend on how many raisers report an outcome. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NRRumy89BYdW9ogbcdHTho
Four fixtures replaced the whole `toast` export with a hand-listed object carrying only `success` and `error`. The moment MasterDetailForm called one more sonner method, every test that mounts it died with "toast.dismiss is not a function" — 16 failures across 4 files, none of them about what those files assert. This is the check:vi-mock-inherit defect one level down: those factories already spread the real module (`...actual`), but froze the export surface again inside `toast`. Spreading `actual.toast` and overriding only the two methods each file spies on closes the class rather than this one method — the next sonner call the form makes cannot break them either. No assertion changes. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NRRumy89BYdW9ogbcdHTho
Contributor
✅ Console Performance Budget
The eager closure is every chunk the entry reaches through static imports — what the browser fetches and parses before the app renders. The entry chunk on its own is a small fraction of it. 📦 Bundle Size Report
Size Limits
|
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Fixes #7345
Branched from
4704aa4bb(PR #7342's merge). Final head2cb1f6ac1; every figure below was measured on this branch, and the closing run quotes that sha.Premise, re-verified on the base sha
Held. On
4704aa4bb,packages/plugin-form/src/MasterDetailForm.tsxraisedtoast.success(...)inhandleSaved(line 831) andtoast.error(...)inhandleError(line 850), neither carrying an id, and nothing dismissed the previous attempt's toast.outcomeToastIdhad 0 hits in the file; the control on the same ref isform.tsx:1155andFormPage.tsx:1597, which carry it.The change
One stable per-form id —
React.useId()-scoped,'form-outcome:'+ the id, the spelling PR #7342 landed — shared by both outcome toasts, plustoast.dismiss(thatId)at the top ofhandleSave, where an attempt commits. Durations untouched; nothing else in the file changes.The two halves close two different paths, and the ablation below shows both are load-bearing:
onSuccess(SDUI / embedded): the built-in confirmation is the fallback, and the shared id makes it supersede the refusal instead of stacking beside it;onSuccess(the console): the built-in confirmation is deliberately skipped, so a shared id alone would retire nothing — the dismissal is the only thing that stops a stale refusal from standing over a save that succeeded. The console's own behaviour is unchanged and is now pinned.The mock target, measured rather than assumed
MasterDetailFormimportstoastfrom@object-ui/components(line 37), the same spellingWizardFormuses. That root export is theui/sonnerwrapper's re-export —src/index.tsdoesexport * from './ui', whose index re-exports./ui/sonner, and the root vitest alias maps@object-ui/componentstopackages/components/src, so both spellings resolve to one module file. The pin therefore mocks@object-ui/components/ui/sonner, never baresonner(this package does not depend on it, so that mock would intercept nothing). The green run is itself the proof the mock is in the graph: a non-intercepting mock leaves the registry empty, which every assertion here would catch.Red first
On the unmodified tree the pin failed 3/3. The registry after a refused save was retried and accepted:
Both outcomes at once — the card's own sentence. After the change:
[ { type: 'success', message: 'Created' } ].Ablation
Each leg mutated the committed file, proved the mutation on disk by counting the injected and removed text (not by an editor exit code), ran the pin, then restored with
git checkout HEAD -- (abs path)and proved the restore by blob hash equality against the HEAD blob plus an emptygit diff HEAD. A restore trap covered the crash path. Nodist/is involved: the pin imports the source module directly and every workspace specifier is aliased tosrc.id: outcomeToastId2 occurrences to 0; dismissal still 1toast.dismiss(outcomeToastId)1 occurrence to 0; ids still 2onSuccesstestLeg B answers the question the card left open. Sonner does update a toast by id, so the two SDUI-path tests stay green without the dismissal; the host-
onSuccesspath has no success toast to supersede with, so only the dismissal retires the refusal there. The dismissal is not decoration.Fixture triage, named because it is outside the card's declared file surface
Four existing fixtures replaced the whole
toastexport with a hand-listed object carrying onlysuccessanderror. The first new sonner method the form called killed every test that mounts it:TypeError: toast.dismiss is not a function, 16 failures across 4 files, none of them about what those files assert.This is the
check:vi-mock-inheritdefect one level down — those factories already spread the real module (...actual) but froze the surface again insidetoast. Each now spreadsactual.toastand overrides only the methods it spies on, which closes the class rather than this one method. No assertion changed in any of the four. Files:MasterDetailForm.test.tsx,masterDetailFormTypeVocabulary.test.tsx,submitHandlerSeam.test.tsx,submitTargetRefusal.test.tsx.Out of scope, filed
#7354 — a refused master-detail save puts the same refusal on screen twice, because
ObjectFormre-throws to the form renderer, which toasts it as well. Distinct from supersession, and it needs a contract decision about which layer owns the message when a hostsubmitHandlerre-throws. The pin here is written so its assertions do not depend on how many raisers report an outcome, so this PR going green does not mask that one. Not addressed in this PR.Verdicts
Every exit code was captured by redirecting first, and each line below is the gate's own verdict text.
pnpm exec vitest run packages/plugin-form—Test Files 83 passed (83)/Tests 826 passed | 8 skipped (834)(82 files before this PR's new pin).HEAD=2cb1f6ac1, withgit diff HEADprinted empty inside the same locked command: the pin plus the four triaged fixtures,Test Files 5 passed (5)/Tests 71 passed (71).pnpm --filter @object-ui/plugin-form run type-check— exit 0, and the run echoed@object-ui/plugin-form@17.6.0 type-check, so it was not a zero-match no-op.tsc -p packages/plugin-form/tsconfig.test.json --listFilesputs all six touched sources in the compiled set, the new pin included (1 hit each) — the type-check verdict genuinely covers them.pnpm --filter @object-ui/plugin-form run lint—763 problems (0 errors, 763 warnings), all pre-existingno-explicit-any. Per-file against the fork blob, linted from the same directory so config resolution matches:MasterDetailForm.tsx25 W both sides,MasterDetailForm.test.tsx17/17,masterDetailFormTypeVocabulary.test.tsx6/6,submitHandlerSeam.test.tsx10/10,submitTargetRefusal.test.tsx20/20, 0 errors throughout. The new pin adds 7, allno-explicit-any, the same class as the siblingWizardFormpin. This is the package's own lint script, not a narrowing of the repo-wide scan, which is CI's; no type-aware linting is configured (noproject/projectServiceineslint.config.js), so this diff cannot move an untouched file's verdict.check-changeset-presence—6 source file(s) of 1 released package(s) changed, and this change declares 1 changeset(s).check-changeset-no-major—No changeset declares a major bump.check-changeset-overwrite—No pre-existing changeset was modified or deleted.check:control-bytes—OK (scanned 6055 tracked text file(s); skipped 85 binary).check:vi-mock-specifiers—OK (4160 tracked source file(s), 2426 test-named; 542 carry a mock ...).check:vi-mock-inherit—OK (... 118 call site(s) ... 118 inherit, 0 auto-mocked ...).0 of 7 path(s) hit the register,NOT governed — ordinary queue landing applies to a PR with exactly this file list.Heavy runs went through the shared verify lock under slot
dev-7345; the repo-wide farm is CI's and has not been waited on here.🤖 Generated with Claude Code
https://claude.ai/code/session_01NRRumy89BYdW9ogbcdHTho
Generated by Claude Code