Repository navigation
fix(platform): send an email that carries only an attachment - #3514
Merged
Merged
Conversation
The Inbox composer offers Send for a file with no text and hands the send an empty body. The reply and compose adapters read that body as a missing argument and threw before any request, and both doors refused it with a content minimum of one character, so the person read "Couldn't send message" every time. One predicate in lib/shared/conversations now says what an outbound email must carry: a body, a file, or both. The two adapters, the reply and compose doors, replyToConversation and composeEmailConversation all apply it. An empty body beside files goes out; a send with neither is still refused before anything is read, now in the service too, where a caller that skipped the door could queue an empty email. Every lane below already carried an empty body. The API lane skips its minimum when files go with the reply, and gmail, outlook and the imap-smtp native send an empty text part. The adapter, door, service and editor tests cover both sides, a browser test drives the real editor through the reply mutation, and CONV-F32 keeps real delivery on the manual round.
This was referenced Sep 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The Inbox composer offers Send when a file is attached and nothing is typed, and hands the send an empty body. Both the reply path and the compose path then refused that body:
''as a missing argument;contentto be at least one character.So the person always read "Couldn't send message". This change accepts an empty body when at least one file goes with it, and still refuses a send that carries neither. The adapter, the two doors and the send service all apply one shared rule.
Task: TALE-33 (triage T10, P2).
What changed
lib/shared/conversations/outbound-content.ts: addshasBodyOrAttachments({content, attachments}). Only''counts as an empty body, so every body the doors accepted before, whitespace included, still passes.app/lib/backend/conversations.ts): reply and compose read the body throughemailContentArg. An empty body with files is sent. An empty body without files still throws before any request is made.backend/domains/conversations/routes.ts):/:id/replyand/composenow takecontent: z.string().max(200_000)with.refine(hasBodyOrAttachments). A request with neither a body nor a file still gets 400invalid bodybefore anything is read.backend/domains/conversations/send.ts):replyToConversationandcomposeEmailConversationrefuse a send with neither (reply_content_required/compose_content_required, 400) before their first read. Until now, a caller that went around the door could queue an empty email.CONV-F32and its 🔶 row inreference/automation.md.Why accept it rather than disable Send
Everything below these checks already carries an email that has only attachments:
queueApiReply) skipsminBodyCharswhen files go with the reply.body: z.string(), and a retry re-sends the stored body, content type and files.sendoperations require onlytoandsubject. Gmail and Outlook sendinput.body || ''; the imap-smtp native parsestextas optional and sends a text-less plain message.app.conversation_messages.contentis onlyNOT NULL, so''is a valid row.The compose pane uses the same editor and failed the same way, so it is fixed here too.
Checklist
bun run check: not run as one command. The sandbox's 4 GiB memory cap rules out the whole-workspacetscand the full suites, so each part was run on the touched scope instead (see the test plan). CI runs the full gate.bun run lint:sastpasses.compose_subject_required, and the UI cannot reach them because the adapter and the door refuse first.docs/*/platform/describes the reply box or what a send must carry. The fix makes the Send button the UI already offers work.README.md/README.de.md/README.fr.md: N/A.Test plan
Regression tests. With
origin/main's adapter, doors and service swapped back in, six server-project tests and the browser test below fail; here they pass.app/lib/backend/conversations.test.ts: the reply and compose adapters sendcontent: ''beside files.''with no attachments or an empty list, or a body that is not a string, still throws and sends nothing.backend/domains/conversations/routes.test.ts: both doors answer 201 for an attachment-only body, and the attachment ownership check still runs. A request with neither answers 400 before any read.backend/domains/conversations/send.test.ts: the service refuses a send with neither before any statement (onmainit queued an empty email). An attachment-only reply or compose queues an emptyTextpart plus the files, and an API thread getsbody: ''plus the files.message-editor.browser.test.tsx(real Chromium): attach a file and type nothing, and Send message is enabled. Pressing it runs the real reply mutation and adapter, which POST/api/app/conversations/c1/replywith{content: '', attachments}, and no toast appears. Againstmain's adapter it fails withMissing content for adapted writeand then "Failed to send message".Characterization tests:
message-editor.test.tsx(the editor hands over('', [file], undefined), and nothing is sent with neither text nor a file) andoutbound-content.test.ts(the predicate).Run in the sandbox, on top of
768f4f183:backend/domains/conversations/,backend/jobs/task-list.send-message.test.ts,lib/shared/conversations/and the adapter test: 27 files, 252 tests passed.test:uioverapp/features/conversations/: 24 files, 200 tests passed.test:browseronmessage-editor.browser.test.tsx: 4 of 4 passed, including the two height testsmainadded to the same file.oxfmt --checkon every changed file: clean.oxlint --type-aware --type-checkon the eight changed files the platform lints: clean. A planted type error was reported first, so the silent pass is real.lib/sharedis outside the platform lint, so the predicate and its test were compiled on their own withtsc --strict --exactOptionalPropertyTypes --noUncheckedIndexedAccess: clean.bun run lint:sast,bun run lint:manual, andcheck-guide.tsonconversations.md: clean.Not run:
backend:integration. It needs Postgres, this sandbox has no Docker daemon, and no CI workflow runs it. The change adds no SQL, and both of the integration check'sreplyToConversationcalls carry a body, so the new guard cannot trip them. The whole-platform suites ran in CI.Manual:
CONV-F32covers real delivery through a mailbox, the message bubble after a reload, and compose.Left open
These are existing gaps, outside this change:
message-editor/file-attachments-list.tsx).