Skip to content

fix(mailer): render email logo via CID inline attachment - #220

Merged
artempartos merged 1 commit into
developfrom
fix/email-logo-cid-attachment
Sep 9, 2026
Merged

artempartos merged 1 commit into
developfrom
fix/email-logo-cid-attachment

Conversation

@dvislov

@dvislov dvislov commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator

Problem

The logo in transactional emails renders as a broken-image icon (see the invitation email). The shared mailer layout referenced it as:

<img src="https://flow.aixle.com/logo.png" onerror="this.src='data:image/png;base64,…'">

Three things are wrong with this:

  1. src 404s — there is no logo.png; public/ only has logo.svg.
  2. The onerror fallback never fires — Gmail, Outlook and Apple Mail strip all JavaScript from email bodies, so the base64 data: URI is never swapped in.
  3. Even if it did fire, Gmail refuses to render data: URI images in email, and SVG in <img> is likewise blocked by Gmail/Outlook.

Net result: no logo in any major client.

Fix

Ship the wordmark as a CID inline attachment — the reliable approach for email logos:

  • Added app/assets/images/mailer/flow-logo.png, rasterized from logo.svg and recoloured to the layout's #d1cfcd on transparent.
  • ApplicationMailer attaches it on every mail via a before_action, loading the file once at boot.
  • The layout references it through attachments["flow-logo.png"].url (resolves to cid:…).
  • The layout tolerates a missing attachment (wrapped in if), and the mailer logs + skips if the file can't be read — a logo problem never blocks mail delivery.
  • The "Flow" text lockup beside the mark is unchanged, so a failed image still degrades to readable text.

Renders with no external fetch in Gmail, Outlook and Apple Mail.

Testing

  • test/mailers — green.
  • Rendered MembershipMailer.invitation: inline image/png attachment present, <img src="cid:…"> in the HTML body.
  • make check_all: all checks touched by this change pass. The pre-existing typescript + system-test failures in AssetsContent.tsx / AssetUploadTest are unrelated (reproduce on clean develop).

🤖 Generated with Claude Code

https://claude.ai/code/session_014ahV4WdjhvqrTdczGNPNQG

The shared mailer layout referenced the wordmark as
`<img src="https://flow.aixle.com/logo.png" onerror="…data URI…">`.
That never worked: no `logo.png` is served (only `logo.svg`), so the
`src` 404s, and email clients strip JavaScript so the `onerror` base64
fallback never fires. Gmail also refuses to render `data:` URI images
regardless.

Ship the logo as a CID inline attachment instead: `ApplicationMailer`
attaches a committed PNG on every mail via a `before_action`, and the
layout references it through `attachments["flow-logo.png"].url`. Renders
in Gmail, Outlook, and Apple Mail with no external fetch. The layout
tolerates a missing attachment so a logo problem never blocks delivery.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014ahV4WdjhvqrTdczGNPNQG
Signed-off-by: Dmitry Vislov <[email protected]>
@dvislov dvislov self-assigned this Sep 9, 2026
@dvislov
dvislov requested a review from artempartos September 9, 2026 05:42
@artempartos
artempartos merged commit 643edc8 into develop Sep 9, 2026
7 checks passed
aixle-com Bot pushed a commit that referenced this pull request Nov 10, 2026
…220)

Conflict in docs/index.md resolved: staging's azure-devops-app-registration line, the feature's operations/releasing.md line.
NOX73 added a commit that referenced this pull request Nov 10, 2026
aixle-com Bot pushed a commit that referenced this pull request Nov 10, 2026
aixle-com Bot pushed a commit that referenced this pull request Nov 11, 2026
…s handle transport (task #220)

Runners::Registration.register! and Runners::Operations.record_result! take
named parameters and never the request body. The gateway controllers check
the headers (the register version refusals sit next to check_protocol), the
body's shape against the protocol schema, and map the body by the wire rules.
register.request.json lets a body that asks for ephemeral through, so the
refusal order of PROTOCOL.md 5.1 is unchanged. DESIGN.md 6.1 and the Error
Handling rule describe the layering.

Signed-off-by: Alex <[email protected]>
aixle-com Bot pushed a commit that referenced this pull request Nov 11, 2026
…ict strings (task #220)

Alex's code review round 3 decision: no Rails boolean cast. The schema is
the only definition of asking for ephemeral (const true); any other
non-boolean value, and an os or arch that is not a string, is
invalid_registration.

Signed-off-by: Alex <[email protected]>
aixle-com Bot pushed a commit that referenced this pull request Nov 11, 2026
NOX73 added a commit that referenced this pull request Nov 11, 2026
… services take named parameters (task #220) (#689)

* feat(runners): pin aixle-runner 0.1.0 in config/settings.yml, gateway request checks in the services (task #220)

- The runner pins move from config/runner_release.yml into the
  runners.release block of config/settings.yml; the add_source! loader
  is gone, and Runners::Release still fails boot on an invalid block.
- Pin runner-v0.1.0: the linux-amd64 and linux-arm64 SHA-256 from the
  release's checksums.txt, recommended_version 0.1.0, min_version null.
- Runners::Release::Offer loses platform, which nothing read.
- Runners::Registration.register! takes the request body and raises every
  refusal in PROTOCOL.md 5.1 order; Runners::Operations.record_result!
  checks op_result.request and builds the stored result. The controllers
  only call them, and invalid_result joins REFUSAL_STATUS.
- docs: the rule in implementation-patterns.md Error Handling, releasing.md,
  DESIGN.md, PROTOCOL.md, docs/index.md, CHANGELOG.

Signed-off-by: Alex <[email protected]>

* test(runners): pass bodies as hashes, resolve the initializer path before stubbing the config

Signed-off-by: Alex <[email protected]>

* docs(runners): name the runners.release block in runner-release.yml (task #220)

Signed-off-by: Alex <[email protected]>

* fix(runners): restore Settings.reload!, keep service helpers private, split the boot test (task #220)

Signed-off-by: Alex <[email protected]>

* refactor(runners): gateway services take named parameters, controllers handle transport (task #220)

Runners::Registration.register! and Runners::Operations.record_result! take
named parameters and never the request body. The gateway controllers check
the headers (the register version refusals sit next to check_protocol), the
body's shape against the protocol schema, and map the body by the wire rules.
register.request.json lets a body that asks for ephemeral through, so the
refusal order of PROTOCOL.md 5.1 is unchanged. DESIGN.md 6.1 and the Error
Handling rule describe the layering.

Signed-off-by: Alex <[email protected]>

* fix(runners): register's ephemeral is a JSON boolean, os and arch strict strings (task #220)

Alex's code review round 3 decision: no Rails boolean cast. The schema is
the only definition of asking for ephemeral (const true); any other
non-boolean value, and an os or arch that is not a string, is
invalid_registration.

Signed-off-by: Alex <[email protected]>

* refactor(runners): Proxy.holder takes named parameters, not the request headers

Signed-off-by: Alex <[email protected]>

---------

Signed-off-by: Alex <[email protected]>
Signed-off-by: Rozhnov Alexandr <[email protected]>
Co-authored-by: Alex <[email protected]>
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.

2 participants