Repository navigation
fix(schedule): keep the job dialog honest while a save is in flight - #32036
Conversation
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS The fix uses mechanisms that already exist ( Notes
What this change shipsInventory (8 items) — 5 justifiedIntent: when someone closes the Schedule job dialog mid-save, they are told the save may still go through, and the late answer is never lost and never closes the wrong dialog. FIX (#10307).
[FIRST-PRINCIPLES-REVIEWED] 896cb62 Description read[DESCRIPTION-READ] eb83c74e0dde6dd4569ffebf5728de81aa8d8ca5dbb05be08616cf69f29c76e3 That sha256 names the PR description this verdict read. Recompute it with |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: the fix is at the cause (a closed dialog's late callbacks act on the dialog open by then), stays inside the one page, takes nothing away, and evidence is attached. Notes
[DESIGN-REVIEWED] 896cb62 Description read[DESCRIPTION-READ] be385e966cd508d0622051cc5f02a95d7e418d5876b2a500770bae0e0ac524ad That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
UX Review (Opus 5.5) — ✅ PASS (a BLOCK with no Trigger and no Outcome does not block)UX-level review of UX-Verdict: PASS cannot evaluate: missing screenshots of the edit-mode in-flight dialog, its locked Logs tab, Save turned off on Logs, and the "may or may not have been saved" notice. The PR adds all four states and no screenshot shows them. Evidence gaps
Notes
[UX-REVIEWED] 896cb62 Description read[DESCRIPTION-READ] ec6e4cb6ee820876a5983f315639ebf7a4a111d82da59688113078ac1bc7e8f2 That sha256 names everything this verdict read: the PR description, plus the 6 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
182c1ac to
1441562
Compare
|
self-added: no
|
1441562 to
50cc50c
Compare
|
self-added: no
|
|
[operator: bolichen97] The red Backend Tests shard 2 (Linux and Windows) and the Coverage Gate that depends on it fail on |
50cc50c to
6d5aac3
Compare
|
Rebased: main moved in docs/system-specs/modules/learn-cron-dashboard.md, website/src/pages/SchedulePage.tsx and the 13 catalogs under website/src/i18n/locales/ since this head's CI ran (b65af1a -> f58c3cf); CI re-running. The new base carries main's security package line-budget fix, so the Backend Tests shard 2 and Coverage Gate reds should clear. |
Closing the Schedule page's job dialog mid-save cannot cancel the request, yet the dialog still offered Cancel with no word that the schedule might be created anyway. Its late answer then ran the closed dialog's success path, which closed whatever dialog the user had opened since, and a late failure vanished with the unmounted form. While a save is in flight the dialog's Cancel reads Close and a strip above the footer says the schedule may still be created (or the changes saved). A late answer only refreshes the list; a late failure is reported on the page, one dismissable notice per save, worded by whether the server refused it or never confirmed the outcome. The Logs tab is locked mid-save and Save is off on Logs, so the form that reports a result stays mounted, and a page leave or browser Back is refused while the dialog holds typed work, an edited alert threshold or time zone included.
6d5aac3 to
896cb62
Compare
|
buluoray
left a comment
There was a problem hiding this comment.
🤖 Kiro Crew Auto-Pipeline [operator: buluoray]:
APPROVE
What this does for users: on the Schedule page, the job dialog no longer offers "Cancel" while a save is in flight. It shows "Close" and one line saying the save may still go through. A late success refreshes the list without closing whatever dialog the user opened since. A late failure becomes a dismissable page notice with the server's reason, worded differently for a refused save and an unconfirmed one. A page leave or browser Back with typed work in the dialog is refused instead of dropping the draft.
Evidence (head 896cb62):
- JobDetailDialog (website/src/pages/SchedulePage.tsx:1785-1792) keeps a mounted flag. onSaved always refreshes, and closes the dialog only while it is still mounted. onSubmitError hands the failure to the page only once the dialog is gone, so a live form still shows its own error.
- The leave guard and stake (SchedulePage.tsx:390-393) follow JobForm's onDirtyChange. JobForm reports false on unmount (website/src/components/JobForm.tsx:474), so closing the dialog by any route releases the guard. A closed dirty dialog cannot leave the page stuck refusing navigation. This is the same NavigationLeaveGuard pattern the Crewmates dialog already uses.
- The dirty check now counts the alert threshold and the picked zone (JobForm.tsx:464). The zone is compared against the picked value (initialTz), never the default the picker displays, so a late-loading default is not read as an edit.
- The outer catch now passes e.message to onSubmitError (JobForm.tsx:703). Schedule is the only host of onSubmitError, so no other surface changes. The live form still shows its localized failed_to_save text.
- Logs is disabled while saving and Save is disabled on Logs. Both are needed because Logs unmounts the form.
- Copy: all four new keys are present in every catalog under website/src/i18n/locales (12 languages plus the en-XA pseudolocale). Each is one sentence and carries only facts the user cannot otherwise see. The cron dashboard spec (docs/system-specs/modules/learn-cron-dashboard.md) gains a paragraph in the same commit.
Tests: SchedulePage.inflightClose, JobForm.alertAfterFailures, JobForm.timezone, SchedulePage and destructiveConfirm passed 96 of 96 locally.
Mutations, run one at a time with the tree restored after each:
- Closing on a late success regardless of mount state failed "SchedulePage job dialog while a save is in flight > offers Close with the may-still-be-created line, and a late success leaves the dialog open now alone".
- A leave guard that always allows failed "SchedulePage job dialog while a save is in flight > refuses a page leave only while the dialog holds typed work".
CI: 94 check runs at this head, 83 success and 11 skipped, none failing. PR Readiness and both CodeBuild statuses are success. Opus, GPT, Design, First Principles and UX lanes all pass. git merge-tree against main is clean.
Source-only: I checked no live UI or screenshots, and I did not check how a refused browser Back looks. The refusal is silent by design, with the draft left on screen in the modal, as on the other hosts of this guard.
Follow-ups (non-blocking), from the UX lane:
- Add screenshots of the edit-mode in-flight strip with the locked Logs tab, and of the "may or may not have been saved" notice.
- The blind reader was unsure what happens after Close. The UX lane suggests the close_wont_cancel line say that a failure will show on this page. That is a wording choice for the owner, not a defect.
…32036) Closing the Schedule page's job dialog mid-save cannot cancel the request, yet the dialog still offered Cancel with no word that the schedule might be created anyway. Its late answer then ran the closed dialog's success path, which closed whatever dialog the user had opened since, and a late failure vanished with the unmounted form. While a save is in flight the dialog's Cancel reads Close and a strip above the footer says the schedule may still be created (or the changes saved). A late answer only refreshes the list; a late failure is reported on the page, one dismissable notice per save, worded by whether the server refused it or never confirmed the outcome. The Logs tab is locked mid-save and Save is off on Logs, so the form that reports a result stays mounted, and a page leave or browser Back is refused while the dialog holds typed work, an edited alert threshold or time zone included. (cherry picked from commit f3ca014)
…32036) Closing the Schedule page's job dialog mid-save cannot cancel the request, yet the dialog still offered Cancel with no word that the schedule might be created anyway. Its late answer then ran the closed dialog's success path, which closed whatever dialog the user had opened since, and a late failure vanished with the unmounted form. While a save is in flight the dialog's Cancel reads Close and a strip above the footer says the schedule may still be created (or the changes saved). A late answer only refreshes the list; a late failure is reported on the page, one dismissable notice per save, worded by whether the server refused it or never confirmed the outcome. The Logs tab is locked mid-save and Save is off on Logs, so the form that reports a result stays mounted, and a page leave or browser Back is refused while the dialog holds typed work, an edited alert threshold or time zone included. (cherry picked from commit f3ca014)
Problem / Motivation
Goal: On the Schedule page, closing the job dialog while a save is in flight tells the truth about that save, and the save's late answer can no longer close or swallow anything.
Closing the job dialog cannot cancel a save that was already sent, but mid-save the dialog still offered Cancel and said nothing, so a user who closed it believed the schedule was not created. When that save answered later, the closed dialog's success path still ran and closed whatever dialog the user had opened since, typed work included. A save that failed after its dialog closed was lost with the unmounted form. Nothing stopped a page leave or browser Back from dropping typed work in the dialog.
This is part 2 of #10307. Part 1 (a schedule created from
/schedulefor a Bot storesmember_id) already shipped with the job form's Runs as switch (#22055).Why it matters
Anyone who creates or edits a schedule from
/scheduleand closes the dialog before the save answers: on a slow gateway that is a schedule they think they cancelled but that exists and runs, a second dialog that closes under them with its draft lost, or a failure they never see.Not a goal
member_idfrom/schedule): already on main through the Runs as switch.CrewWakeSection), so there is one caller.beforeunloadprompt./schedule: the notices live on the page.SchedulePage.tsx, which is already over the 1,600-line working target (1,964 lines after this change, 36 under the 2,000 cap); moving the job dialog to a sibling module is its own change.What changed (motivation → approach → change)
The dialog knows whether it is still mounted, and only a mounted dialog closes itself on success or leaves an error to its own form; the Logs lock keeps that form mounted for as long as the dialog is. The page hears late failures through
JobForm's existingonSubmitErrorand typed work through itsonDirtyChange;JobForm's dirty check counts the alert threshold and the picked time zone, the two editable fields it left out, so editing only one of them is guarded too; the zone counts what was picked, never the default the picker shows. The leave guard refuses rather than asks because the registry needs a synchronous answer and the dashboard bans browser-native confirms. Four catalog keys are added to every catalog underwebsite/src/i18n/locales/(all 12 languages, plus the regenerateden-XA.jsonpseudolocale), and the cron dashboard spec gets one paragraph describing the dialog's in-flight behaviour.late_save_unconfirmedmatches the confirm-key sweep indestructiveConfirm.test.tsby name only, so it is listed there as a notice, not a confirm prompt.Backwards compatibility
Compatible: no API, wire or stored shape changes; only the Schedule page's own job dialog behaves differently while a save is in flight, and a zone-only edit in the job form counts as typed work.
Removes nothing:
JobDetailDialogis module-private and its one caller passesonChangedwhere it passedonSaved; no control, route or key is removed.Tests
website/src/test/SchedulePage.inflightClose.test.tsx, against the real page andJobFormwith the API mocked:website/src/test/JobForm.alertAfterFailures.test.tsx: changing only the alert threshold reports the form dirty.website/src/test/JobForm.timezone.test.tsx: changing only the zone reports the form dirty; the default zone loading does not.Mutation check: reverting the mounted-only close, the mounted-only hand-off, the published stake, the Logs lock, the Save-on-Logs lock, or the threshold or zone term in the dirty check each turns a test red. Determinism: each of the three files passed 10 of 10 shuffled runs (
--sequence.shuffle, seeds 11 to 101). The existingSchedulePage.test.tsxand the related set (138 files, theCrewWakeSectionhosts included) pass, as do the i18n catalog, style and pseudolocale checks andnpm run i18n:checkwith the base ref.Proof: not provable -- frontend test (prove.py runs Python only)
Manual verification
Rendered the real
SchedulePagefrom the capture entry with every/api/**answered locally and the create POST held open: the strip and Close show while saving (dark and light); after Close, answering the POST with a 400 put the late-failure notice above the list. Each frame asserted its state before it was written.Screenshots / video
In flight, dark and light:
A create that failed after its dialog was closed:
Related Issues
Closes #10307
Sibling sweep
Swept: git grep -n "<JobForm" -- website/src
Sibling: website/src/components/CrewWakeSection.tsx -- not affected -- its toggle is disabled while the create is in flight and its late success only collapses its own inline form; it reads the same dirty check, so a zone-only edit in its create form counts as typed work too
Sibling: website/src/pages/SchedulePage.tsx -- changed here
Swept: git grep -nE "= useState(.*(init|defaults)" -- website/src/components/JobForm.tsx
Sibling: website/src/components/JobForm.tsx -- changed here
Pattern harvest
Rule candidate: review-prompt
Pattern: an async completion handler from a dialog that has since closed still calls the host's close or reset, so it acts on whatever dialog is open by then
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)