Skip to content

fix(platform): say when an email attachment is no longer available - #3193

Merged
Israeltheminer merged 1 commit into
mainfrom
fix/attachment-unavailable-v2
Sep 4, 2026
Merged

Israeltheminer merged 1 commit into
mainfrom
fix/attachment-unavailable-v2

Conversation

@Israeltheminer

Copy link
Copy Markdown
Contributor

A conversation attachment whose blob is gone still rendered as a working
download. Clicking it failed in the browser with no explanation. That is what
a deployment sees after a database is recovered without its file storage
(#3017).

Rebase of #3171 onto current main, plus unit coverage the original lacked.

Why presigning is not proof

presignMessageAttachments signs a path. Signing succeeds whether or not the
object is there, so the projection now probes for it and marks a missing one
unavailable — dropping the URL rather than flagging it, because a dead link
sitting next to a "no longer available" notice is the same bug.

The probe fails open. An unreachable store or an unresolved org throws,
and a throw is not evidence of absence, so the attachment is offered as
before and the reason is logged. Only a definite null marks it.

The unit coverage is new

The original PR proved this only through integration-check.ts, which needs
a live stack and an S3 endpoint. I mutation-tested the backend probe and the
mutation survived — nothing running in CI covered it.
attachment-presence.test.ts now covers all three branches:

Mutation Went red
probe never marks a missing blob (gone = false) marks it unavailable and drops the URL, offers it anyway when the probe throws
probe treats a throw as absence (gone = true) offers it anyway when the probe throws — a throw is not absence
stop rendering the unavailable state says the file is no longer available instead of its size

That second mutation is the one worth having a test for: failing closed on a
throw would hide every attachment in a deployment whose store is briefly
unreachable.

Locales

conversations.attachment.unavailable in en, de and fr. It is not in a
mirrored namespace, so the notification-email mirror needs nothing —
confirmed by notification_messages.test.ts (21 passed).

Gate

typecheck 0 errors, oxlint --type-aware clean, oxfmt --check clean,
conversations + i18n suites 131 passed (14 files), the message component
14 passed.

A message that advertises an attachment whose bytes are gone offered a
download that failed with a browser error and no explanation.

Presigning does not prove the object is there — it signs a path. So the
read path already re-derived each URL and dropped it when the presign
itself failed, but a presign for a missing object succeeds, and the chip
went on showing a file size and a download button.

The probe rides the presign loop that already walks each attachment, using
the existing statOrgBlob rather than a second pass over the same metadata.
A probe that THROWS is not evidence of absence — an unreachable store, an
unresolved org — so it fails open and the attachment is offered as before.
Only a definite miss marks it: url withheld, unavailable stamped, and the
chip reads 'No longer available' where the size was.

Closes #3017. Supersedes #3104, three of whose files #3125 deleted.
@Israeltheminer
Israeltheminer force-pushed the fix/attachment-unavailable-v2 branch from 76b4891 to 4718c24 Compare September 4, 2026 09:00
@Israeltheminer
Israeltheminer merged commit a93aa8e into main Sep 4, 2026
48 checks passed
@Israeltheminer
Israeltheminer deleted the fix/attachment-unavailable-v2 branch September 4, 2026 10:00
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