Skip to content

feat(emails): send a message category with emails.send - #350

Draft
Silthus wants to merge 28 commits into
mainfrom
feat/emails-send-category
Draft

Silthus wants to merge 28 commits into
mainfrom
feat/emails-send-category

Conversation

@Silthus

@Silthus Silthus commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

💡 Motivation and Context

Developers who send email from Ruby with posthog.emails.send can only send transactional mail. When a team moves a workflow's marketing email to a code send, the email loses its message category, so recipients' opt-outs and unsubscribe links stop applying.

This PR adds an optional category keyword to code sends (the template_key form). It takes a String: the key of one of the project's message categories, such as newsletter.

posthog.emails.send(
  to: 'user@example.com',
  template_key: 'monthly-digest',
  subject: 'Your monthly digest',
  html: rendered_html, # can link to {{ unsubscribe_url }}
  category: 'newsletter'
)
  • A marketing category skips recipients who opted out of it or of all marketing email, fills {{ unsubscribe_url }} with the recipient's preferences link, and adds List-Unsubscribe headers.
  • A marketing email can't have cc or bcc: PostHog refuses it with marketing_copies_unsupported.
  • A key that names no category, or a deleted one, gets category_not_found. A marketing email from the PostHog test sender gets sandbox_fields_unsupported.
  • A template send (template_id) follows its template's own category, so it refuses category with an ArgumentError, the way it refuses subject.

Depends on PostHog/posthog#142574 and PostHog/posthog#142564, both merged behind the flag workflows-code-send-categories. Release once that flag is at 100%.

Warning

🟡 Merge risk: medium · two-way door at merge, one-way once the gem releases: the public category keyword

  • Ruby callers that pass category to a code send get it on the wire as a string, and the server's refusals as EmailError; no caller does yet.
  • Calls without category are unchanged: an unset or nil category is not sent.
  • Uncovered: a real send against a server with the flag on. A drift there fails the caller's send visibly.
  • Switch-off: the server flag workflows-code-send-categories; past that, fix forward.
  • Tier: critical (f: public SDK release)

Changes

  • #send takes category: (String). It is checked like html and from (a String, or ArgumentError) and sent only when set. PostHog owns the key format and the marketing rules.
  • YARD docs on Emails and #send describe the field and the codes above. The server's codes come through as EmailError, named validation_error (HTTP 400).
  • A changeset (posthog-ruby: minor) and the regenerated public API snapshot.
  • sdk-specs: the canonical emails spec does not define category yet. This PR follows the merged server.

💚 How did you test it?

  • Local checks at this head in ruby:3.4 (Bundler 4.0.13): bundle exec rake public_api:generate then public_api:check (clean), bundle exec rubocop (168 files, 0 offenses), bundle exec rspec (2,583 examples, 0 failures, 49 pending otel-bundle specs).
  • Specs in spec/posthog/emails_spec.rb, through client.emails.send with WebMock:
    • the body carries "category": "newsletter" when set and no category key when nil;
    • a non-String category and a category on a template send raise ArgumentError before any request;
    • category_not_found and marketing_copies_unsupported (HTTP 400) raise EmailError named validation_error.
  • Dropping category from the payload turns the body spec and the argument spec red.
  • Owed before this PR leaves draft: a real send against a PostHog server with the flag on.

📝 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)

  • Written by Claude Code (Claude Opus 5.5), as one of the SDK workers for code-send message categories.
  • The draft first carried a category object (MessageCategory with key, type, name, description) and a TRANSACTIONAL built-in, with create and restore on send. The merged server takes a plain key of an existing category instead, so this head drops the object, the constant, their validation and their specs, and sends the string.
  • The retry specs now prove retry and no-retry by outcome (the send succeeds, or raises with the code) rather than by request count. That change is kept from the earlier draft.
Question Answer Who Where
What category carries The key of an existing message category, as a String; no object, no built-in, no create on send 👤 Human PostHog/posthog#142574
Which send forms take category Code sends only; a template send follows its template's category 👤 Human PostHog/posthog#142574

🤖 Generated with Claude Code

`category` takes `PostHog::Emails::TRANSACTIONAL` or the key of one of the
project's marketing message categories. The client sends it only when the
caller sets it, so PostHog decides the default.

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

Silthus commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor Author

Note

Decisions recorded by Claude Code (Claude Opus 5.5) while building this PR. Updated for contract revision 2.

  • 👤 Which send forms take category Code sends only (template_key). A template send follows its template's category and refuses category, in all 8 SDKs (contract revision 2.1). Replaces: both forms.
  • 👍 How much the client validates Only what Ruby can't enforce: the value is TRANSACTIONAL or a MessageCategory, key and name are strings, type is marketing or transactional, description is a string when set. The server owns key format and lengths. Replaces: a nonempty string.
  • 🤖 How Ruby models the category PostHog::Emails::MessageCategory, a keyword Struct like SendResult and Status. A Hash is refused, so there is one way to pass a category.
  • 🤖 Name of the built-in value PostHog::Emails::TRANSACTIONAL, a public constant on the class that owns send.

@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

posthog-ruby-sync Compliance Report

Date: 2026-11-27T04:41:29.295824+00:00
Duration: 94241ms

✅ All Tests Passed!

47/47 tests passed


Capture Tests

✅ 30/30 tests passed

View Details
Test Status Duration
Format Validation.Event Has Required Fields ✅ 8ms
Format Validation.Event Has Uuid ✅ 5ms
Format Validation.Event Has Lib Properties ✅ 5ms
Format Validation.Distinct Id Is String ✅ 8ms
Format Validation.Token Is Present ✅ 6ms
Format Validation.Custom Properties Preserved ✅ 5ms
Format Validation.Event Has Timestamp ✅ 7ms
Format Validation.Non Utc Event Timestamp Is Converted To Utc ✅ 5ms
Retry Behavior.Retries On 503 ✅ 5260ms
Retry Behavior.Does Not Retry On 400 ✅ 2008ms
Retry Behavior.Does Not Retry On 401 ✅ 2010ms
Retry Behavior.Respects Retry After Header ✅ 8015ms
Retry Behavior.Implements Backoff ✅ 15267ms
Retry Behavior.Retries On 500 ✅ 5114ms
Retry Behavior.Retries On 502 ✅ 5150ms
Retry Behavior.Retries On 504 ✅ 5152ms
Retry Behavior.Max Retries Respected ✅ 15657ms
Deduplication.Generates Unique Uuids ✅ 15ms
Deduplication.Preserves Uuid On Retry ✅ 5112ms
Deduplication.Preserves Uuid And Timestamp On Retry ✅ 10251ms
Deduplication.Preserves Uuid And Timestamp On Batch Retry ✅ 5152ms
Deduplication.No Duplicate Events In Batch ✅ 15ms
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 ✅ 2ms
Batch Format.Synchronous Capture Delivers Each Event Immediately ✅ 14ms
Error Handling.Does Not Retry On 403 ✅ 2006ms
Error Handling.Does Not Retry On 413 ✅ 2009ms
Error Handling.Retries On 408 ✅ 5116ms

Feature_Flags Tests

✅ 17/17 tests passed

View Details
Test Status Duration
Request Payload.Request With Person Properties Device Id ✅ 9ms
Request Payload.Flags Request Uses V2 Query Param ✅ 8ms
Request Payload.Flags Request Hits Flags Path Not Decide ✅ 5ms
Request Payload.Flags Request Omits Authorization Header ✅ 6ms
Request Payload.Token In Flags Body Matches Init ✅ 5ms
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 ✅ 6ms
Request Lifecycle.No Flags Request On Init Alone ✅ 1ms
Request Lifecycle.No Flags Request On Normal Capture ✅ 5ms
Request Lifecycle.Two Flag Calls Produce Two Remote Requests ✅ 8ms
Request Lifecycle.Mock Response Value Is Returned To Caller ✅ 6ms
Retry Behavior.Retries Flags On 502 ✅ 107ms
Retry Behavior.Retries Flags On 504 ✅ 158ms
Side Effect Events.Get Feature Flag Captures Feature Flag Called Event ✅ 7ms

@posthog posthog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PostHog Review · Standard · reviewed 5401139: no findings.

@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

posthog-ruby-async Compliance Report

Date: 2026-11-27T04:41:36.075212+00:00
Duration: 98393ms

✅ All Tests Passed!

47/47 tests passed


Capture Tests

✅ 30/30 tests passed

View Details
Test Status Duration
Format Validation.Event Has Required Fields ✅ 107ms
Format Validation.Event Has Uuid ✅ 103ms
Format Validation.Event Has Lib Properties ✅ 106ms
Format Validation.Distinct Id Is String ✅ 103ms
Format Validation.Token Is Present ✅ 104ms
Format Validation.Custom Properties Preserved ✅ 106ms
Format Validation.Event Has Timestamp ✅ 103ms
Format Validation.Non Utc Event Timestamp Is Converted To Utc ✅ 5ms
Retry Behavior.Retries On 503 ✅ 5408ms
Retry Behavior.Does Not Retry On 400 ✅ 2107ms
Retry Behavior.Does Not Retry On 401 ✅ 2107ms
Retry Behavior.Respects Retry After Header ✅ 8113ms
Retry Behavior.Implements Backoff ✅ 15520ms
Retry Behavior.Retries On 500 ✅ 5213ms
Retry Behavior.Retries On 502 ✅ 5212ms
Retry Behavior.Retries On 504 ✅ 5210ms
Retry Behavior.Max Retries Respected ✅ 15520ms
Deduplication.Generates Unique Uuids ✅ 108ms
Deduplication.Preserves Uuid On Retry ✅ 5210ms
Deduplication.Preserves Uuid And Timestamp On Retry ✅ 10416ms
Deduplication.Preserves Uuid And Timestamp On Batch Retry ✅ 5212ms
Deduplication.No Duplicate Events In Batch ✅ 108ms
Deduplication.Different Events Have Different Uuids ✅ 105ms
Compression.Sends Gzip When Enabled ✅ 105ms
Batch Format.Uses Proper Batch Structure ✅ 105ms
Batch Format.Flush With No Events Sends Nothing ✅ 3ms
Batch Format.Multiple Events Batched Together ✅ 109ms
Error Handling.Does Not Retry On 403 ✅ 2107ms
Error Handling.Does Not Retry On 413 ✅ 2108ms
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 ✅ 106ms
Request Payload.Flags Request Uses V2 Query Param ✅ 103ms
Request Payload.Flags Request Hits Flags Path Not Decide ✅ 104ms
Request Payload.Flags Request Omits Authorization Header ✅ 105ms
Request Payload.Token In Flags Body Matches Init ✅ 103ms
Request Payload.Groups Round Trip ✅ 104ms
Request Payload.Groups Default To Empty Object ✅ 104ms
Request Payload.Disable Geoip False Propagates As Geoip Disable False ✅ 104ms
Request Payload.Disable Geoip Omitted Defaults To False ✅ 104ms
Request Payload.Flag Keys To Evaluate Contains Only Requested Key ✅ 104ms
Request Lifecycle.No Flags Request On Init Alone ✅ 1ms
Request Lifecycle.No Flags Request On Normal Capture ✅ 103ms
Request Lifecycle.Two Flag Calls Produce Two Remote Requests ✅ 106ms
Request Lifecycle.Mock Response Value Is Returned To Caller ✅ 104ms
Retry Behavior.Retries Flags On 502 ✅ 255ms
Retry Behavior.Retries Flags On 504 ✅ 255ms
Side Effect Events.Get Feature Flag Captures Feature Flag Called Event ✅ 108ms

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

@posthog posthog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PostHog Review · Standard · reviewed fad7d4f: no findings.

@github-actions

github-actions Bot commented Nov 9, 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 113.76 µs/op 113.67 µs/op <0.1% less time Not flagged
Capture and deliver events (32-byte payload, burst)
Shard: capture
Idle process memory (RSS) 28.4 MiB 28.41 MiB <0.1% more memory Not flagged
Capture and deliver events (32-byte payload, burst)
Shard: capture
Observed peak process memory (RSS) 31.42 MiB 31.43 MiB <0.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) 30.65 MiB 30.66 MiB <0.1% more memory Not flagged
Capture and deliver events (32-byte payload, burst)
Shard: capture
Process CPU time per operation 30.01 µs/op 29.84 µs/op 0.6% less time Not flagged
Capture and deliver events (32-byte payload, burst)
Shard: capture
Lifetime peak process memory (RSS) 31.14 MiB 31.16 MiB <0.1% more 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 113.53 µs/op 113.63 µs/op <0.1% more time Not flagged
Capture and deliver events (4,096-byte payload, burst)
Shard: capture
Idle process memory (RSS) 33.22 MiB 33.24 MiB <0.1% more memory Not flagged
Capture and deliver events (4,096-byte payload, burst)
Shard: capture
Observed peak process memory (RSS) 41.86 MiB 41.89 MiB <0.1% more 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) 40.03 MiB 40.02 MiB <0.1% less memory Not flagged
Capture and deliver events (4,096-byte payload, burst)
Shard: capture
Process CPU time per operation 41.45 µs/op 41.63 µs/op 0.4% more time Not flagged
Capture and deliver events (4,096-byte payload, burst)
Shard: capture
Lifetime peak process memory (RSS) 41.63 MiB 41.68 MiB <0.1% more 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.02 ms/op 1.02 ms/op <0.1% more time Not flagged
Capture and deliver events (32-byte payload, steady)
Shard: capture
Idle process memory (RSS) 28.31 MiB 28.33 MiB <0.1% more memory Not flagged
Capture and deliver events (32-byte payload, steady)
Shard: capture
Observed peak process memory (RSS) 30.5 MiB 30.52 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% less memory Not flagged
Capture and deliver events (32-byte payload, steady)
Shard: capture
Process memory after settling (RSS) 30.5 MiB 30.52 MiB <0.1% more memory Not flagged
Capture and deliver events (32-byte payload, steady)
Shard: capture
Process CPU time per operation 39.28 µs/op 41.2 µs/op 4.9% more time Not flagged
Capture and deliver events (32-byte payload, steady)
Shard: capture
Lifetime peak process memory (RSS) 30.5 MiB 30.52 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.02 ms/op 1.02 ms/op <0.1% less time Not flagged
Capture and deliver events (4,096-byte payload, steady)
Shard: capture
Idle process memory (RSS) 33.26 MiB 33.25 MiB <0.1% less memory Not flagged
Capture and deliver events (4,096-byte payload, steady)
Shard: capture
Observed peak process memory (RSS) 41.08 MiB 40.88 MiB 0.5% less 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% less memory Not flagged
Capture and deliver events (4,096-byte payload, steady)
Shard: capture
Process memory after settling (RSS) 40.78 MiB 40.23 MiB 1.4% less memory Not flagged
Capture and deliver events (4,096-byte payload, steady)
Shard: capture
Process CPU time per operation 47.52 µs/op 46.22 µs/op 2.7% less time Not flagged
Capture and deliver events (4,096-byte payload, steady)
Shard: capture
Lifetime peak process memory (RSS) 41.08 MiB 41.09 MiB <0.1% more memory Not flagged
Queue an event (32-byte payload)
Shard: capture
Caller-thread CPU time per operation 13.61 µs/op 13.54 µs/op 0.5% less time Not flagged
Queue an event (32-byte payload)
Shard: capture
Time per operation 13.6 µs/op 13.54 µs/op 0.5% less time Not flagged
Queue an event (4,096-byte payload)
Shard: capture
Caller-thread CPU time per operation 13.4 µs/op 13.31 µs/op 0.7% less time Not flagged
Queue an event (4,096-byte payload)
Shard: capture
Time per operation 13.4 µs/op 13.3 µs/op 0.7% less 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 155.03 µs/op 156.25 µs/op 0.8% more time Not flagged
Evaluate all 10 flags
Shard: flags-scaling
Process CPU time per operation 155.03 µs/op 156.23 µs/op 0.8% more 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.49 ms/op 1.47 ms/op 1% less time Not flagged
Evaluate all 100 flags
Shard: flags-scaling
Process CPU time per operation 1.49 ms/op 1.47 ms/op 1% less time Not flagged
Evaluate all 1,000 flags
Shard: flags-scaling
Allocations per operation 33,113.62 count/op 33,113.62 count/op No observed change Not flagged
Evaluate all 1,000 flags
Shard: flags-scaling
Time per operation 14.58 ms/op 14.49 ms/op 0.6% less time Not flagged
Evaluate all 1,000 flags
Shard: flags-scaling
Process CPU time per operation 14.58 ms/op 14.49 ms/op 0.6% less time Not flagged
Evaluate 1,000 flags under concurrent load
Shard: flags-memory
Idle process memory (RSS) 39.1 MiB 39.08 MiB <0.1% less memory Not flagged
Evaluate 1,000 flags under concurrent load
Shard: flags-memory
Observed peak process memory (RSS) 40.49 MiB 40.37 MiB 0.3% less memory Not flagged
Evaluate 1,000 flags under concurrent load
Shard: flags-memory
Managed heap after settling 7.99 MiB 7.99 MiB <0.1% more memory Not flagged
Evaluate 1,000 flags under concurrent load
Shard: flags-memory
Process memory after settling (RSS) 39.56 MiB 39.47 MiB 0.2% less memory Not flagged
Evaluate 1,000 flags under concurrent load
Shard: flags-memory
Lifetime peak process memory (RSS) 40.15 MiB 40.01 MiB 0.4% less memory Not flagged
Refresh 1,000 flag definitions
Shard: flags-memory
Idle process memory (RSS) 38.01 MiB 37.65 MiB 1% less memory Not flagged
Refresh 1,000 flag definitions
Shard: flags-memory
Observed peak process memory (RSS) 42.17 MiB 42.2 MiB <0.1% more memory Not flagged
Refresh 1,000 flag definitions
Shard: flags-memory
Managed heap after settling 9.5 MiB 9.5 MiB <0.1% less memory Not flagged
Refresh 1,000 flag definitions
Shard: flags-memory
Process memory after settling (RSS) 41.24 MiB 41.31 MiB 0.2% more memory Not flagged
Refresh 1,000 flag definitions
Shard: flags-memory
Lifetime peak process memory (RSS) 42.08 MiB 42.01 MiB 0.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 6.75 µs/op 6.83 µs/op 1.1% more time Not flagged
Evaluate one boolean flag
Shard: flags-single
Process CPU time per operation 6.75 µs/op 6.82 µs/op 1.1% 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 8.34 µs/op 8.36 µs/op 0.2% more time Not flagged
Evaluate a cohort-filtered flag
Shard: flags-single
Process CPU time per operation 8.34 µs/op 8.36 µ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 11.58 µs/op 11.57 µs/op <0.1% less time Not flagged
Evaluate a flag (early match)
Shard: flags-single
Process CPU time per operation 11.58 µs/op 11.57 µs/op <0.1% less 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 16.26 µs/op 16.02 µs/op 1.5% less time Not flagged
Evaluate a flag (late match)
Shard: flags-single
Process CPU time per operation 16.26 µs/op 16.02 µs/op 1.5% less 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 14.7 µs/op 14.61 µs/op 0.6% less time Not flagged
Evaluate a flag (no match)
Shard: flags-single
Process CPU time per operation 14.7 µs/op 14.61 µs/op 0.6% 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 6.82 µs/op 6.73 µs/op 1.3% less time Not flagged
Evaluate a property-filtered flag
Shard: flags-single
Process CPU time per operation 6.82 µs/op 6.73 µs/op 1.3% 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 18.23 µs/op 18.17 µs/op 0.3% less time Not flagged
Evaluate a regex-filtered flag
Shard: flags-single
Process CPU time per operation 18.23 µs/op 18.17 µs/op 0.3% 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 5.89 µs/op 6.05 µs/op 2.8% more time Not flagged
Evaluate a rollout flag
Shard: flags-single
Process CPU time per operation 5.89 µs/op 6.05 µs/op 2.8% 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 7.31 µs/op 7.34 µs/op 0.3% more time Not flagged
Evaluate a multivariate flag
Shard: flags-single
Process CPU time per operation 7.31 µs/op 7.34 µs/op 0.3% 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 → 6f564ef1c1500b596200c51019589217f966f7f5.

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.

`category` is now `PostHog::Emails::TRANSACTIONAL` or a
`PostHog::Emails::MessageCategory` with a key, type, name and optional
description, which PostHog creates or updates by key. A template send
follows its template's category, so it no longer takes one.

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

@posthog posthog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PostHog Review · Standard · reviewed 65a1bec: 1 Must fix, 1 Should fix.

See this review and its findings in PostHog Review. Comment @posthog review --deep for a Deep review. A Deep review takes longer and looks deeper than a Standard review.

Comment thread lib/posthog/emails.rb Resolved
Comment thread lib/posthog/emails.rb Resolved
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@posthog posthog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PostHog Review · Standard · reviewed 6bdd5bd: no findings.

The category spec now sends through a fake that holds categories by key,
keeps a stored description when the field is missing, clears it on "",
and refuses a marketing send without an unsubscribe link. It asserts the
categories PostHog ends up holding, and pins that "" goes out as "" while
an unset description is left out (contract rev 2.2).

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

@posthog posthog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PostHog Review · Standard · reviewed b262082: no findings.

The fake of the send endpoint now accepts only a missing category,
"transactional" or a category object, and the spec asserts the
TRANSACTIONAL send is accepted, so a wrong built-in value fails it.

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

@posthog posthog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PostHog Review · Standard · reviewed 66d0a74: no findings.

The retry table now asserts the result: an EmailError with the refused
code when the SDK makes one attempt, and the queued email when it retries.
The send fake looks for the unsubscribe link the way PostHog does: in the
html when it has one, otherwise in the text.

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

@posthog posthog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PostHog Review · Standard · reviewed 8d0930b: no findings.

A code send whose template_key names a template follows that template's
category when category is left out, and PostHog refuses an explicit
TRANSACTIONAL on a template in a category. The fake send endpoint now
models template-bound keys, and the docs no longer call the two the same.

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

@posthog posthog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PostHog Review · Standard · reviewed 0434df8: no findings.

Each row's second response is a success, so a refusal the client wrongly
retries comes back as a sent email, and a retryable refusal it gives up
on comes back as an error. Counting WebMock requests added nothing.

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

@posthog posthog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PostHog Review · Standard · reviewed 8c3d803: no findings.

Silthus and others added 2 commits November 12, 2026 05:22
PostHog now creates a category the first time a send names its key, or
restores a deleted one, and otherwise leaves it unchanged. The category's
name and description apply only at creation; renames happen in PostHog.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PostHog refuses a send whose template_key names a template in a marketing
category with marketing_template. The send fake now does the same, and the
follow-the-template tests seed a transactional category.

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

Copy link
Copy Markdown

This PR hasn't seen activity in a week! Should it be merged, closed, or further worked on? If you want to keep it open, post a comment or remove the stale label – otherwise this will be closed in another week.

@github-actions github-actions Bot added the stale label Nov 20, 2026
@Silthus Silthus removed the stale label Nov 23, 2026

@posthog posthog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PostHog Review · Standard · reviewed 6ec4fa1: no findings.

@posthog posthog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PostHog Review · Standard · reviewed ad30684: no findings.

@posthog posthog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PostHog Review · Standard · reviewed fa72368: no findings.

@posthog posthog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PostHog Review · Standard · reviewed 6b0276d: no findings.

@posthog posthog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PostHog Review · Standard · reviewed b241c64: no findings.

@posthog posthog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PostHog Review · Standard · reviewed 6ecee65: no findings.

@posthog posthog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PostHog Review · Standard · reviewed 4c90bdf: no findings.

@posthog posthog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PostHog Review · Standard · reviewed 76dab45: no findings.

@posthog posthog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PostHog Review · Standard · reviewed a4e9b9c: no findings.

@posthog posthog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PostHog Review · Standard · reviewed 67b79c6: no findings.

@posthog posthog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PostHog Review · Standard · reviewed 987096a: no findings.

@posthog posthog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PostHog Review · Standard · reviewed d48e284: no findings.

@posthog posthog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PostHog Review · Standard · reviewed 66cd22d: no findings.

@posthog posthog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PostHog Review · Standard · reviewed cf3fc41: no findings.

@posthog posthog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PostHog Review · Standard · reviewed 4e2a00d: no findings.

The server takes `category` on a `template_key` send as a plain string, the
key of one of the project's message categories. Drop `MessageCategory`,
`TRANSACTIONAL` and their validation, send the string only when the caller
sets it, and document `category_not_found` and
`marketing_copies_unsupported`.

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.

2 participants