Skip to content

feat(emails): send one email to many recipients with emails.batch - #373

Draft
Silthus wants to merge 31 commits into
feat/scheduled-email-sendfrom
feat/email-batch
Draft

Silthus wants to merge 31 commits into
feat/scheduled-email-sendfrom
feat/email-batch

Conversation

@Silthus

@Silthus Silthus commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

💡 Motivation and Context

A Ruby app that sends the same transactional email to many people, such as a launch note or an invoice run, has to call emails.send once per recipient. That means one request each, with its own retry and replay handling in the app.

This PR adds emails.batch, stacked on #370. It ports emails.batch from Python (PostHog/posthog-python#1291), the reference, and Node (PostHog/posthog-js#5847).

result = posthog.emails.batch(
  template_id: '<template UUID>',
  recipients: [
    { to: 'ada@example.com', idempotency_key: 'launch:ada', template_data: { name: 'Ada' } },
    { to: 'alan@example.com', idempotency_key: 'launch:alan', template_data: { name: 'Alan' } }
  ]
)
result.results.reject { |email| email.status == 'queued' } # send these again with the same keys

Impact

Ruby apps send one email to many recipients in one call, with a result per recipient. The server's batch send event shows whether Ruby senders use it once batch sends are on.

Caution

🔴 Merge risk: high · one-way door once the gem is published: emails.batch, Emails::BatchResult, Emails::BatchEmailResult and EmailBatchError become public API

  • Calls to emails.batch: new entry point. They send real emails to every recipient in one request, so a bug in keys or result mapping is silent harm: an email sent twice, or one reported as sent that wasn't. The specs cover it against WebMock. Live on PostHog Cloud US at HEAD: a batch of two with a same-key rerun, the 413 and 400 size refusals, and one key used by feat(emails): schedule a send with scheduled_at #370's emails.send and this PR's emails.batch, each from its own checkout, in both orders, each returning the first call's message ID with replayed: true.
  • Uncovered live: the code form (template_key with rendered content), a batch where PostHog queues some recipients and refuses others, retries and unconfirmed recipients (a 409 in flight, a 5xx, a lost answer), and a retry refused after an attempt that may have queued the batch. They run only against WebMock and the mutants; the recipients stay unconfirmed with the same-key advice, and the message says when an earlier attempt may have queued them. A missed bug there reports an email that went out as failed, and a rerun with a new key sends it twice.
  • Oversized batches: the client builds the whole request body before it sends, and PostHog may answer 413 before it checks whether batch sends are on. The size is the caller's own content times at most 100 recipients; the switch-off can't stop that memory use or that 413. A worker with little memory can be killed by a batch of very large content before PostHog answers.
  • Shared transport: the request helper gained a read-timeout argument whose default is the client's timeout, so emails.send, its attachment uploads and emails.get keep their waits. The shadow diff covers send and get; attachment uploads run only in the unchanged email specs.
  • Error names: a 409 batch_unavailable is named validation_error for every method, as in Python. The published spec's error table predates batch and names other 409s concurrent_idempotent_requests; emails.send and emails.get never receive batch_unavailable.
  • Warnings: a failed batch never calls the logger, and EmailBatchError#warnings holds the reply's warnings. A logger that raises after a batch that went through propagates its error, and the results are lost with it.
  • emails.send and emails.get: unchanged. A stubbed shadow diff of 14 inputs against feat(emails): schedule a send with scheduled_at #370's head matches every request, result, error and log line, and the existing email specs pass unchanged.
  • Switch-off: the server's batch sends. With them off, PostHog answers 409 batch_unavailable or 404, and the SDK raises EmailBatchError with every recipient failed, never sending one by one on its own. When an earlier attempt of the same call may have queued the batch, such as a 503 just before the switch went off, its recipients stay unconfirmed with the same-key advice instead.
  • Tier: critical (c: one-way door on public SDK API; g: real sends to recipients)

Rollout

  • Stages: feat(emails): schedule a send with scheduled_at #370 first, then the server's batch sends go on for customers, then this gem releases.
  • Decided: one request per call, at most 100 recipients, with the server's refusals as the error (Michael, d-c05485db). A refused retry after an attempt that may have queued the batch leaves it unconfirmed, as in the Elixir SDK (d-99642ec9). A failed batch never calls the logger and carries its warnings on the error (Michael, d-eb82aafc).
  • Watch: the live batch below, then the batch rows in the email status read.

What changes

  • emails.batch(recipients:, ...) takes the template form (template_id, shared template_data) or the code form (template_key, subject, html or text, and the optional sender and tracking fields), the same for every recipient.
  • Each recipient is a Hash, with Symbol or String keys: to, and optionally distinct_id, idempotency_key and, in the template form only, template_data, sent as the recipient's message_data.
  • One call sends exactly one request, of at most 100 recipients. More than 100 raise ArgumentError before any request, with the advice to split them. The client waits at least 45 seconds for the answer; connecting and writing keep the client's timeout.
  • Each recipient without an idempotency_key gets a UUID that every retry reuses. Two recipients with the same key raise ArgumentError before any request.
  • Retries follow emails.send: network errors, 429 and 503 retry with backoff, and the client stops retrying once it is shut down. The error is the last attempt's. Once an attempt may have queued the batch, a refused retry can't confirm it, so its recipients stay unconfirmed. Then EmailBatchError and each recipient's error start their message by saying an earlier attempt may have queued the email, and carry the same-key fix. Only the client's own shutdown before a retry reads as no attempt; a 503 from PostHog that names client_closed still may have queued it.
  • BatchResult#results has one BatchEmailResult per recipient, in order. Its status is one of:
    • queued
    • failed: PostHog refused it, such as a suppressed address, or refused the whole request
    • unconfirmed: an answer was lost or PostHog didn't confirm it, also when a later retry refused it. Its error's fix says to send it again with the same key within 24 hours of the first request that used it, so it goes out once.
  • The client never reads an email back after the batch. An unconfirmed email keeps its key, and a message ID only when PostHog named one.
  • A request that fails as a whole raises EmailBatchError, whose results hold every recipient. The HTTP status decides, not the code: a 4xx refused them, so they are failed with it as their error, unless an earlier attempt may have queued them. A 409 idempotency_key_in_flight, a 5xx, a lost answer and a 2xx without a result for each recipient may have, so they leave them unconfirmed with the same-key fix, whatever fix PostHog sent.
  • PostHog's refusals come back as the error, with PostHog's own fix: 413 content_too_large for a batch too large to take at once, whose fix says to split the recipients into smaller batches (the SDK adds that advice when the reply has none; a batch of one recipient, which can't be split, always gets the advice to make the email smaller); 400 content_too_large for shared content over PostHog's limit, which splitting doesn't change (a recipient whose own template_data is over it comes back failed with content_too_large in its result, while the others go out); batch_unavailable (409, never retried, named validation_error) and 404 with the fix to send each email with emails.send and its key, and the rest as PostHog names them. A field such as recipients__7__to names the recipient's place in the batch. The SDK checks only the recipient count, not the size of a request.
  • A refused recipient keeps its message ID on the result only, so EmailError#message_id still means PostHog may have accepted the email.
  • Warnings are logged once for a batch that goes through. A failed batch never calls the logger: EmailBatchError#warnings, the same field as EmailError#warnings, holds the reply's warnings.
  • A batch takes no cc, bcc, attachments or scheduled_at.

Known issues

  • A batch too large for PostHog, such as large shared content copied for each recipient, fails as a whole with a 413 content_too_large, and nothing goes out. The caller splits it into smaller batches. Shared content over PostHog's limit fails with a 400 content_too_large, and the caller makes it smaller.
  • Without stored keys, a rerun of a batch that failed gets new keys, and can send an email twice. The docs say to pass keys you store.
  • A logger that raises after a batch that went through loses the results with it. The warnings come from the logger, so the caller's logger has to work.
  • lib/posthog/email_batch.rb:53 builds the request body while the recipients' JSON is still held, so a batch near PostHog's size cap takes a few copies of its content in memory before PostHog answers.
  • lib/posthog/emails.rb:336: the emails.batch overview says to split the recipients after any 413. For a batch of one recipient, the error's own fix says to make the email smaller instead.

💚 How did you test it?

Test-first, in spec/posthog/emails_batch_spec.rb against WebMock, on Ruby 3.2.2:

  • one request with a result per recipient in order, the body with message_data per recipient, and the secret key as a Bearer token
  • derived UUID keys, kept on a retry after a 503
  • the code form body
  • 100 recipients in one request, and 101 refused with no request
  • per-recipient refusals as failed; unconfirmed answers, unreadable slots and a queued slot without a message ID as unconfirmed with their keys and no status read
  • the reply's warnings logged once; a failed batch never calls the logger and its error carries the warnings; a logger that raises after a batch that went through propagates its own error
  • a whole-request 400 with every recipient failed and the field PostHog named
  • a 413 with PostHog's code and fix, without a JSON body, with an empty code and fix, and with fields that aren't text, each as content_too_large with PostHog's fix or the advice to split, in one request; a one-recipient batch told to make the email smaller after a bare 413 and after PostHog's split fix; a 400 content_too_large kept as PostHog sent it, without split advice
  • batch_unavailable and 404 with their fixes
  • a 409 idempotency_key_in_flight with an empty fix and with PostHog's own fix, both leaving every recipient unconfirmed with the same-key fix
  • a connection reset past the retries, an answer without a result for each recipient, a 502 without a code, a 504 with one and a 503 naming client_closed, each leaving every recipient unconfirmed with the error's own message; a 403 without a code, and one naming keys in flight, leaving them failed
  • the last attempt's error after 503 and 503, 503 and 400, and 503 and 429, with the recipients unconfirmed, and after 429 and 400 failed
  • a lost answer followed by a 429, by a bare 413, and by a 2xx refusing one recipient, keeping those recipients unconfirmed with the same-key fix, and the batch error and each recipient's error saying an earlier attempt may have queued them
  • an unconfirmed recipient whose error has no detail from PostHog, saying it may still go out
  • a shutdown through client.shutdown before a retry, leaving the recipients unconfirmed with client_closed after a 503, and failed after a 429
  • the read timeout of at least 45 seconds and the client's connect and write timeouts handed to Net::HTTP; no spec waits them out
  • every bad argument raising ArgumentError before any request

43 mutants of the batch code, one per behavior above, each fail a spec at the head; the log is saved with the proof. bundle exec rubocop and bundle exec rake public_api:check pass.

Live, against PostHog Cloud US at this head, through an internal test template:

  • a batch of two, then the same batch with the same keys: both queued in order with their keys, and the replay returned the same message IDs with replayed: true. PostHog's status reads say both delivered.
  • a one-recipient body over PostHog's request cap: 413 content_too_large with the advice to make the email smaller in place of PostHog's split fix, the recipient failed. Shared content over its limit: 400 content_too_large without a fix, the recipient failed.
  • one key sent with emails.send and then emails.batch, and another the other way round, in one checkout: each second call returned the first call's message ID, and each ID reads delivered. PostHog marked both second calls replayed: false there, since the marker can lag a replay that follows at once; the docs now say so.
  • cross-version, each call in its own container: emails.send from feat(emails): schedule a send with scheduled_at #370's checkout (no batch method) and emails.batch from this head, one key per order. Both orders returned the first call's message ID with replayed: true, and both IDs read delivered.

The mailbox was not checked at this head; at the two heads before, the same runs left one email per recipient and per key.

Shadow diff of the shared send path, #370's head against this head: the same 14 inputs through emails.send and emails.get against the same stubbed replies, from a plain send to a connection reset and an unconfirmed scheduled send with warnings. Every wire request, result, error and log line matches.

📝 Checklist

  • All commits are signed (see Commit signing)
  • I reviewed the submitted code.
  • I added tests to verify the changes.
  • I updated the docs if needed.
  • No breaking change or entry added to the changelog.

If releasing new changes

  • Ran pnpm changeset to generate a changeset file

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

Claude Code (Claude Opus 5.5, claude-opus-5-5) wrote the code as one lane of the cross-SDK transactional email work, porting the Python batch and matching its error codes, retries, replay window and result shape.

Question Answer Who Where
Requests per batch call One request of at most 100 recipients; more is a local error, and PostHog's refusals, such as 413 content_too_large, come back as the error. Replaced chunking into requests of 100 recipients and 4 MiB. 👤 d-c05485db, conductor thread
A retry refused after an attempt that may have queued the batch Its recipients stay unconfirmed with the same-key advice, as in the Elixir SDK. Replaced: the last attempt deciding the status. 👤 d-99642ec9, conductor thread
Logger on a failed batch Never called: EmailBatchError#warnings carries the warnings. Replaced the cause-chain handling of a raising logger. 👤 conductor thread
Reading unconfirmed emails back by key Dropped in every SDK: an unconfirmed email stays so with its key, to send again with it. Replaced reading each one by key at the end of the batch. 👍 conductor thread
Batch for every SDK Build it now, stacked on the scheduled-send PR. 👍 conductor thread
Per-recipient values Each recipient's template_data, sent as message_data. The server's batch recipient takes only to, distinct_id, idempotency_key and message_data, as Python and Node send it. Rejected: a separate event body field the server refuses. 🤖 this PR
Batch contract where Python and Node differ Node and the server set it: a 409 idempotency_key_in_flight is unconfirmed, and batch_unavailable keeps its code with no retry. Rejected: Python's behavior on these. 🤖 conductor thread
A logger that raises after a batch that went through Its error propagates as it is. Rejected: swallowing it, which would also swallow a caller's deadline. 🤖 this PR
Fix for a one-recipient batch refused by a 413 Make the email smaller, in place of PostHog's split fix. Rejected: passing PostHog's split fix through, which can't help one recipient. 🤖 this PR

Involvement: no grilling rounds, no prototypes; one Hedge review panel, four Codex fixes reviews and fourteen Codex final reads, eleven of them past the review budget on the agent's call; a cross-SDK check against Node and the server; live proof and a stubbed shadow diff captured.

🤖 Generated with Claude Code

How did you test this code?

Proof What ran Result Commit
live-run emails.batch on PostHog Cloud US at 453ae70: a batch of two with a same-key replay, two size refusals, and send/batch same-key replays both ways All checks passed; the replay returned the same IDs, the one-recipient 413 carried the make-smaller fix, the 400 kept no split advice, and every ID reads delivered 453ae70
cross-version emails.send from the base checkout 2dfb241 and emails.batch from HEAD 453ae70, each in its own container, one key per order, on PostHog Cloud US Both orders returned the first call's message ID with replayed=true, and both IDs read delivered 453ae70
shadow-diff The 14 shared send and status inputs through #370 head and #373 head against the same stubbed replies Every request, result, error and log line matches 453ae70 (reused from ee472cc)
Review 5-lens panel (claude-opus-5-5, gpt-6.2-sol), round 1, round 2, round 3, round 4, round 5, final read 1, final read 2, final read 3, final read 4, final read 5, final read 6, final read 7, final read 8, final read 9, final read 10, final read 11, final read 12, final read 13, final read 14, final read 15 124 findings: 71 fixed, 53 rejected, 0 other 3b58e48 to 453ae70
Proof judge an independent model reads the evidence against the diff ❌ failed at 453ae70
PR Review rounds Production lines Sanity pass Skipped proofs
#373 5 rounds, 15 final reads 865 → 950 (×1.1); docs 5 → 5 not run judge: The arbiter stopped the judge retries over the timeout spec. Proof: a cross-version run now uses two checkouts, #370's send (no batch method) and HEAD's batch, both orders replayed with the same ID and read delivered. Timeout spec: no fake clock drives Net::HTTP socket timeouts, and without it the read-floor and connect-floor mutants survive. Memory before the request and the 413 overview line are Known issues with their lines; the callout now names the memory risk, the code form and mixed results as uncovered. The logger after a sent batch is a recorded 🤖 decision and Known issue. The same-key fix skip needs a reply carrying the SDK's own sentence, which PostHog never sends. The 409 batch_unavailable name matches posthog-python, and send and get never receive that code. (🤖 agent d-74fb3217)

Not checked: The code form (template_key with rendered content) live; A batch where PostHog queues some recipients and refuses others, live; Retries, lost answers and unconfirmed recipients live; they run against WebMock and the mutants; The mailbox at this head; PostHog status reads show every message ID delivered
Full receipt: https://artifacts.posthog.com/a/HBhbFkuVnfi9B8SEWM1K2J

emails.batch sends a template made in PostHog, with template_data per
recipient, or content your code rendered to up to 100 recipients and
4 MiB per request, one request after another, and returns a result per
recipient in order. Each recipient has its own idempotency key, given or
made by the client, that every retry reuses. After a lost answer, the
client reads each email that may have gone out by its key. A request
that fails as a whole stops the batch and raises EmailBatchError with
every recipient's result.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

posthog-ruby-sync Compliance Report

Date: 2026-11-24T21:39:33.077580+00:00
Duration: 94681ms

✅ All Tests Passed!

47/47 tests passed


Capture Tests

✅ 30/30 tests passed

View Details
Test Status Duration
Format Validation.Event Has Required Fields ✅ 10ms
Format Validation.Event Has Uuid ✅ 6ms
Format Validation.Event Has Lib Properties ✅ 7ms
Format Validation.Distinct Id Is String ✅ 9ms
Format Validation.Token Is Present ✅ 7ms
Format Validation.Custom Properties Preserved ✅ 8ms
Format Validation.Event Has Timestamp ✅ 7ms
Format Validation.Non Utc Event Timestamp Is Converted To Utc ✅ 7ms
Retry Behavior.Retries On 503 ✅ 5351ms
Retry Behavior.Does Not Retry On 400 ✅ 2010ms
Retry Behavior.Does Not Retry On 401 ✅ 2008ms
Retry Behavior.Respects Retry After Header ✅ 8017ms
Retry Behavior.Implements Backoff ✅ 15284ms
Retry Behavior.Retries On 500 ✅ 5161ms
Retry Behavior.Retries On 502 ✅ 5155ms
Retry Behavior.Retries On 504 ✅ 5156ms
Retry Behavior.Max Retries Respected ✅ 15605ms
Deduplication.Generates Unique Uuids ✅ 19ms
Deduplication.Preserves Uuid On Retry ✅ 5113ms
Deduplication.Preserves Uuid And Timestamp On Retry ✅ 10352ms
Deduplication.Preserves Uuid And Timestamp On Batch Retry ✅ 5120ms
Deduplication.No Duplicate Events In Batch ✅ 20ms
Deduplication.Different Events Have Different Uuids ✅ 11ms
Compression.Sends Gzip When Enabled ✅ 7ms
Batch Format.Uses Proper Batch Structure ✅ 6ms
Batch Format.Flush With No Events Sends Nothing ✅ 4ms
Batch Format.Synchronous Capture Delivers Each Event Immediately ✅ 19ms
Error Handling.Does Not Retry On 403 ✅ 2009ms
Error Handling.Does Not Retry On 413 ✅ 2010ms
Error Handling.Retries On 408 ✅ 5117ms

Feature_Flags Tests

✅ 17/17 tests passed

View Details
Test Status Duration
Request Payload.Request With Person Properties Device Id ✅ 11ms
Request Payload.Flags Request Uses V2 Query Param ✅ 9ms
Request Payload.Flags Request Hits Flags Path Not Decide ✅ 7ms
Request Payload.Flags Request Omits Authorization Header ✅ 7ms
Request Payload.Token In Flags Body Matches Init ✅ 6ms
Request Payload.Groups Round Trip ✅ 7ms
Request Payload.Groups Default To Empty Object ✅ 6ms
Request Payload.Disable Geoip False Propagates As Geoip Disable False ✅ 7ms
Request Payload.Disable Geoip Omitted Defaults To False ✅ 7ms
Request Payload.Flag Keys To Evaluate Contains Only Requested Key ✅ 6ms
Request Lifecycle.No Flags Request On Init Alone ✅ 3ms
Request Lifecycle.No Flags Request On Normal Capture ✅ 6ms
Request Lifecycle.Two Flag Calls Produce Two Remote Requests ✅ 10ms
Request Lifecycle.Mock Response Value Is Returned To Caller ✅ 7ms
Retry Behavior.Retries Flags On 502 ✅ 109ms
Retry Behavior.Retries Flags On 504 ✅ 109ms
Side Effect Events.Get Feature Flag Captures Feature Flag Called Event ✅ 8ms

@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

posthog-ruby-async Compliance Report

Date: 2026-11-24T21:39:31.389571+00:00
Duration: 98937ms

✅ All Tests Passed!

47/47 tests passed


Capture Tests

✅ 30/30 tests passed

View Details
Test Status Duration
Format Validation.Event Has Required Fields ✅ 110ms
Format Validation.Event Has Uuid ✅ 106ms
Format Validation.Event Has Lib Properties ✅ 108ms
Format Validation.Distinct Id Is String ✅ 106ms
Format Validation.Token Is Present ✅ 107ms
Format Validation.Custom Properties Preserved ✅ 107ms
Format Validation.Event Has Timestamp ✅ 106ms
Format Validation.Non Utc Event Timestamp Is Converted To Utc ✅ 6ms
Retry Behavior.Retries On 503 ✅ 5311ms
Retry Behavior.Does Not Retry On 400 ✅ 2109ms
Retry Behavior.Does Not Retry On 401 ✅ 2108ms
Retry Behavior.Respects Retry After Header ✅ 8115ms
Retry Behavior.Implements Backoff ✅ 15711ms
Retry Behavior.Retries On 500 ✅ 5213ms
Retry Behavior.Retries On 502 ✅ 5209ms
Retry Behavior.Retries On 504 ✅ 5210ms
Retry Behavior.Max Retries Respected ✅ 15621ms
Deduplication.Generates Unique Uuids ✅ 111ms
Deduplication.Preserves Uuid On Retry ✅ 5211ms
Deduplication.Preserves Uuid And Timestamp On Retry ✅ 10317ms
Deduplication.Preserves Uuid And Timestamp On Batch Retry ✅ 5214ms
Deduplication.No Duplicate Events In Batch ✅ 111ms
Deduplication.Different Events Have Different Uuids ✅ 107ms
Compression.Sends Gzip When Enabled ✅ 106ms
Batch Format.Uses Proper Batch Structure ✅ 105ms
Batch Format.Flush With No Events Sends Nothing ✅ 4ms
Batch Format.Multiple Events Batched Together ✅ 111ms
Error Handling.Does Not Retry On 403 ✅ 2109ms
Error Handling.Does Not Retry On 413 ✅ 2111ms
Error Handling.Retries On 408 ✅ 5212ms

Feature_Flags Tests

✅ 17/17 tests passed

View Details
Test Status Duration
Request Payload.Request With Person Properties Device Id ✅ 108ms
Request Payload.Flags Request Uses V2 Query Param ✅ 106ms
Request Payload.Flags Request Hits Flags Path Not Decide ✅ 106ms
Request Payload.Flags Request Omits Authorization Header ✅ 106ms
Request Payload.Token In Flags Body Matches Init ✅ 106ms
Request Payload.Groups Round Trip ✅ 106ms
Request Payload.Groups Default To Empty Object ✅ 106ms
Request Payload.Disable Geoip False Propagates As Geoip Disable False ✅ 107ms
Request Payload.Disable Geoip Omitted Defaults To False ✅ 105ms
Request Payload.Flag Keys To Evaluate Contains Only Requested Key ✅ 106ms
Request Lifecycle.No Flags Request On Init Alone ✅ 3ms
Request Lifecycle.No Flags Request On Normal Capture ✅ 105ms
Request Lifecycle.Two Flag Calls Produce Two Remote Requests ✅ 109ms
Request Lifecycle.Mock Response Value Is Returned To Caller ✅ 106ms
Retry Behavior.Retries Flags On 502 ✅ 245ms
Retry Behavior.Retries Flags On 504 ✅ 254ms
Side Effect Events.Get Feature Flag Captures Feature Flag Called Event ✅ 110ms

@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

SDK performance: posthog-ruby

1 change worth reviewing: 1 observed regression.

Flags require at least a 5% change in the median and all six pairs agreeing on direction. This is a noise filter, not proof of a performance change or a CI gate.

Test Measurement Before PR With PR Change
Refresh 1,000 flag definitions Idle process memory (RSS) 38.09 MiB 40.28 MiB 5.8% more memory
View all results
Test Measurement Before PR With PR Change Assessment
Capture and deliver events (32-byte payload, burst)
Shard: capture
Allocated memory per operation — — — unavailable; base:​ unsupported; head:​ unsupported; base:​ Ruby has no cumulative allocated-byte counter here; retained ObjectSpace bytes are not allocation volume.​; head:​ Ruby has no cumulative allocated-byte counter here; retained ObjectSpace bytes are not allocation volume.​
Capture and deliver events (4,096-byte payload, burst)
Shard: capture
Allocated memory per operation — — — unavailable; base:​ unsupported; head:​ unsupported; base:​ Ruby has no cumulative allocated-byte counter here; retained ObjectSpace bytes are not allocation volume.​; head:​ Ruby has no cumulative allocated-byte counter here; retained ObjectSpace bytes are not allocation volume.​
Capture and deliver events (32-byte payload, steady)
Shard: capture
Allocated memory per operation — — — unavailable; base:​ unsupported; head:​ unsupported; base:​ Ruby has no cumulative allocated-byte counter here; retained ObjectSpace bytes are not allocation volume.​; head:​ Ruby has no cumulative allocated-byte counter here; retained ObjectSpace bytes are not allocation volume.​
Capture and deliver events (4,096-byte payload, steady)
Shard: capture
Allocated memory per operation — — — unavailable; base:​ unsupported; head:​ unsupported; base:​ Ruby has no cumulative allocated-byte counter here; retained ObjectSpace bytes are not allocation volume.​; head:​ Ruby has no cumulative allocated-byte counter here; retained ObjectSpace bytes are not allocation volume.​
Queue an event (32-byte payload)
Shard: capture
Allocated memory per operation — — — unavailable; base:​ unsupported; head:​ unsupported; base:​ Background serialization has no public enqueue completion boundary; use completed-delivery workloads for process-wide allocation counts.​; head:​ Background serialization has no public enqueue completion boundary; use completed-delivery workloads for process-wide allocation counts.​
Queue an event (32-byte payload)
Shard: capture
Allocations per operation — — — unavailable; base:​ unsupported; head:​ unsupported; base:​ Background serialization has no public enqueue completion boundary; use completed-delivery workloads for process-wide allocation counts.​; head:​ Background serialization has no public enqueue completion boundary; use completed-delivery workloads for process-wide allocation counts.​
Queue an event (4,096-byte payload)
Shard: capture
Allocated memory per operation — — — unavailable; base:​ unsupported; head:​ unsupported; base:​ Background serialization has no public enqueue completion boundary; use completed-delivery workloads for process-wide allocation counts.​; head:​ Background serialization has no public enqueue completion boundary; use completed-delivery workloads for process-wide allocation counts.​
Queue an event (4,096-byte payload)
Shard: capture
Allocations per operation — — — unavailable; base:​ unsupported; head:​ unsupported; base:​ Background serialization has no public enqueue completion boundary; use completed-delivery workloads for process-wide allocation counts.​; head:​ Background serialization has no public enqueue completion boundary; use completed-delivery workloads for process-wide allocation counts.​
Evaluate all 10 flags
Shard: flags-scaling
Allocated memory per operation — — — unavailable; base:​ unsupported; head:​ unsupported; base:​ Ruby has no cumulative allocated-byte counter here; retained ObjectSpace bytes are not allocation volume.​; head:​ Ruby has no cumulative allocated-byte counter here; retained ObjectSpace bytes are not allocation volume.​
Evaluate all 100 flags
Shard: flags-scaling
Allocated memory per operation — — — unavailable; base:​ unsupported; head:​ unsupported; base:​ Ruby has no cumulative allocated-byte counter here; retained ObjectSpace bytes are not allocation volume.​; head:​ Ruby has no cumulative allocated-byte counter here; retained ObjectSpace bytes are not allocation volume.​
Evaluate all 1,000 flags
Shard: flags-scaling
Allocated memory per operation — — — unavailable; base:​ unsupported; head:​ unsupported; base:​ Ruby has no cumulative allocated-byte counter here; retained ObjectSpace bytes are not allocation volume.​; head:​ Ruby has no cumulative allocated-byte counter here; retained ObjectSpace bytes are not allocation volume.​
Evaluate one boolean flag
Shard: flags-single
Allocated memory per operation — — — unavailable; base:​ unsupported; head:​ unsupported; base:​ Ruby has no cumulative allocated-byte counter here; retained ObjectSpace bytes are not allocation volume.​; head:​ Ruby has no cumulative allocated-byte counter here; retained ObjectSpace bytes are not allocation volume.​
Evaluate a cohort-filtered flag
Shard: flags-single
Allocated memory per operation — — — unavailable; base:​ unsupported; head:​ unsupported; base:​ Ruby has no cumulative allocated-byte counter here; retained ObjectSpace bytes are not allocation volume.​; head:​ Ruby has no cumulative allocated-byte counter here; retained ObjectSpace bytes are not allocation volume.​
Evaluate a flag (early match)
Shard: flags-single
Allocated memory per operation — — — unavailable; base:​ unsupported; head:​ unsupported; base:​ Ruby has no cumulative allocated-byte counter here; retained ObjectSpace bytes are not allocation volume.​; head:​ Ruby has no cumulative allocated-byte counter here; retained ObjectSpace bytes are not allocation volume.​
Evaluate a flag (late match)
Shard: flags-single
Allocated memory per operation — — — unavailable; base:​ unsupported; head:​ unsupported; base:​ Ruby has no cumulative allocated-byte counter here; retained ObjectSpace bytes are not allocation volume.​; head:​ Ruby has no cumulative allocated-byte counter here; retained ObjectSpace bytes are not allocation volume.​
Evaluate a flag (no match)
Shard: flags-single
Allocated memory per operation — — — unavailable; base:​ unsupported; head:​ unsupported; base:​ Ruby has no cumulative allocated-byte counter here; retained ObjectSpace bytes are not allocation volume.​; head:​ Ruby has no cumulative allocated-byte counter here; retained ObjectSpace bytes are not allocation volume.​
Evaluate a property-filtered flag
Shard: flags-single
Allocated memory per operation — — — unavailable; base:​ unsupported; head:​ unsupported; base:​ Ruby has no cumulative allocated-byte counter here; retained ObjectSpace bytes are not allocation volume.​; head:​ Ruby has no cumulative allocated-byte counter here; retained ObjectSpace bytes are not allocation volume.​
Evaluate a regex-filtered flag
Shard: flags-single
Allocated memory per operation — — — unavailable; base:​ unsupported; head:​ unsupported; base:​ Ruby has no cumulative allocated-byte counter here; retained ObjectSpace bytes are not allocation volume.​; head:​ Ruby has no cumulative allocated-byte counter here; retained ObjectSpace bytes are not allocation volume.​
Evaluate a rollout flag
Shard: flags-single
Allocated memory per operation — — — unavailable; base:​ unsupported; head:​ unsupported; base:​ Ruby has no cumulative allocated-byte counter here; retained ObjectSpace bytes are not allocation volume.​; head:​ Ruby has no cumulative allocated-byte counter here; retained ObjectSpace bytes are not allocation volume.​
Evaluate a multivariate flag
Shard: flags-single
Allocated memory per operation — — — unavailable; base:​ unsupported; head:​ unsupported; base:​ Ruby has no cumulative allocated-byte counter here; retained ObjectSpace bytes are not allocation volume.​; head:​ Ruby has no cumulative allocated-byte counter here; retained ObjectSpace bytes are not allocation volume.​
Capture and deliver events (32-byte payload, burst)
Shard: capture
Allocations per operation 56.27 count/op 56.27 count/op No observed change Not flagged
Capture and deliver events (32-byte payload, burst)
Shard: capture
Time per operation 108.52 µs/op 108.51 µs/op <0.1% less time Not flagged
Capture and deliver events (32-byte payload, burst)
Shard: capture
Idle process memory (RSS) 28.46 MiB 28.68 MiB 0.8% more memory Not flagged
Capture and deliver events (32-byte payload, burst)
Shard: capture
Observed peak process memory (RSS) 31.42 MiB 31.32 MiB 0.3% less memory Not flagged
Capture and deliver events (32-byte payload, burst)
Shard: capture
Managed heap after settling 5.3 MiB 5.31 MiB 0.2% more memory Not flagged
Capture and deliver events (32-byte payload, burst)
Shard: capture
Process memory after settling (RSS) 30.64 MiB 30.55 MiB 0.3% less memory Not flagged
Capture and deliver events (32-byte payload, burst)
Shard: capture
Process CPU time per operation 19.01 µs/op 19.07 µs/op 0.3% more time Not flagged
Capture and deliver events (32-byte payload, burst)
Shard: capture
Lifetime peak process memory (RSS) 31.23 MiB 31.15 MiB 0.3% less memory Not flagged
Capture and deliver events (4,096-byte payload, burst)
Shard: capture
Allocations per operation 58.65 count/op 58.65 count/op No observed change Not flagged
Capture and deliver events (4,096-byte payload, burst)
Shard: capture
Time per operation 108.49 µs/op 108.53 µs/op <0.1% more time Not flagged
Capture and deliver events (4,096-byte payload, burst)
Shard: capture
Idle process memory (RSS) 33.2 MiB 33.54 MiB 1% more memory Not flagged
Capture and deliver events (4,096-byte payload, burst)
Shard: capture
Observed peak process memory (RSS) 42.28 MiB 41.65 MiB 1.5% less memory Not flagged
Capture and deliver events (4,096-byte payload, burst)
Shard: capture
Managed heap after settling 9.17 MiB 9.18 MiB 0.1% more memory Not flagged
Capture and deliver events (4,096-byte payload, burst)
Shard: capture
Process memory after settling (RSS) 39.67 MiB 38.34 MiB 3.4% less memory Not flagged
Capture and deliver events (4,096-byte payload, burst)
Shard: capture
Process CPU time per operation 26.3 µs/op 26.37 µs/op 0.3% more time Not flagged
Capture and deliver events (4,096-byte payload, burst)
Shard: capture
Lifetime peak process memory (RSS) 42.05 MiB 41.54 MiB 1.2% less memory Not flagged
Capture and deliver events (32-byte payload, steady)
Shard: capture
Allocations per operation 58.68 count/op 58.68 count/op No observed change Not flagged
Capture and deliver events (32-byte payload, steady)
Shard: capture
Time per operation 1.01 ms/op 1.01 ms/op <0.1% more time Not flagged
Capture and deliver events (32-byte payload, steady)
Shard: capture
Idle process memory (RSS) 28.47 MiB 28.56 MiB 0.3% more memory Not flagged
Capture and deliver events (32-byte payload, steady)
Shard: capture
Observed peak process memory (RSS) 30.45 MiB 30.56 MiB 0.4% more memory Not flagged
Capture and deliver events (32-byte payload, steady)
Shard: capture
Managed heap after settling 5.3 MiB 5.31 MiB 0.2% more memory Not flagged
Capture and deliver events (32-byte payload, steady)
Shard: capture
Process memory after settling (RSS) 30.45 MiB 30.56 MiB 0.4% more memory Not flagged
Capture and deliver events (32-byte payload, steady)
Shard: capture
Process CPU time per operation 27.74 µs/op 28.72 µs/op 3.5% more time Not flagged
Capture and deliver events (32-byte payload, steady)
Shard: capture
Lifetime peak process memory (RSS) 30.45 MiB 30.56 MiB 0.4% more memory Not flagged
Capture and deliver events (4,096-byte payload, steady)
Shard: capture
Allocations per operation 58.68 count/op 58.67 count/op <0.1% fewer Not flagged
Capture and deliver events (4,096-byte payload, steady)
Shard: capture
Time per operation 1.01 ms/op 1.01 ms/op <0.1% more time Not flagged
Capture and deliver events (4,096-byte payload, steady)
Shard: capture
Idle process memory (RSS) 33.26 MiB 33.53 MiB 0.8% more memory Not flagged
Capture and deliver events (4,096-byte payload, steady)
Shard: capture
Observed peak process memory (RSS) 41.05 MiB 41.96 MiB 2.2% more memory Not flagged
Capture and deliver events (4,096-byte payload, steady)
Shard: capture
Managed heap after settling 9.17 MiB 9.18 MiB 0.1% more memory Not flagged
Capture and deliver events (4,096-byte payload, steady)
Shard: capture
Process memory after settling (RSS) 41.05 MiB 40.19 MiB 2.1% less memory Not flagged
Capture and deliver events (4,096-byte payload, steady)
Shard: capture
Process CPU time per operation 29.56 µs/op 30.36 µs/op 2.7% more time Not flagged
Capture and deliver events (4,096-byte payload, steady)
Shard: capture
Lifetime peak process memory (RSS) 41.05 MiB 41.81 MiB 1.9% more memory Not flagged
Queue an event (32-byte payload)
Shard: capture
Caller-thread CPU time per operation 8.53 µs/op 8.49 µs/op 0.4% less time Not flagged
Queue an event (32-byte payload)
Shard: capture
Time per operation 8.53 µs/op 8.49 µs/op 0.4% less time Not flagged
Queue an event (4,096-byte payload)
Shard: capture
Caller-thread CPU time per operation 8.39 µs/op 8.41 µs/op 0.3% more time Not flagged
Queue an event (4,096-byte payload)
Shard: capture
Time per operation 8.38 µs/op 8.41 µs/op 0.3% more time Not flagged
Evaluate all 10 flags
Shard: flags-scaling
Allocations per operation 343.02 count/op 343.02 count/op No observed change Not flagged
Evaluate all 10 flags
Shard: flags-scaling
Time per operation 91.66 µs/op 91.33 µs/op 0.4% less time Not flagged
Evaluate all 10 flags
Shard: flags-scaling
Process CPU time per operation 91.64 µs/op 91.31 µs/op 0.4% less time Not flagged
Evaluate all 100 flags
Shard: flags-scaling
Allocations per operation 3,324 count/op 3,324 count/op No observed change Not flagged
Evaluate all 100 flags
Shard: flags-scaling
Time per operation 875.7 µs/op 883.83 µs/op 0.9% more time Not flagged
Evaluate all 100 flags
Shard: flags-scaling
Process CPU time per operation 875.66 µs/op 883.65 µs/op 0.9% more time Not flagged
Evaluate all 1,000 flags
Shard: flags-scaling
Allocations per operation 33,113.56 count/op 33,113.94 count/op <0.1% more Not flagged
Evaluate all 1,000 flags
Shard: flags-scaling
Time per operation 8.9 ms/op 9.1 ms/op 2.2% more time Not flagged
Evaluate all 1,000 flags
Shard: flags-scaling
Process CPU time per operation 8.9 ms/op 9.1 ms/op 2.2% more time Not flagged
Evaluate 1,000 flags under concurrent load
Shard: flags-memory
Idle process memory (RSS) 38.89 MiB 38.27 MiB 1.6% less memory Not flagged
Evaluate 1,000 flags under concurrent load
Shard: flags-memory
Observed peak process memory (RSS) 40.37 MiB 40.57 MiB 0.5% more memory Not flagged
Evaluate 1,000 flags under concurrent load
Shard: flags-memory
Managed heap after settling 8 MiB 8.01 MiB 0.1% more memory Not flagged
Evaluate 1,000 flags under concurrent load
Shard: flags-memory
Process memory after settling (RSS) 39.41 MiB 40.2 MiB 2% more memory Not flagged
Evaluate 1,000 flags under concurrent load
Shard: flags-memory
Lifetime peak process memory (RSS) 40.11 MiB 40.29 MiB 0.5% more memory Not flagged
Refresh 1,000 flag definitions
Shard: flags-memory
Idle process memory (RSS) 38.09 MiB 40.28 MiB 5.8% more memory Worth reviewing: observed regression
Refresh 1,000 flag definitions
Shard: flags-memory
Observed peak process memory (RSS) 43.94 MiB 41.83 MiB 4.8% less memory Not flagged
Refresh 1,000 flag definitions
Shard: flags-memory
Managed heap after settling 9.51 MiB 9.52 MiB 0.1% more memory Not flagged
Refresh 1,000 flag definitions
Shard: flags-memory
Process memory after settling (RSS) 42.39 MiB 40.26 MiB 5% less memory Not flagged
Refresh 1,000 flag definitions
Shard: flags-memory
Lifetime peak process memory (RSS) 43.97 MiB 41.72 MiB 5.1% less memory Not flagged
Evaluate one boolean flag
Shard: flags-single
Allocations per operation 38 count/op 38 count/op No observed change Not flagged
Evaluate one boolean flag
Shard: flags-single
Time per operation 7.86 µs/op 7.89 µs/op 0.3% more time Not flagged
Evaluate one boolean flag
Shard: flags-single
Process CPU time per operation 7.86 µs/op 7.89 µs/op 0.3% more time Not flagged
Evaluate a cohort-filtered flag
Shard: flags-single
Allocations per operation 38 count/op 38 count/op No observed change Not flagged
Evaluate a cohort-filtered flag
Shard: flags-single
Time per operation 10.48 µs/op 10.5 µs/op 0.2% more time Not flagged
Evaluate a cohort-filtered flag
Shard: flags-single
Process CPU time per operation 10.48 µs/op 10.5 µs/op 0.2% more time Not flagged
Evaluate a flag (early match)
Shard: flags-single
Allocations per operation 55 count/op 55 count/op No observed change Not flagged
Evaluate a flag (early match)
Shard: flags-single
Time per operation 13.43 µs/op 13.45 µs/op 0.2% more time Not flagged
Evaluate a flag (early match)
Shard: flags-single
Process CPU time per operation 13.43 µs/op 13.45 µs/op 0.2% more time Not flagged
Evaluate a flag (late match)
Shard: flags-single
Allocations per operation 76 count/op 76 count/op No observed change Not flagged
Evaluate a flag (late match)
Shard: flags-single
Time per operation 18.82 µs/op 18.83 µs/op <0.1% more time Not flagged
Evaluate a flag (late match)
Shard: flags-single
Process CPU time per operation 18.82 µs/op 18.83 µs/op <0.1% more time Not flagged
Evaluate a flag (no match)
Shard: flags-single
Allocations per operation 67 count/op 67 count/op No observed change Not flagged
Evaluate a flag (no match)
Shard: flags-single
Time per operation 17.37 µs/op 16.97 µs/op 2.3% less time Not flagged
Evaluate a flag (no match)
Shard: flags-single
Process CPU time per operation 17.37 µs/op 16.97 µs/op 2.3% less time Not flagged
Evaluate a property-filtered flag
Shard: flags-single
Allocations per operation 34 count/op 34 count/op No observed change Not flagged
Evaluate a property-filtered flag
Shard: flags-single
Time per operation 8.07 µs/op 8.08 µs/op 0.1% more time Not flagged
Evaluate a property-filtered flag
Shard: flags-single
Process CPU time per operation 8.07 µs/op 8.07 µs/op <0.1% less time Not flagged
Evaluate a regex-filtered flag
Shard: flags-single
Allocations per operation 99 count/op 99 count/op <0.1% fewer Not flagged
Evaluate a regex-filtered flag
Shard: flags-single
Time per operation 22.84 µs/op 22.82 µs/op 0.1% less time Not flagged
Evaluate a regex-filtered flag
Shard: flags-single
Process CPU time per operation 22.84 µs/op 22.82 µs/op 0.1% less time Not flagged
Evaluate a rollout flag
Shard: flags-single
Allocations per operation 31 count/op 31 count/op No observed change Not flagged
Evaluate a rollout flag
Shard: flags-single
Time per operation 7.04 µs/op 6.88 µs/op 2.3% less time Not flagged
Evaluate a rollout flag
Shard: flags-single
Process CPU time per operation 7.04 µs/op 6.88 µs/op 2.3% less time Not flagged
Evaluate a multivariate flag
Shard: flags-single
Allocations per operation 37 count/op 37 count/op No observed change Not flagged
Evaluate a multivariate flag
Shard: flags-single
Time per operation 8.83 µs/op 8.84 µs/op 0.1% more time Not flagged
Evaluate a multivariate flag
Shard: flags-single
Process CPU time per operation 8.83 µs/op 8.84 µs/op 0.1% more time Not flagged

Values are medians of paired measurements. Not flagged does not mean unchanged. Unavailable means a measurement could not be provided, not zero. Estimated allocation measurements retain their instrumentation uncertainty. RSS measures the whole process, not just SDK allocations; observed peaks are sampled checkpoints. Paired ranges in the diagnostics describe variability, not confidence intervals.

Each shard uses its own runner; compare Before PR against With PR within a row, not across shards.

Compared 2dfb241992f87ba050a44d02f1e180f491e46cb0 → 453ae7043f7a85fdf5aa5eff378c1a31a4e43026.

Full report and diagnostics

102 metric rows; 102 rows shown in all results. Omitted or shortened data remain in comparison.json, including per-runner environments, resource limits, measurement methods, samples and checkpoints.

Silthus and others added 26 commits November 24, 2026 07:31
…limits

- a status read by key that reads failed keeps the recipient unconfirmed
- a refused recipient's error carries no message ID
- only the wait for a batch answer gets the 45 s floor
- shared content over 4 MiB raises ArgumentError before any request
- build each request body when it goes out
- Ruby's keyword check refuses unknown batch arguments
- the changeset says reruns replay only with stored keys

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…r recipient

- a status read by key that reads failed keeps an earlier later_error, and its error has no message ID
- shared content too large for a request fails each recipient with content_too_large again, as in Python and Node
- specs pin the 4 MiB boundary to the byte and the three batch timeouts

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- the fix names the recipient's template_data or the batch's content, since a single send has its own size limit
- a spec covers shared content too large for any request: every recipient fails with content_too_large, and no request goes out

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A request refused with idempotency_key_in_flight leaves its recipients
unconfirmed, also after a later refusal. batch_unavailable keeps its code
and is named a validation_error, not concurrent_idempotent_requests. The
client reads by key every unconfirmed email without a message ID at the end
of each batch, on success too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A status read by key marked the email queued on any status but failed, so an
unreadable slot could turn queued on an archived read. It now adds the ID and
keeps the email unconfirmed. The last retry's error stays each recipient's
later_error again, and the 4 MiB split spec keeps each email under 1.5 MiB.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ler's deadline

A 409 idempotency_key_in_flight is now the unconfirmed recipient's error, so
a failed status read by key can give its reason as later_error. A caller's
Timeout::Error deadline during a status read by key now propagates instead
of ending the reads.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An unconfirmed recipient keeps its idempotency key and no message ID, and
its error's fix says to send it again with the same key.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e resend fix

A retry that refuses an unconfirmed recipient no longer replaces the error
that left it unconfirmed, an answer without a result per recipient is its
only error, an in-flight refusal with an empty fix still says to resend
with the same key, and a logger's reused exception names the failed batch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Takes #370's logger rule into the shared helper: a logger's error
propagates when it has no cause or the call's error is among its causes,
and an exception object it raised before becomes the cause of the
call's error. Also records a retry's 5xx refusal as the later_error of
a recipient an earlier attempt left unconfirmed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… refusal

Merges the scheduled-send branch, so a failed send or batch no longer
calls the logger and carries its warnings on EmailError#warnings.
EmailBatchError takes the field from EmailError.

A refusal under 500 now becomes the later_error of a recipient an
earlier attempt may have queued as it arrives, so a final network
error no longer drops it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
emails.batch now sends exactly one request. More than 100 recipients is a
local ArgumentError before anything is sent. Server refusals, such as a 413
too_large, come back as the error for every recipient. The chunk loop,
not_attempted, later_error and the cross-request sizing are gone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…one out

A 4xx refused the batch, so its recipients are failed, except a 409 for
keys still in flight. No answer, a 5xx and an unreadable 2xx leave them
unconfirmed whatever code the reply names. A 413 keeps PostHog's own
content_too_large code.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…d it

After a lost answer, a 5xx or a 409 for keys in flight, a refused retry
can't confirm the recipients: they stay unconfirmed with the same-key
advice, whether the retry refused the request or one recipient. The
in-flight exception needs a 409. A 413 keeps PostHog's own fix, falls
back to the advice to split, and maps an empty code to
content_too_large. A 400 content_too_large stays as PostHog sent it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
client_closed means the client sent no retry, so on its own it says
nothing about what PostHog queued: a 429 then a shutdown stays failed.
A 413 keeps its code and split advice when PostHog's fields aren't
text. The docs say a recipient's own oversized data comes back in its
result, not as the whole-request 400.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A retry's refusal no longer reads as if no email was sent when an earlier
attempt may have queued the batch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A 503 from PostHog that names client_closed may still have queued the batch,
so its recipients stay unconfirmed. Only the error the client raises before a
retry, which sends no request, says nothing about what PostHog queued.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s carry

Also checks that a request error keeps its own message when that attempt alone
may have queued the batch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Silthus and others added 4 commits November 24, 2026 21:56
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
When only an earlier attempt may have queued the batch, EmailBatchError itself
now says so and carries the same-key fix, not the refusal's 'no email was
sent'. A one-recipient batch refused by a 413 is told to make the email
smaller, even when PostHog's reply advises a split.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ves no detail

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Also gives the changeset the advice for a one-recipient batch refused as too
large.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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