Skip to content

fix(platform): restore reply files on undo and name their remove button - #3552

Merged
yannickmonney merged 4 commits into
mainfrom
fix/undo-restores-reply-attachments
Sep 28, 2026
Merged

yannickmonney merged 4 commits into
mainfrom
fix/undo-restores-reply-attachments

Conversation

@yannickmonney

@yannickmonney yannickmonney commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

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.removeNamed key and display the shared focus ring. Manual coverage includes restored files, conversation switching and named removal controls.

Validation:

  • Real Chromium navigation regression failed before the correction and passes after it. It verifies edited text survives, removed files stay removed, the actual editor send excludes removed files, and a second conversation keeps and sends its own attachment.
  • Panel regression verifies the corresponding send mutation payloads and absence of re-upload.
  • After merging current main: conversation UI 26 files/215 tests, editor Chromium 7 tests, undo/send adapter 2 files/48 tests. A further panel regression covers old-versus-new approval IDs.
  • Full platform typecheck, scoped lint and manual gate passed. React Doctor reports only the existing ConversationPanel complexity warning.

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.

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 yannickmonney left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 yannickmonney left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@yannickmonney
yannickmonney merged commit 48c0aa9 into main Sep 28, 2026
50 checks passed
@yannickmonney
yannickmonney deleted the fix/undo-restores-reply-attachments branch September 28, 2026 06:46
yannickmonney added a commit that referenced this pull request Sep 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant