Repository navigation
fix(platform): restore reply files on undo and name their remove button - #3552
Conversation
Undoing a queued reply handed back its markdown only, and the panel seeded the composer only when there was some, so undoing an attachment-only reply restored nothing. The undo door now hands back the files the recalled send named (email and API lanes), the panel seeds the reply box with both, and a re-send names the same stored blobs instead of uploading them again. The restored draft seeds only the conversation it was undone in. The remove button on a file chip in the reply box had no accessible name (WCAG 4.1.2). It is named after the whole file name through the existing common.aria.removeNamed key (en, de, fr), with a visible focus ring. Manual boxes CONV-F33 and CONV-A8 with their automation row.
yannickmonney
left a comment
There was a problem hiding this comment.
Needs correction before acceptance: a removed restored attachment is reintroduced after switching conversations.
At a6cb1777b84500e77546b0a95e8d9b0890357db7, undo a reply with invoice.pdf, remove that chip, open another conversation, then return. ConversationPanel retains the original restoredDraft until a successful send and keys MessageEditor by conversation ID. The remounted editor loses appliedPendingKeyRef and applies the original attachments again (message-editor.tsx:153–178, conversation-panel.tsx:659–678). The next send can therefore include a file the user explicitly removed. Editing the restored text has the same stale-seed risk.
I reproduced the attachment regression locally with the existing editor test harness: restore one stored file → remove it and assert [] → render another keyed conversation and assert [] → return with the exact props the panel supplies. The final assertion receives invoice.pdf instead of []. The 13 existing tests pass; the additional navigation regression fails. Command: bun run --filter @tale/platform test:ui app/features/conversations/components/message-editor.test.tsx --maxWorkers=1. This was a component test in an isolated checkout, not a production or mailbox test.
Please keep the current draft state per conversation, or consume/version the undo seed after it is applied while preserving subsequent edits across remounts. Add a regression that removes a restored file, navigates away/back and verifies both the displayed draft and the actual resend exclude it. Also cover edited restored text and two conversations with independent undo drafts.
yannickmonney
left a comment
There was a problem hiding this comment.
Rechecked 83534c104d2efd80275091ba0490305eda129d83. The navigation regression from my earlier review is fixed: an undo is consumed after application, current attachments stay with each conversation, and later approvals are distinguished from the approval the undo replaced. A removed file is no longer restored just because the keyed editor remounts.
Fresh local runs with Bun 1.4.2: 7/7 real-Chromium editor tests and 20/20 editor/panel UI tests pass. The browser regression removes invoice.pdf, edits the text, visits another conversation, returns, and verifies the first resend contains edited text and no files; the other conversation retains and resends its own receipt. The panel tests also check callback ownership and a later approval. This clears my reported navigation defect at this commit.
Related existing Inbox failures remain tracked separately: #3558 / #3566 preserve drafts after upload failure, and #3565 addresses immediate-send text loss. They were not silently counted as fixed by this PR. Transport was synthetic; no real mailbox or production testing. No merge performed.
Undoing an Inbox send restored only its text, so attachment-only replies restored nothing. Undo now returns the stored attachment references on both email and API lanes, and the reply editor restores the complete draft. Re-sending uses those references without uploading the files again; the send door still verifies blob ownership. The client accepts older servers that omit attachments.
Undo seeds are consumed once applied. The panel retains live attachment state per conversation, and the editor continues using its existing per-user/per-conversation persisted body. Editing text, removing a file, switching conversations and returning now preserves the edited draft; separate undo drafts keep independent files. A consumed undo suppresses only the approval ID it replaced, preventing a cached seed from overwriting edits while allowing a later approval to seed a new draft.
File-chip remove buttons expose the full file name through the existing translated
common.aria.removeNamedkey and display the shared focus ring. Manual coverage includes restored files, conversation switching and named removal controls.Validation:
Stored upload references retain the existing two-hour intent lifetime; a later re-send may require reattaching the file. Live delivery through a real mailbox remains a manual check.
Refs TALE-54 and #3514. Full CI gates the pushed head.