• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

supabase / auth / 17658685860

11 Sep 2025 10:15PM UTC coverage: 67.645% (-3.0%) from 70.664%
17658685860

Pull #2148

github

web-flow
feat: background template reloading p2 - mailer template cache & interface refactor (#2150)

**Summary**
This PR builds on
[auth#2148](https://github.com/supabase/auth/pull/2148) to deliver phase
2, a robust template cache plus a simplified mail client interface.
Templates are now rendered once per type, cached with controlled
refresh, and then delivered via clients that only send pre-rendered
subject/body. This reduces latency and removes templating logic from
SMTP clients while preserving current behavior. It will also pave the
way for alternative Mailer implementations.

**Template cache + interface refactor**
* Replace `TemplateMailer` with `templatemailer.Mailer` that owns all
templating and a shared cache. Entries have a TTL and a shorter “recheck
interval”; on fetch/parse errors we serve the last good or fall back to
built-in defaults.
* Centralize default subjects/bodies and validate them at init. Typed
template keys are: `invite`, `confirmation, recovery`, `email_change`,
`magic_link`, `reauthentication`.
* Move headers logic into the mailer; keep `$messageType` substitution
and the legacy “reauthenticate” header name for compatibility.
* Change `mailer.Client.Mail` to `(ctx, to, subject, body, headers,
typ)` and update all clients accordingly (SMTP/Noop/Validate/Tasks).
* Persist a single mailer instance in `API`; add `WithMailer` for DI;
remove on-demand construction.

---------

Co-authored-by: Chris Stockton <chris.stockton@supabase.io>
Pull Request #2148: feat: background template reloading p1 - baseline decomposition

285 of 644 new or added lines in 10 files covered. (44.25%)

593 existing lines in 15 files now uncovered.

12745 of 18841 relevant lines covered (67.65%)

64.93 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/internal/api/apiworker/apiworker.go


Source Not Available

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc