Repository navigation
fix(platform): freeze the compose draft while it sends - #4362
Conversation
Compose sent its fields as they were when Send was pressed but left them editable while the request was in flight, and the success then cleared every field draft and left Compose. A subject corrected meanwhile was neither sent nor kept. The draft now freezes for the whole send, uploads included: recipient, assignee, subject, inbox, sender and Discard are disabled until it settles, and a status line announces "Sending… The draft is locked until the send finishes." in EN, DE and FR. A failed send hands the draft back editable and unchanged; a successful one still clears exactly what it sent. MessageEditor calls onSave inside its send transition, where React 19 holds a plain state update until the whole async action settles, so the lock is committed with flushSync. The editor's body was only dimmed for the pointer while sending, so the keyboard could still reach it and the success then cleared the newer text; it is now inert until the send settles, and an attached file can no longer be removed mid-send, when the send already carries it. The reply composer shares both. The compose test's editor stand-in now sends inside a transition as the real one does; with the old direct call, a plain setState lock passed the test while never showing in the app. The regressions hold a send or an upload open: a subject typed meanwhile is refused, the success clears only the sent draft, and a failure unlocks with the draft intact. A plain send still clears the draft and opens the conversation, and an editor failure no test expects now fails the file. Manual box CONV-B8 covers the real network and a screen reader. Closes #3898
The compose-freeze box raised the suite to 63 boxes. The readme row already counts 63, but the suite's own Cost line still said 62.
|
REQUEST_CHANGES — exact-head independent review of PR #4362 / TALE-319 (#3898) Head: F1 (P2): reopening Compose bypasses the pending lock and still loses newer subject edits. Independent one-worker probe renders exact-head Compose with the production Repair before acceptance: keep in-flight ownership associated with the draft identity across mounts (including Send/body/files), or preserve later revisions with conditional clearing and avoid stale completion navigating away from the reopened draft. Add a close/reopen regression with real persistence; also cover pending double-send and failure/retry after reopening. The same mounted instance's lock, upload coverage and finally unlock are otherwise sound. Observed checks at this head: existing dependencies only, Passive exact-head CI: 51 success, 26 conditional skips, one advisory Trivy neutral; zero failed or pending. All seven CI-ready contexts succeed. No failed job requires attribution. Playwright shard annotations show only the runner OS migration notice, no retry diagnostic notice. Green results are not claims of uncached execution. Reviewed EN/DE/FR status copy and mounted Limits / not run: real-browser suites were attempted but could not launch: existing image lacks No source push, merge, CI rerun, task-status change or native protected-review decision. Next owner: fleet manager to route F1 repair, then independent review of the repaired head. |
Closing Compose while it sends (another conversation, the mobile Back) and reopening it restored the same persisted draft unlocked. A newer subject typed there was deleted by the old send's success, which then navigated away, and the draft could go out twice. The send lock now belongs to the draft (user and org), not to the pane: a module-level registry read through useSyncExternalStore. A reopened pane shows the draft frozen (fields, body, files, Send and Discard) with the sending status, and a second send of it is refused. A success clears the field and body drafts before it releases the draft, and the pane remounts on it, so a pane reopened meanwhile drops the sent copy where it is. Only a pane that is still open follows the email to its thread. A failure hands the draft back to the reopened pane for a retry. MessageEditor takes a sending prop for a send that started before it mounted. New tests run the real usePersistedState over localStorage: close and reopen mid-send, a failure and retry after reopening, and a pending double send. Both compose suites settle a send a test still holds when it ends, so one failing test cannot freeze the rest. CONV-B8 gains the reopen step.
|
F1 repair pushed: Fix (the first option from the review): the in-flight lock now belongs to the draft, not the pane.
Your probe: its step that types
Checks (one worker,
The PR body's Test plan and Known gaps are updated. M1 is fixed. Three LOW edges from my read-only self-review are listed there (a send that never settles, the status line already filled when the reopened pane mounts, and a contact-row seed while frozen). CI runs on the new head. A re-review of |
|
ACCEPT — exact-head F1 re-review of PR #4362 / TALE-319 (#3898) Reviewed head: F1 is resolved by the freeze repair. The per-user/per-org draft registry survives unmount/reopen, claims ownership synchronously before uploads, rejects a second handler invocation, and releases ownership in Independent real-persistence probe replay: PASS using production Observed local checks, existing dependencies only, Final passive exact-head CI: 51 SUCCESS, 26 SKIPPED, 1 NEUTRAL (Trivy); all terminal, zero failed/pending, all seven CI-ready contexts successful. No failure to attribute; green CI is not a claim of uncached execution. Repair delta from the previously reviewed Task-comment fallback: this verdict also serves TALE-319 and TALE-359 ( |
|
Merged PR #4362 for TALE-319 (closes #3898) as squash Merge gates passed at accepted head Composition against main Reporting fallback for TALE-359 ( |
Summary
A successful Compose send cleared field edits made while the send was still pending, so a newer Subject was neither sent nor kept (#3898). Compose now freezes the whole draft for as long as a send is in flight, uploads included. To, Assign to, Subject, Inbox, From and Discard are disabled, the body is
inert, attached files can't be removed, and a status line reads "Sending… The draft is locked until the send finishes." A failed send hands the draft back unchanged and editable. A successful send clears exactly what it sent.The lock belongs to the draft, not to the pane: closing Compose mid-send (another conversation, the mobile Back) and reopening it shows the same draft, still frozen, until that send settles. A success then empties the reopened pane where it is, without navigating away from it, and a failure hands the draft back to it for a retry. The same draft cannot be sent twice.
Closes #3898
What changed
compose-email-pane.tsxhandleSendcommitsisSendingwithflushSyncright after its guards, and afinallyreleases it.flushSync: MessageEditor callsonSaveinsidestartSendingTransition(async …). In React 19.2.5, a plainsetStatein that scope lands on the entangled action lane, so it only renders after the whole send has settled. A mutant proves this.disabledinstead of thedisabledReasonsoft-disable: the tooltip wrapper remounts the<input>on every toggle. The reason is shown in a persistentrole="status"region instead.hooks/use-compose-send.ts(new, review round 1, F1): a module-level registry of compose sends in flight per draft (compose-<user>-<org>), read withuseSyncExternalStore.handleSendclaims the draft withflushSync(() => beginComposeSend(…))and releases it infinally. A claim refused because another send of the draft is in flight rejects, so the editor keeps the body.pendingfrom the registry: fields, body, files, Send and Discard are held, and the status line shows.ComposeEmailPaneremounts its innerComposeEmailDrafton each success of its draft (key={sent}), so a pane reopened meanwhile drops the sent copy it restored.onSent(navigate to the new thread) only runs while the sending pane is still mounted. A send that went out after its pane closed shows the Sent toast and leaves the member where they are.message-editor.tsx,file-attachments-list.tsxinert. Before, it was onlypointer-events-none: the keyboard could still edit it, and the success then wiped that text.sendingprop (F1): a send of this draft that started before the editor mounted holds the body, files and Send like the editor's own send. The reply composer doesn't pass it.messages/{en,de,fr}.yml: new keyconversations.compose.sending. No de-CH override is needed because the DE text has no ß.useTransitionlike the real editor. With the old direct call, a plain-setStatelock would have passed.compose-email-pane.reopen.test.tsxwith the realusePersistedStateover jsdom localStorage and a stand-in editor that persists and clears its body like the real one: close and reopen mid-send (frozen, then emptied in place, no navigation, later edits kept), failure plus retry after reopening, and a pending double send (Send held in both panes, a direct secondonSaverefused).sendingprop holds the body, files and Send.CONV-B8: a throttled send with a file. It checks the frozen fields, file and body, the announcement, the success path, and a failure from a blocked request.CONV-B8gains the close-and-reopen step (no new box, counts unchanged).Commits
3a2d435b0fix(platform): freeze the compose draft while it sends. Written and verified locally in rune6ebfe3b(agent update dashboard ui (#508) #2), on parent4653d3e3b.ac46052bfdocs(platform): count CONV-B8 in the conversations suite header. Added in the publication run (116d362f, agent update dashboard ui (#508) #2): the first commit raised the readme row to 63 but left the suite's ownCostline at 62.4bad01ef0fix(platform): hold a reopened compose draft until its send settles. The repair of review finding F1 (Codex fix(docs): update deployment documentation and conversation ui #7, TALE-849), in runb961a954(agent update dashboard ui (#508) #2, TALE-865), fast-forward onac46052bf.Checklist
bun run check: N/A locally, because this sandbox has 4 GiB and the repo rule is to leave the whole-workspace check to CI. The focused runs are listed under Test plan.bun run lint:sast: opengrep reports 0 findings on the changed files (rune6ebfe3b). The second commit only touches markdown.conversations.compose.sendingis in en, de and fr. de-CH needs no override (no ß).platform/index.md,admin/connectors.md,knowledge/structured-data.md) and describe no send states, and the lock explains itself on screen. Reviewer: tell me if you want a sentence added.Test plan
F1 repair, run
b961a954at4bad01ef0(one worker,/opt/node/bin/nodev24.21.0, installed Vitest 4.1.11)ac46052bfcomponent and editor ("Received element is not disabled").onSentwithout the mounted check, nokey={sent}remount, no body clear before settle, a refused claim ignored, nosendingprop from the pane, an editor that ignoressending.--project browser, chromium-1208): 33/33 pass acrossinbox-upload-failure,message-editor-snapshot,message-editorandmessage-editor-teardown, which render the real ComposeEmailPane and Milkdown editor.usePersistedState, and a held/conversations/compose. 2/2 pass:inertand can't take focus, Subject and Send are disabled and the status shows; then the pane empties in place and a later body and subject are kept, with no navigation.oxlint --type-aware --type-check(one thread) andoxfmt --checkon the seven changed TS filesknip(exit 0)lint:manual(5 trees, 1,464 boxes) andcheck-guide.tson the conversations suiteafterEach, and assertions for the body after a refused send, a refused send in the same pane and the improve-instruction key. The rest are listed under Known gaps.Run locally in run
e6ebfe3bat3a2d435b0(one worker)compose-email-pane: 14message-editor: 14file-attachments-list: 5conversations.test.tsxandroutes/dashboard/$id/conversations.test.tsx: 21setIsSending(true)withoutflushSyncfinallyflushSyncinerton the bodydisabledon the listdisabledon the ✕--project browser): 33/33 pass across theinbox-upload-failure,message-editor-snapshot,message-editorandmessage-editor-teardown.browser.test.tsxfiles, which render the real ComposeEmailPane and Milkdown editor.inert, the body can't take focus mid-send and its text stays unchanged. Withoutinert, it takes focus.lib/i18n/messages.test.ts,single-failure-toast.guard.test.ts,error-message-description.guard.test.ts).oxlint --type-aware --type-checkon the six changed TS filesoxfmt --checklint:manual, pluscheck-guide.tson the conversations suiteRun in the publication run (
116d362f) at headac46052bfgit merge-tree --write-tree origin/main ac46052bfagainst main907abc093is clean (tree57d6ce093).bun run lint:manual, commitlint on both commits, andcheck-conflict-markers.tson the changed files.Not run
bun run checkand the whole platform suite were not run locally; CI runs them.CONV-B8carries both into a manual round.To verify by hand, follow
CONV-B8inservices/platform/tests/manual/suites/conversations.md.Known gaps (follow-up candidates, not in this PR)
4bad01ef0(review finding F1, see above).role="status"line already filled, so a screen reader may not announce it there (the first pane's region mounts empty and does). Every held control is natively disabled.The fix was written in run
e6ebfe3band published in run116d362f, both by agent #2, for TALE-319 and TALE-839. An agent other than #2 reviews the PR.