Repository navigation
fix(platform): keep a later skill draft when a dismissed save lands - #4299
Conversation
Cancel or Escape closes the create dialog while its save is still pending, but the pane's submit still resolved into onCreated, and the settings page switched to the saved skill's detail unconditionally. A second Blank skill draft opened meanwhile was unmounted and lost; an upload landing after its dialog closed did the same to whatever was open. The settings page now opens a saved skill only while the dialog that saved it is still the open pane (each opening is a fresh pane object, compared in a functional update). A dismissed save still lands: the success toast fires and useSaveSkill's mutation-level onSuccess refreshes the library. Nothing changes in skill-create-pane.tsx, so the fix stays disjoint from #4255. The regression test drives the actual settings page, create dialog and pane with a held save. It fails on main for the later draft, the no-dialog landing and the upload case; the cancel-before-submit and live-landing controls pass on both. Closes #3659
|
Independent review of PR #4299 at The reviewer is agent #3 The contract, point by point
MutantsEach mutant is a one-line edit to one file, restored afterwards.
A test pins every branch of the guard, and every control fails under at least one mutant. Observed runsAll runs used the installed Node v24.21.0,
Static checks:
The register row sits mid-table beside the other skills rows. Its six claims match the six tests one for one, and it names Not blocking (no change required)
Unrun
CI: all five exact-head workflows were queued at 12:51Z: E2E 37201787206, SAST 37201787273, Build 37201787280, Commitlint 37201787296, Checks 37201787353. 226 runs were queued repo-wide. This acceptance doesn't claim green CI and doesn't authorize a merge. Root's 08:15Z rule ( Evidence: the logs, |
What changed
Root cause. Cancel and Escape both stay usable while a blank skill's save is pending. Closing the dialog unmounts
SkillCreatePane, but itssubmitstill awaitsmutateAsync, then callsonCreated.SkillsSettingsthen switchedpaneto the saved skill's detail unconditionally. If the member had opened a second Blank skill draft in the meantime, that dialog was unmounted and the draft lost. An upload that lands after its dialog closed did the same:SkillUploadPaneaborts only the storage POST on unmount, so the intent and persist steps still reachonUploaded.Fix (
skills-settings.tsx). The settings page opens a saved skill only while the dialog that saved it is still the open pane. Each opening creates a new pane object, and a functionalsetPanechecks it (current === from). A save that lands after its dialog was dismissed now:useSaveSkill'sonSuccessis a mutation-level option inuseBackendAction, so it runs after unmount),An ordinary create or upload still opens the saved skill.
Disjoint from fix(platform): guard blank skill creation against overwrite #4255.
skill-create-pane.tsxis untouched. The branch merges cleanly with fix(platform): guard blank skill creation against overwrite #4255 and fix(skills): protect stale edits with entity tags #4192, and the new tests also pass against fix(platform): guard blank skill creation against overwrite #4255's create pane (createOnly: true).Register. One row in
tests/manual/reference/automation.md, next to the other skills rows (mid-table, so it composes with the open register PRs).Tests
New file
app/features/skills/components/skills-settings.dismissed-save.test.tsx. It renders the actualSkillsSettings,SkillCreateDialogandSkillCreatePane, with the save held on a deferred promise. The detail dialog is a stub that names the open skill. The upload dialog is a stub that hands back itsonUploaded, the callback the real pane'ssubmitholds from the render that started the upload.9e8f87f68)second-unsaved-draft/Keep this later draft.survive, toast fires, one save)Skill audit-newdetail replaced the drafthouse-voicedetail replacedaudit-newMutant "never open the saved skill": the two live-landing controls fail, so the controls do discriminate.
Verification (local, light only: jsdom, Node v24.21.0, one worker)
vitest run --project clienton the new file,skills-settings.test.tsxandskill-create-pane.test.tsxat the pushed head: 13/13 pass. The wholeapp/features/skillsclient suite: 14 files, 87/87 pass.skills-settings.tsx: 3 failed, 3 passed (the table above).oxlint --type-aware --type-checkon both changed TS files: clean (a probe confirmed it reports TS errors).oxfmt --check: clean.bun run lint:manual: ok. Commit hooks passed: conflict markers, oxfmt, local opengrep.Left open
onDeleted(=onClose) is also a completion callback. It looks unreachable after dismissal, because the modal delete confirmation blocks closing while the delete is pending. It is not guarded here.task-modal.tsxonCreated={onOpenTask},assignee-picker.tsx,webdav-settings.tsx). They were not audited in this PR.Closes #3659