Skip to content

feat(emails): schedule a send with scheduled_at - #370

Draft
Silthus wants to merge 21 commits into
mainfrom
feat/scheduled-email-send
Draft

Silthus wants to merge 21 commits into
mainfrom
feat/scheduled-email-send

Conversation

@Silthus

@Silthus Silthus commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

💡 Motivation and Context

PostHog Cloud now schedules transactional emails on the server, but the Ruby SDK has no way to ask for it. A Ruby app that wants a reminder tomorrow has to run its own job queue to send later.

This PR adds scheduled_at to emails.send, on both forms (template and code), and nothing more: no cancel, move, list or batch. It matches the Node (PostHog/posthog-js#5694) and Python (PostHog/posthog-python#1240) SDKs.

result = posthog.emails.send(
  to: 'user@example.com',
  template_id: '<template UUID>',
  scheduled_at: Time.now + 86_400,
  idempotency_key: 'trial-ending:user_123'
)
result.status       # => "scheduled"
result.scheduled_at # => the confirmed time, in UTC

Impact

Lets Ruby apps on PostHog Cloud schedule a transactional email up to 7 days ahead without a job queue of their own. The server's send event carries a scheduled property, which shows whether Ruby senders use it once the server flag is on.

Caution

🔵 Merge risk: low, 🔴 at release · one-way door once the Client Libraries team approves the gem release: scheduled_at, SendResult#status, SendResult#scheduled_at and EmailError#message_id become public API, and scheduled emails already accepted still go out with the flag off

  • Merge: nothing reaches callers. The release workflow waits for approval in the Release environment before it bumps the version and publishes.
  • Sends with scheduled_at, on PostHog Cloud US and EU, once released: new entry point. The client sends the time in UTC to the millisecond, rounded up, and checks the 202 before it returns. A wrong check is silent harm (an email out at the wrong time, or a false error). The specs cover it against WebMock, and one live send covers PostHog Cloud US at f41adaa, whose library this head keeps.
  • Uncovered live: a 2xx that doesn't confirm the time, which raises schedule_not_confirmed for an email PostHog accepted. The specs cover it against WebMock; the error carries the message ID and says to read the email before sending again. A missed bug there leaves the caller with an error for an accepted email.
  • Uncovered live: delivery on PostHog Cloud EU, and the flag-off 400. The specs cover a refused time (scheduled_too_far) against WebMock, but not the flag-off answer itself. A missed bug there sends at the wrong time or raises a false schedule_not_confirmed.
  • A send-now answer for a time at most a minute ahead by the client's clock is accepted as queued, so that email can go out up to a minute early. By design, for clock skew. The client compares the time after rounding it up, so a time exactly a minute ahead can land just past the line and raise schedule_not_confirmed with the message ID for an email PostHog queued.
  • Sends without scheduled_at: unchanged on the wire, with status: "queued" and scheduled_at: nil added to the result. The existing email specs pass unchanged, and the live shadow diff covers PostHog Cloud US.
  • SendResult gains a Struct member, which changes its Marshal format both ways: a SendResult an older gem marshaled, such as one in a Rails cache, doesn't load in this one, and one this gem marshaled doesn't load in an older one. During a rolling upgrade, a process still on the older gem raises TypeError reading a result a newer process cached, until the upgrade finishes. A failed cache read in the caller's app, never a send; cosmetic for a cache that refills. No cross-version run covers it (Michael accepted the gap, d-123a1b48).
  • Every SendResult, scheduled or not, has four members once released: a pattern match on three elements, such as in [id, replayed, warnings], no longer matches, and to_h and to_a gain scheduled_at. A hash pattern such as in { id: } still matches. The changeset says so.
  • Warnings: a send that raises schedule_not_confirmed never calls the logger, and its error carries the reply's warnings on EmailError#warnings. A successful send logs them as before. The specs cover both against WebMock; no live reply carried a warning.
  • Sends with scheduled_at on any other host (self-hosted, reverse proxy, custom domain): refused before any request with scheduling_requires_cloud, since an older server would drop the field and send at once.
  • Switch-off: the server's workflows-email-scheduled-sends flag. With it off, PostHog answers 400 on scheduled_at and the SDK raises it, never sending without the time. Emails already scheduled still go out.
  • Tier: critical (c: one-way door on public SDK API; g: real sends to recipients)

Rollout

  • Stages: the server's S1 and S2 deploy to US and EU, the flag goes on, then this gem releases.
  • Decided: a failed send never calls the logger and carries its warnings on the error (Michael, d-eb82aafc).
  • Watch: the live scheduled send below, then scheduled rows in the email status read.

What changes

  • emails.send(scheduled_at:) takes a Time (a Rails time with zone too), a DateTime, or an ISO 8601 string with an explicit offset, +01:00 or +0100 as strftime('%z') writes it. A string without an offset, a date that the Gregorian calendar lacks, a Date, or a number raises ArgumentError before any request.
  • The client rounds a finer time up to the next millisecond and sends the same value on every retry. It accepts a send-now answer only for a time at most a minute ahead by its clock, so such an email can go out up to a minute early.
  • On a send with scheduled_at, the 202 has to confirm the time:
    • status: "scheduled" with exactly the sent instant returns status: "scheduled" and scheduled_at as a UTC Time.
    • status: "queued" with scheduled_at: null (the time had passed) returns status: "queued" and scheduled_at: nil, but only when the time is at most a minute ahead by the client clock, read once before the first request. Further ahead, it raises schedule_not_confirmed.
    • Anything else, such as no scheduled_at key or another instant, raises schedule_not_confirmed with EmailError#message_id, and is never retried. The fix text says to read the email with emails.get before sending again. The error carries the reply's warnings on the new EmailError#warnings, and the client doesn't log them: it logs warnings only for a send that succeeds. This is the one 2xx whose warnings the SDK does not log, so the email skill's "unless its SDK already does" doesn't hold for it: an app that rescues schedule_not_confirmed logs EmailError#warnings itself.
  • SendResult#status is derived from scheduled_at, so it has no writer.
  • The scheduling_requires_cloud message names only the host and port, never credentials in the URL.
  • A 400 on scheduled_at raises as a normal EmailError. There is no fallback to sending now.
  • emails.get already passes statuses through. Its docs now name scheduled.

Known issues

  • Self-hosted PostHog, a reverse proxy or a custom domain can't schedule in v1, by design. That waits for a server capability check.
  • A client clock that runs more than a minute slow can turn a correct send-now answer, for a time that had passed, into a false schedule_not_confirmed. The email exists and emails.get reads it.
  • lib/posthog/emails.rb:73: SendResult gains a Struct member, so its Marshal format changes both ways. A result one gem version cached doesn't load in the other, including during a rolling upgrade. The changeset says so, and Michael accepted it (d-123a1b48).
  • lib/posthog/emails.rb:73: the new member also breaks pattern matches on three elements and adds scheduled_at to to_h and to_a, for every send. The changeset says so.
  • lib/posthog/emails.rb:716: a time exactly a minute ahead, compared after rounding, can raise schedule_not_confirmed for an email PostHog queued. The error carries the message ID and says to read the email before sending again.
  • lib/posthog/emails.rb:391: a scheduled_at string in an ASCII-incompatible encoding, such as UTF-16LE, raises Encoding::CompatibilityError instead of ArgumentError. It still refuses before any request, so nothing is sent.
  • Waiting sends are not cancellable from the SDK in v1. Disabling the email's workflow until they reach a final status is the escape hatch.

💚 How did you test it?

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

  • a Time with a +01:00 offset, a string with +02:00, a Rails time with zone and a DateTime all send the same UTC millisecond, on both forms
  • sub-millisecond times round up, and a 503 retry sends the same value
  • times without an offset, impossible dates (Julian-only 1500-02-29 among them), a Date and an integer raise before any request
  • a non-Cloud app host raises scheduling_requires_cloud before the attachment upload or the send, without the URL's credentials; EU schedules
  • a 202 with the exact instant, a same-key replay, a past time or one exactly 60 s ahead answered queued with null; the same answer for a time 60.001 s ahead raises schedule_not_confirmed, also when the reply comes 2 s late for a time 61 s ahead, or a 503 retry comes 2 s later
  • six unconfirmed 202 shapes, a microsecond-earlier time among them, raise schedule_not_confirmed with the message ID after one request, and that ID reads the email; so does a reply time that isn't valid UTF-8
  • an unconfirmed send never calls the logger, even one that raises, and its error carries the reply's warnings; a confirmed send logs them after client.shutdown reads the send as settled, and a raising logger's error or a caller's deadline of any class propagates as it is
  • the server's scheduled_too_far 400 raises with no second request
  • emails.get passes a status it doesn't map through, archived as the case

bundle exec rubocop and bundle exec rake public_api:check pass. In Docker, spec/posthog/rails/template_backtrace_spec.rb fails the same way on main, so CI is the reference for the full suite. CI's non-required "RSpec (latest Rails / stable Ruby)" job fails on main too, and is unrelated to this PR: regexp_parser 2.13.2 breaks json_schemer while the MCP specs load.

Live, against PostHog Cloud US at f41adaa, whose library and specs this head keeps: one scheduled send about 5 minutes ahead, with same-key replays before and after the due time. The 202 confirmed the time, and each replay returned the same message ID and time. The status read says delivered, and the delivery log and the inbox show one email at its time. No reply carried a warning: PostHog returns one only for a project with no verified sending domain, and the proof project has one.

Shadow diff against main, live on PostHog Cloud US: one ordinary send without scheduled_at from each. The request body and the 202 reply match. The head result adds scheduled_at: nil and status: "queued", and both emails arrived. main's email specs pass unchanged against this branch's lib/.

Not checked: a SendResult marshaled across gem versions, in either direction. Adding the Struct member changes its Marshal format, and the changeset says so. Not checked live: a reply that carries a warning.

📝 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 scheduled-send work. It followed the server's v1 contract and aligned edge cases with the Node and Python PRs. Two choices were deliberate: the result returns scheduled_at as a Time, as Status does for its times, and the schedule_not_confirmed fix text gives one piece of advice for every caller, as in Python: read the email with emails.get before sending again.

Question Answer Who Where
Logger on a failed send Never called: the error carries the reply's warnings on EmailError#warnings. Replaced the cause-chain handling of a raising logger. 👤 conductor thread
Error code names Python's scheduling_requires_cloud and schedule_not_confirmed, the same in every SDK. 👍 conductor thread
Send-now answer for a time ahead Refuse it with schedule_not_confirmed past a minute of clock skew, in every SDK. 👍 conductor thread
Review rounds past the budget Run one more round each time: read the fix of final read 5, then the tests and docs the judge asked for. 👍 conductor thread
SendResult Marshal format Accept the cross-version gap and name the change in the changeset. 👍 conductor thread
Cloud host check Exact US or EU app host, as Python and Node do. Rejected: normalizing spellings such as :443, since a refusal never sends early. 🤖 this PR

Involvement: no grilling rounds, no prototypes; one Hedge review panel (Claude fresh eyes, Codex correctness, risk, design and anti-overengineering), one Codex fixes review and thirteen Codex final reads, three of them past the review budget on the agent's call; live sends captured at three heads, and a live shadow diff.

🤖 Generated with Claude Code

How did you test this code?

Proof What ran Result Commit
live-run One scheduled send 5 minutes ahead on PostHog Cloud US at this head, same-key replays before and after the due time, status reads Confirmed time, same ID on replays, one email delivered at its time; no reply carried a warning 17744e9 (reused from f41adaa)
cross-version not run gap, accepted
Review 5-lens panel (claude-opus-5-5, gpt-6.2-sol), round 1, round 2, 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 92 findings: 64 fixed, 28 rejected, 0 other 1ae7ecf to 17744e9
Proof judge an independent model reads the evidence against the diff ❌ failed at 17744e9
PR Review rounds Production lines Sanity pass Skipped proofs
#370 2 rounds, 15 final reads 313 → 437 (×1.4); docs 5 → 5 not run cross-version: SendResult gains a Struct member, which changes its Marshal format both ways: a result one gem version marshaled will not load in the other. A cross-version run would only confirm that break. Michael accepted the gap on 2026-11-24; the changeset names the Marshal change. (👤 the user d-123a1b48); judge: The arbiter stopped the judge retries at a changeset-only head; lib/ is the same as at 2dfb241, whose judge gap d-3c300e12 was accepted. Proof and owed pass. The pattern-match and to_h change is now in the changeset, the risk callout and Known issues, with the accepted Marshal break (d-123a1b48). The one-minute cutoff after rounding fails closed: it raises schedule_not_confirmed with the message ID and the advice to read the email first, so nothing is sent twice; it is a Known issue with its line. The warning specs test a path that never reads the warning's code, so a Cloud code send with sandbox_sender would run the same lines. (🤖 agent d-9feb1483)

Not checked: none recorded
Full receipt: https://artifacts.posthog.com/a/hSRjKU9JQ5Sy9PB9BWihJV

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Silthus Silthus self-assigned this Nov 23, 2026
@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

posthog-ruby-sync Compliance Report

Date: 2026-11-25T04:01:34.195283+00:00
Duration: 94357ms

✅ All Tests Passed!

47/47 tests passed


Capture Tests

✅ 30/30 tests passed

View Details
Test Status Duration
Format Validation.Event Has Required Fields ✅ 9ms
Format Validation.Event Has Uuid ✅ 6ms
Format Validation.Event Has Lib Properties ✅ 5ms
Format Validation.Distinct Id Is String ✅ 9ms
Format Validation.Token Is Present ✅ 6ms
Format Validation.Custom Properties Preserved ✅ 7ms
Format Validation.Event Has Timestamp ✅ 7ms
Format Validation.Non Utc Event Timestamp Is Converted To Utc ✅ 6ms
Retry Behavior.Retries On 503 ✅ 5374ms
Retry Behavior.Does Not Retry On 400 ✅ 2009ms
Retry Behavior.Does Not Retry On 401 ✅ 2009ms
Retry Behavior.Respects Retry After Header ✅ 8016ms
Retry Behavior.Implements Backoff ✅ 15332ms
Retry Behavior.Retries On 500 ✅ 5159ms
Retry Behavior.Retries On 502 ✅ 5116ms
Retry Behavior.Retries On 504 ✅ 5115ms
Retry Behavior.Max Retries Respected ✅ 15476ms
Deduplication.Generates Unique Uuids ✅ 16ms
Deduplication.Preserves Uuid On Retry ✅ 5113ms
Deduplication.Preserves Uuid And Timestamp On Retry ✅ 10352ms
Deduplication.Preserves Uuid And Timestamp On Batch Retry ✅ 5150ms
Deduplication.No Duplicate Events In Batch ✅ 16ms
Deduplication.Different Events Have Different Uuids ✅ 8ms
Compression.Sends Gzip When Enabled ✅ 5ms
Batch Format.Uses Proper Batch Structure ✅ 5ms
Batch Format.Flush With No Events Sends Nothing ✅ 3ms
Batch Format.Synchronous Capture Delivers Each Event Immediately ✅ 14ms
Error Handling.Does Not Retry On 403 ✅ 2007ms
Error Handling.Does Not Retry On 413 ✅ 2009ms
Error Handling.Retries On 408 ✅ 5153ms

Feature_Flags Tests

✅ 17/17 tests passed

View Details
Test Status Duration
Request Payload.Request With Person Properties Device Id ✅ 8ms
Request Payload.Flags Request Uses V2 Query Param ✅ 8ms
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 ✅ 7ms
Request Payload.Groups Round Trip ✅ 5ms
Request Payload.Groups Default To Empty Object ✅ 5ms
Request Payload.Disable Geoip False Propagates As Geoip Disable False ✅ 5ms
Request Payload.Disable Geoip Omitted Defaults To False ✅ 5ms
Request Payload.Flag Keys To Evaluate Contains Only Requested Key ✅ 5ms
Request Lifecycle.No Flags Request On Init Alone ✅ 2ms
Request Lifecycle.No Flags Request On Normal Capture ✅ 5ms
Request Lifecycle.Two Flag Calls Produce Two Remote Requests ✅ 7ms
Request Lifecycle.Mock Response Value Is Returned To Caller ✅ 6ms
Retry Behavior.Retries Flags On 502 ✅ 108ms
Retry Behavior.Retries Flags On 504 ✅ 139ms
Side Effect Events.Get Feature Flag Captures Feature Flag Called Event ✅ 7ms

@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

posthog-ruby-async Compliance Report

Date: 2026-11-25T04:01:46.038226+00:00
Duration: 98875ms

✅ All Tests Passed!

47/47 tests passed


Capture Tests

✅ 30/30 tests passed

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

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 ✅ 108ms
Request Payload.Flags Request Hits Flags Path Not Decide ✅ 108ms
Request Payload.Flags Request Omits Authorization Header ✅ 108ms
Request Payload.Token In Flags Body Matches Init ✅ 107ms
Request Payload.Groups Round Trip ✅ 108ms
Request Payload.Groups Default To Empty Object ✅ 107ms
Request Payload.Disable Geoip False Propagates As Geoip Disable False ✅ 110ms
Request Payload.Disable Geoip Omitted Defaults To False ✅ 107ms
Request Payload.Flag Keys To Evaluate Contains Only Requested Key ✅ 108ms
Request Lifecycle.No Flags Request On Init Alone ✅ 4ms
Request Lifecycle.No Flags Request On Normal Capture ✅ 106ms
Request Lifecycle.Two Flag Calls Produce Two Remote Requests ✅ 112ms
Request Lifecycle.Mock Response Value Is Returned To Caller ✅ 107ms
Retry Behavior.Retries Flags On 502 ✅ 240ms
Retry Behavior.Retries Flags On 504 ✅ 254ms
Side Effect Events.Get Feature Flag Captures Feature Flag Called Event ✅ 111ms

@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

SDK performance: posthog-ruby

Benchmarks completed. No changes flagged for review.

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.

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.71 µs/op 108.73 µs/op <0.1% more time Not flagged
Capture and deliver events (32-byte payload, burst)
Shard: capture
Idle process memory (RSS) 28.35 MiB 28.44 MiB 0.3% more memory Not flagged
Capture and deliver events (32-byte payload, burst)
Shard: capture
Observed peak process memory (RSS) 31.13 MiB 31.46 MiB 1.1% more memory Not flagged
Capture and deliver events (32-byte payload, burst)
Shard: capture
Managed heap after settling 5.3 MiB 5.3 MiB 0.1% more memory Not flagged
Capture and deliver events (32-byte payload, burst)
Shard: capture
Process memory after settling (RSS) 31.13 MiB 30.69 MiB 1.4% less memory Not flagged
Capture and deliver events (32-byte payload, burst)
Shard: capture
Process CPU time per operation 19.4 µs/op 19.4 µs/op <0.1% less time Not flagged
Capture and deliver events (32-byte payload, burst)
Shard: capture
Lifetime peak process memory (RSS) 31.27 MiB 31.25 MiB <0.1% 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.74 µs/op 108.7 µs/op <0.1% less time Not flagged
Capture and deliver events (4,096-byte payload, burst)
Shard: capture
Idle process memory (RSS) 33.17 MiB 33.21 MiB 0.1% more memory Not flagged
Capture and deliver events (4,096-byte payload, burst)
Shard: capture
Observed peak process memory (RSS) 42.25 MiB 41.87 MiB 0.9% less memory Not flagged
Capture and deliver events (4,096-byte payload, burst)
Shard: capture
Managed heap after settling 9.17 MiB 9.17 MiB <0.1% more memory Not flagged
Capture and deliver events (4,096-byte payload, burst)
Shard: capture
Process memory after settling (RSS) 39.18 MiB 39.05 MiB 0.3% less memory Not flagged
Capture and deliver events (4,096-byte payload, burst)
Shard: capture
Process CPU time per operation 27.01 µs/op 27.1 µ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.06 MiB 41.71 MiB 0.8% 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.3% less time Not flagged
Capture and deliver events (32-byte payload, steady)
Shard: capture
Idle process memory (RSS) 28.3 MiB 28.5 MiB 0.7% more memory Not flagged
Capture and deliver events (32-byte payload, steady)
Shard: capture
Observed peak process memory (RSS) 30.42 MiB 30.43 MiB <0.1% more memory Not flagged
Capture and deliver events (32-byte payload, steady)
Shard: capture
Managed heap after settling 5.3 MiB 5.3 MiB 0.1% more memory Not flagged
Capture and deliver events (32-byte payload, steady)
Shard: capture
Process memory after settling (RSS) 30.42 MiB 30.43 MiB <0.1% more memory Not flagged
Capture and deliver events (32-byte payload, steady)
Shard: capture
Process CPU time per operation 31.45 µs/op 31.44 µs/op <0.1% less time Not flagged
Capture and deliver events (32-byte payload, steady)
Shard: capture
Lifetime peak process memory (RSS) 30.42 MiB 30.43 MiB <0.1% more memory Not flagged
Capture and deliver events (4,096-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 (4,096-byte payload, steady)
Shard: capture
Time per operation 1.01 ms/op 1.01 ms/op <0.1% less time Not flagged
Capture and deliver events (4,096-byte payload, steady)
Shard: capture
Idle process memory (RSS) 33.25 MiB 33.27 MiB <0.1% more memory Not flagged
Capture and deliver events (4,096-byte payload, steady)
Shard: capture
Observed peak process memory (RSS) 40.89 MiB 41.03 MiB 0.3% more memory Not flagged
Capture and deliver events (4,096-byte payload, steady)
Shard: capture
Managed heap after settling 9.17 MiB 9.17 MiB <0.1% more memory Not flagged
Capture and deliver events (4,096-byte payload, steady)
Shard: capture
Process memory after settling (RSS) 40.55 MiB 41.03 MiB 1.2% more memory Not flagged
Capture and deliver events (4,096-byte payload, steady)
Shard: capture
Process CPU time per operation 36.37 µs/op 36.63 µs/op 0.7% more time Not flagged
Capture and deliver events (4,096-byte payload, steady)
Shard: capture
Lifetime peak process memory (RSS) 40.94 MiB 41.06 MiB 0.3% more memory Not flagged
Queue an event (32-byte payload)
Shard: capture
Caller-thread CPU time per operation 8.57 µs/op 8.58 µs/op <0.1% more time Not flagged
Queue an event (32-byte payload)
Shard: capture
Time per operation 8.57 µs/op 8.57 µs/op <0.1% more time Not flagged
Queue an event (4,096-byte payload)
Shard: capture
Caller-thread CPU time per operation 8.52 µs/op 8.53 µs/op 0.1% more time Not flagged
Queue an event (4,096-byte payload)
Shard: capture
Time per operation 8.52 µs/op 8.53 µs/op 0.1% 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 127.53 µs/op 126.82 µs/op 0.6% less time Not flagged
Evaluate all 10 flags
Shard: flags-scaling
Process CPU time per operation 127.53 µs/op 126.83 µs/op 0.6% 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 1.21 ms/op 1.21 ms/op 0.5% less time Not flagged
Evaluate all 100 flags
Shard: flags-scaling
Process CPU time per operation 1.21 ms/op 1.21 ms/op 0.5% less time Not flagged
Evaluate all 1,000 flags
Shard: flags-scaling
Allocations per operation 33,113.62 count/op 33,113.53 count/op <0.1% fewer Not flagged
Evaluate all 1,000 flags
Shard: flags-scaling
Time per operation 12.79 ms/op 12.74 ms/op 0.4% less time Not flagged
Evaluate all 1,000 flags
Shard: flags-scaling
Process CPU time per operation 12.79 ms/op 12.74 ms/op 0.4% less time Not flagged
Evaluate 1,000 flags under concurrent load
Shard: flags-memory
Idle process memory (RSS) 39.09 MiB 39.1 MiB <0.1% more memory Not flagged
Evaluate 1,000 flags under concurrent load
Shard: flags-memory
Observed peak process memory (RSS) 40.34 MiB 40.49 MiB 0.4% more memory Not flagged
Evaluate 1,000 flags under concurrent load
Shard: flags-memory
Managed heap after settling 7.99 MiB 8 MiB <0.1% more memory Not flagged
Evaluate 1,000 flags under concurrent load
Shard: flags-memory
Process memory after settling (RSS) 39.44 MiB 39.59 MiB 0.4% more memory Not flagged
Evaluate 1,000 flags under concurrent load
Shard: flags-memory
Lifetime peak process memory (RSS) 40.06 MiB 40.13 MiB 0.2% more memory Not flagged
Refresh 1,000 flag definitions
Shard: flags-memory
Idle process memory (RSS) 37.3 MiB 38.02 MiB 1.9% more memory Not flagged
Refresh 1,000 flag definitions
Shard: flags-memory
Observed peak process memory (RSS) 42.14 MiB 41.55 MiB 1.4% less memory Not flagged
Refresh 1,000 flag definitions
Shard: flags-memory
Managed heap after settling 9.5 MiB 9.51 MiB <0.1% more memory Not flagged
Refresh 1,000 flag definitions
Shard: flags-memory
Process memory after settling (RSS) 41.26 MiB 41.1 MiB 0.4% less memory Not flagged
Refresh 1,000 flag definitions
Shard: flags-memory
Lifetime peak process memory (RSS) 41.94 MiB 41.44 MiB 1.2% 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 9.32 µs/op 9.39 µs/op 0.7% more time Not flagged
Evaluate one boolean flag
Shard: flags-single
Process CPU time per operation 9.32 µs/op 9.39 µs/op 0.7% 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 11.55 µs/op 11.49 µs/op 0.5% less time Not flagged
Evaluate a cohort-filtered flag
Shard: flags-single
Process CPU time per operation 11.55 µs/op 11.49 µs/op 0.5% less 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 16.21 µs/op 16.34 µs/op 0.8% more time Not flagged
Evaluate a flag (early match)
Shard: flags-single
Process CPU time per operation 16.21 µs/op 16.34 µs/op 0.8% 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 22.88 µs/op 23.04 µs/op 0.7% more time Not flagged
Evaluate a flag (late match)
Shard: flags-single
Process CPU time per operation 22.88 µs/op 23.04 µs/op 0.7% 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 20.79 µs/op 20.77 µs/op <0.1% less time Not flagged
Evaluate a flag (no match)
Shard: flags-single
Process CPU time per operation 20.79 µs/op 20.77 µs/op <0.1% 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 9.53 µs/op 9.53 µs/op <0.1% more time Not flagged
Evaluate a property-filtered flag
Shard: flags-single
Process CPU time per operation 9.53 µs/op 9.53 µs/op <0.1% more time Not flagged
Evaluate a regex-filtered flag
Shard: flags-single
Allocations per operation 99 count/op 99 count/op <0.1% more Not flagged
Evaluate a regex-filtered flag
Shard: flags-single
Time per operation 26.46 µs/op 26.19 µs/op 1% less time Not flagged
Evaluate a regex-filtered flag
Shard: flags-single
Process CPU time per operation 26.46 µs/op 26.19 µs/op 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 8.42 µs/op 8.45 µs/op 0.4% more time Not flagged
Evaluate a rollout flag
Shard: flags-single
Process CPU time per operation 8.42 µs/op 8.45 µs/op 0.4% more 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 10.45 µs/op 10.64 µs/op 1.8% more time Not flagged
Evaluate a multivariate flag
Shard: flags-single
Process CPU time per operation 10.45 µs/op 10.64 µs/op 1.8% 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 d6d1efcb30f9692fbd70ea667803fb0dd4c67024 → 17744e9755666ec0392b991af77d8d6ec6362b05.

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 8 commits November 23, 2026 07:33
…edentials out of errors

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

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

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

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

Timeout.timeout(seconds, Timeout::Error) raises that class inside the
block, so the rescue around warning logging caught it and raised
schedule_not_confirmed instead. A Timeout::Error now propagates, and the
deadline specs deliver it once the logger has been entered.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ace a logger error

The send-now cutoff read the clock when the reply arrived, so a slow
reply could accept a send-now answer for a time more than a minute
ahead. The client now reads the clock once before the first POST, as
the Node SDK does.

The client can't tell a failing logger from a caller's deadline of any
class, so it no longer replaces either: warnings are logged in an
ensure, and a logger's own error keeps schedule_not_confirmed as its
cause.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Silthus and others added 8 commits November 24, 2026 07:43
- a 503 that moves the clock 2 s, then queued with no time, still raises schedule_not_confirmed for a time 61 s ahead
- the deadline spec holds the logger on a queue instead of a sleep

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

This reverts commit 8a90d74. The review loop is at its ceiling, so the
spec waits for another round, and the PR lists the gap under Known issues.

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

- restore the spec for a retry that moves the clock, and the queue barrier in the deadline spec
- the warning spec asserts Client#shutdown's result, not the private Emails#close
- the scheduled_at docs name the one-minute send-now tolerance
- the changeset says SendResult's Marshal format changes

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Ruby keeps the first cause of an exception object raised again, so a logger
that reuses one error named an earlier email's ID. Drop the scheduled row of
the status pass-through spec, which guards nothing the archived row doesn't.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Setting the cause on the logger's own object rewrote the error an earlier
caller already held, and raised circular causes inside that caller's
rescue. Raise a copy that names this send instead.

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

A reused logger exception whose copy raised surfaced as that TypeError, with
an earlier email's ID in its cause chain. Raise this send's
schedule_not_confirmed with the logger's error as its cause instead.

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A logger's error propagates when it has no cause or this send's error is
among its causes. An exception object the logger raised before names an
earlier send, so this send's error propagates with it as its cause. No
code of the logger's exception runs, so nothing swallows a deadline.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Silthus added a commit that referenced this pull request Nov 24, 2026
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>
Silthus and others added 4 commits November 24, 2026 20:06
A send that raises schedule_not_confirmed no longer calls the logger.
EmailError#warnings holds the reply's warnings instead. A successful
send logs them as before, and a failing logger's error propagates as is.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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