Skip to content

feat(emails): send a message category from code - #1218

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

Silthus wants to merge 9 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 code with emails.send can only send transactional email. A team that moves a marketing email from a workflow to a code send loses its message category, so recipients' opt-outs and unsubscribe links stop applying.

emails.send now takes an optional category on the code form (the one with template_key). It is TRANSACTIONAL_CATEGORY or a MessageCategory that defines the category in code. A send creates the category when the project has none with its key, or restores a deleted one, and otherwise leaves it as it is. Its name and description apply only at creation; change them later in PostHog.

Depends on PostHog/posthog#132118, which pins the API contract (revision 2) and adds the server side. Release once customers can use it.

Caution

🔴 Merge risk: high · two-way door at merge, one-way at release: once posthog and posthoganalytics ship, category, MessageCategory and TRANSACTIONAL_CATEGORY are public API.

  • Worst incident: silent harm. If the SDK dropped or reshaped a marketing category, the email would go out as transactional and skip the recipient's opt-outs. This applies to every Python SDK caller that sets category, in both regions. A send without category keeps today's body byte for byte.
  • A send that names an existing category must leave it unchanged. feat(messaging): send code emails in a marketing message category posthog#132118 at ac055ee is create-only, so it does. This PR still releases only after the backend is live and a real send passes.
  • A template made in PostHog is transactional only. A template_key that names a template in a marketing category gets marketing_template (400), so no template send can skip opt-outs. Template categories are parked.
  • Switch-off: none in the SDK. With the server's workflows-code-send-categories flag off, the server refuses every category object.

Rollout

  • Stages: merge only after the server PR is live in both regions, with create-only categories, and customers can send with a category. The release after the merge ships the SDK.
  • Watch: send errors with category_mismatch, too_many_categories, unsubscribe_link_required, copies_not_allowed, recipient_opted_out and marketing_template on the server's send route.
from posthog.emails import MessageCategory, TRANSACTIONAL_CATEGORY

posthog.emails.send(
    to="user@example.com",
    template_key="november-digest",
    subject="What's new in November",
    html=digest_html,  # links {{ unsubscribe_url }}
    category=MessageCategory(key="newsletter", type="marketing", name="Newsletter"),
)
  • MessageCategory is a frozen dataclass: key, type: Literal["marketing", "transactional"], name and an optional description. TRANSACTIONAL_CATEGORY: Final = "transactional" is the built-in value. Both are exported from posthog.emails.
  • category: NotRequired[Optional[Union[Literal["transactional"], MessageCategory]]] on CodeEmailArgs. A type checker refuses a bare key string such as "newsletter", the shape from the first revision, and an unknown type.
  • On the wire: the string "transactional", or {"key", "type", "name"} plus description unless it is None. An empty description goes out as ""; None leaves the field out. Either only matters when the send creates the category. category=None counts as left out, like the other optional code-send fields.
  • At runtime the SDK checks only what Python's types can't enforce: category is the constant or a MessageCategory, type is one of the two values, and the fields are strings. It raises TypeError or ValueError before any request. The server owns key format and lengths.
  • The template form (template_id) doesn't take category, the same as in the other SDKs. A template send follows its template's category. So does a code send whose template_key names a template, when it leaves category out; PostHog refuses TRANSACTIONAL_CATEGORY there if the template is in a category.
  • A template made in PostHog is transactional only. A template_key that names a template in a marketing category is refused with marketing_template (400), whatever category says. The module docstring, the category docstring and the changeset say so.
  • PostHog's refusals arrive on EmailError.code with name == "validation_error", like recipient_suppressed: category_mismatch, too_many_categories, unsubscribe_link_required, copies_not_allowed, marketing_template (400) and recipient_opted_out (422). The SDK keeps no list of codes, so the docstrings name them.
  • Docs: the module docstring, the MessageCategory docstring and the CodeEmailArgs docstring. The minor changeset is updated.

💚 How did you test it?

Lane gate on 8590215, all green: ruff format --check ., ruff check ., mypy against the baseline, the full pytest suite (6258 passed), python -W error -c "import posthog" and make public_api_check. CI on 8590215: 49 checks pass, among them .github/scripts/check_strict_types.sh (pyright strict).

  • Test seams: Emails.send against FakeSendApi, an in-memory fake of PostHog's code send. It refuses fields outside the contract, creates a category by key and never changes one that exists, refuses a changed type with category_mismatch, refuses a marketing body without {{ unsubscribe_url }}, and refuses a template_key that names a template in a marketing category with marketing_template. The tests assert on what the fake stored and sent:
    • a marketing send and a transactional send each create their category
    • a second send with the same key but another name and description succeeds and leaves the stored category as the first send created it
    • a send with no category, None or TRANSACTIONAL_CATEGORY is transactional and creates no category
    • a category of another type is refused with category_mismatch and nothing is sent
    • with a template_key that names a template in a transactional category, a left-out or None category follows the template's category, and TRANSACTIONAL_CATEGORY is refused with category_mismatch
    • a template_key that names a template in a marketing category is refused with marketing_template and nothing is sent. Red first: this test failed against the fake before it refused marketing templates
    • a bare key string, an unknown type, a non-string field, or category on the template form fails before a request
    • Mutation-checked: dropping an empty description, sending null for an unset one, leaving out type, never sending the category, rejecting a transactional category, dropping an explicit TRANSACTIONAL_CATEGORY, and sending "transactional" for a left-out category each fail a test. Putting the old rename back in the fake fails the create-only test.
  • Typing: the strict pyright check passes a marketing MessageCategory and TRANSACTIONAL_CATEGORY. It rejects category="newsletter", type="promo", and category on the template form.
  • Live run (stub server): the real sync client, AsyncEmails and a standalone Emails, sending over HTTP to a local stub server that answers in the contract's format. The raw request bodies:
    • no category, or None: no category key
    • TRANSACTIONAL_CATEGORY: "category":"transactional"
    • a marketing category: "category":{"key":"newsletter","type":"marketing","name":"Newsletter","description":"Monthly product news"}
    • a transactional category without a description: "category":{"key":"receipts","type":"transactional","name":"Receipts"}
    • an empty description: "category":{"key":"newsletter","type":"marketing","name":"Newsletter","description":""}
    • four refusals: EmailError with codes category_mismatch, too_many_categories, unsubscribe_link_required and recipient_opted_out, and name="validation_error"
  • Review: round 4, a GPT-6.1 Sol fixes round on d8667f6 (create-only categories), said the backend at 22a68ff still updates a category's name and description on a send. Rejected for this PR: that is the backend half of the same decision, and it lands in feat(messaging): send code emails in a marketing message category posthog#132118 before this PR can release. The SDK's wire is unchanged. The backend is now create-only at ac055ee, which settles it.
    • Round 5, a fixes round on 8590215 (templates are transactional only): no findings.
  • Gap, owed before this PR leaves draft: a send against a real PostHog server, and the cross-version check. The server side in #132118 is still a draft and isn't deployed. Michael accepted both gaps until the backend is live; they were recorded on d8667f6; re-recording them on 8590215 waits on Michael.
Live run output (stub server)
=== client.emails.send: marketing MessageCategory with description
SERVER <- body: {"to":"user@example.com","template_key":"digest","subject":"What's new","html":"...","distinct_id":"user_123","capture_engagement":true,"category":{"key":"newsletter","type":"marketing","name":"Newsletter","description":"Monthly product news"}}
SERVER -> 202 {"message_id": "01a18356-c56c-0001-e494-7666bc915188"}

=== client.emails.send: transactional MessageCategory without description
SERVER <- body: {...,"category":{"key":"receipts","type":"transactional","name":"Receipts"}}

=== client.emails.send: category=TRANSACTIONAL_CATEGORY
SERVER <- body: {...,"category":"transactional"}

=== client.emails.send: type differs from the existing category
SERVER -> 400 {"type": "validation_error", "code": "category_mismatch", ...}
CALLER <- EmailError(name='validation_error', code='category_mismatch', status_code=400, field='category', ...)

=== client.emails.send: recipient opted out
SERVER -> 422 {"type": "validation_error", "code": "recipient_opted_out", ...}
CALLER <- EmailError(name='validation_error', code='recipient_opted_out', status_code=422, ...)

=== client.emails.send: category='newsletter' (a bare key)
CALLER <- TypeError: category must be TRANSACTIONAL_CATEGORY or a MessageCategory. (no request sent)

=== client.emails.send: category on template_id form
CALLER <- TypeError: send() got arguments that the template form doesn't take: category. (no request sent)

📝 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 sampo add to generate a changeset file

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

Claude Code, Claude Opus 5.5 (claude-opus-5-5), built test-first. This PR is one of 8 SDK PRs that build to the contract pinned in PostHog/posthog#132118. Revision 2 of that contract changed category from a key string to a category object that the send defines in code.

Question Answer Who Where
What does category carry? "transactional" or a category object that the send upserts by key, which replaces the bare key string 👤 Human comment
Which emails.send form takes category? The code form only, in all 8 SDKs 👤 Human comment
Can a template made in PostHog be marketing? No: "Ship code sends, park templates (Recommended)", 2026-11-12. Templates are transactional only; a marketing one is refused with marketing_template. Template categories are parked 👍 Accepted default comment
Does a send change a category that exists? No: "Create-only, no renames (Recommended)", 2026-11-12. name and description apply only when the send creates the category. Replaces "creates or updates" 👍 Accepted default comment
How is the category modelled in Python? A frozen dataclass MessageCategory with Literal for type, plus a Final constant TRANSACTIONAL_CATEGORY, instead of a TypedDict 🤖 Agent comment
Are copies_not_allowed docs needed? Yes, beside the other 400 refusals, the same list as the other SDKs. Replaces "No, this SDK has no cc or bcc" 🤖 Agent comment

Involvement: no grilling rounds, no prototypes; five GPT-6.1 Sol review rounds and three final reads, and PostHog Review on each head through 8919451; live-run proof against a stub server captured.

🤖 Generated with Claude Code

emails.send takes an optional category on the template_key form. Left
out or TRANSACTIONAL_CATEGORY sends transactional email; any other value
is the key of a marketing message category in the project. The SDK sends
the field only when the caller sets it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Silthus Silthus self-assigned this Nov 9, 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 60d6d30: no findings.

@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

posthog-python Compliance Report

Date: 2026-11-12T14:48:36.161893+00:00
Duration: 253584ms

✅ All Tests Passed!

270/270 tests passed


Capture_V1 Tests

✅ 95/95 tests passed

View Details
Test Status Duration
Endpoint And Method.Targets V1 Endpoint ✅ 515ms
Endpoint And Method.Does Not Use Legacy Endpoints ✅ 509ms
Required Headers.Has Authorization Bearer Header ✅ 509ms
Required Headers.Has Content Type Json ✅ 508ms
Required Headers.Has Posthog Sdk Info Format ✅ 509ms
Required Headers.Has Posthog Attempt Header ✅ 508ms
Required Headers.Has Posthog Request Id ✅ 509ms
Required Headers.Has Posthog Request Timestamp ✅ 508ms
Required Headers.Has User Agent ✅ 509ms
Body Format.Body Has Created At And Batch ✅ 508ms
Body Format.No Api Key In Body ✅ 508ms
Body Format.No Sent At In Body ✅ 508ms
Event Format.Event Has Required Root Fields ✅ 509ms
Event Format.Event Uuid Is Valid ✅ 508ms
Event Format.Event Timestamp Is Rfc3339 ✅ 508ms
Event Format.Non Utc Event Timestamp Is Converted To Utc ✅ 523ms
Event Format.Distinct Id Is String ✅ 508ms
Event Format.Distinct Id At Root Not Properties ✅ 508ms
Event Format.Custom Properties Preserved ✅ 509ms
Event Format.Set Properties Preserved ✅ 508ms
Event Format.Set Once Properties Preserved ✅ 508ms
Event Format.Groups Properties Preserved ✅ 508ms
Event Format.Sdk Generates Uuid If Not Provided ✅ 509ms
Event Format.Event Has Required Root Fields Batch ✅ 511ms
Event Format.Event Uuid Is Valid Batch ✅ 510ms
Event Format.Event Timestamp Is Rfc3339 Batch ✅ 510ms
Event Format.Distinct Id Is String Batch ✅ 512ms
Event Format.Distinct Id At Root Not Properties Batch ✅ 511ms
Event Format.Custom Properties Preserved Batch ✅ 511ms
Event Format.Set Properties Preserved Batch ✅ 511ms
Event Format.Set Once Properties Preserved Batch ✅ 511ms
Event Format.Groups Properties Preserved Batch ✅ 511ms
Event Format.Sdk Generates Uuid If Not Provided Batch ✅ 511ms
Batch Behavior.Multiple Events In Single Batch ✅ 514ms
Batch Behavior.Batch Envelope Smoke ✅ 512ms
Batch Behavior.Flush With No Events Sends Nothing ✅ 507ms
Batch Behavior.Flush At Triggers Batch ✅ 1008ms
Batch Behavior.Created At Reflects Batch Creation Time ✅ 509ms
Deduplication.Generates Unique Uuids ✅ 514ms
Deduplication.Different Events Same Content Different Uuids ✅ 510ms
Deduplication.Preserves Uuid On Retry ✅ 6515ms
Deduplication.Preserves Timestamp On Retry ✅ 6517ms
Deduplication.Preserves Uuid And Timestamp On Batch Retry ✅ 6517ms
Deduplication.No Duplicate Events In Batch ✅ 514ms
Header Behavior On Retry.Attempt Header Starts At One ✅ 509ms
Header Behavior On Retry.Attempt Header Increments On Retry ✅ 13516ms
Header Behavior On Retry.Request Id Preserved On Retry ✅ 6513ms
Header Behavior On Retry.Different Requests Have Different Request Ids ✅ 3017ms
Header Behavior On Retry.Request Timestamp Changes On Retry ✅ 6518ms
Response Format Validation.Success Response Has Uuid Keyed Results ✅ 510ms
Response Format Validation.Success Response Has Ok For Each Event ✅ 512ms
Response Format Validation.Success No Retry After When All Ok ✅ 510ms
Response Format Validation.Success Retry After Present When Retry Events ✅ 1513ms
Response Format Validation.Success No Retry After When Drop Only ✅ 511ms
Response Format Validation.Response Echoes Request Id ✅ 508ms
Retry Behavior.Retries On 408 ✅ 6517ms
Retry Behavior.Retries On 500 ✅ 6518ms
Retry Behavior.Retries On 503 ✅ 8520ms
Retry Behavior.Retries On 504 ✅ 6518ms
Retry Behavior.Retries On 404 ✅ 6517ms
Retry Behavior.Retries On 429 ✅ 6513ms
Retry Behavior.Retries On 502 ✅ 6514ms
Retry Behavior.Retryable Errors Have Retry After ✅ 3515ms
Retry Behavior.Respects Retry After On Retryable Error ✅ 11521ms
Retry Behavior.Does Not Retry On 400 ✅ 2511ms
Retry Behavior.Does Not Retry On 401 ✅ 2513ms
Retry Behavior.Does Not Retry On 402 ✅ 2512ms
Retry Behavior.Does Not Retry On 413 ✅ 2511ms
Retry Behavior.Does Not Retry On 415 ✅ 2510ms
Retry Behavior.Non Retryable Errors Have No Retry After ✅ 2512ms
Retry Behavior.Implements Backoff ✅ 19530ms
Partial Batch Handling.Handles 200 Full Success ✅ 2510ms
Partial Batch Handling.Handles 200 With All Ok ✅ 3512ms
Partial Batch Handling.Does Not Retry Dropped Events ✅ 3511ms
Partial Batch Handling.Does Not Retry Warning Events ✅ 3514ms
Partial Batch Handling.Prunes Ok Events On Partial Retry ✅ 6515ms
Partial Batch Handling.Prunes Dropped Events On Partial Retry ✅ 6518ms
Partial Batch Handling.Retries Only Retry Events From Partial ✅ 6520ms
Partial Batch Handling.Partial Retry Preserves Uuids ✅ 6519ms
Partial Batch Handling.Partial Retry Attempt Header Increments ✅ 6518ms
Partial Batch Handling.Partial Retry Request Id Preserved ✅ 6515ms
Partial Batch Handling.Respects Retry After On Partial ✅ 8518ms
Partial Batch Handling.Unknown Result Treated As Terminal ✅ 3513ms
Partial Batch Handling.Mixed Ok Drop Warning No Retry ✅ 3514ms
Compression.Sends Gzip Content Encoding ✅ 509ms
Compression.No Content Encoding When Disabled ✅ 509ms
Compression.Compressed Body Is Decompressible ✅ 508ms
Error Handling.Does Not Retry On Unknown 4Xx ✅ 2511ms
Event Options.Cookieless Mode Override ✅ 509ms
Event Options.Disable Skew Correction Override ✅ 509ms
Event Options.Process Person Profile Override ✅ 508ms
Event Options.Product Tour Id Override ✅ 508ms
Event Options.Unset Options Omitted ✅ 509ms
Event Options.Options Override In Batch ✅ 511ms
Geoip And Historical Migration.Historical Migration Absent By Default ✅ 509ms

Capture_Ai Tests

✅ 5/5 tests passed

View Details
Test Status Duration
Routing.Capture Ai Posts To Ai Endpoint ✅ 509ms
Routing.Capture Does Not Reroute Ai Named Events ✅ 508ms
Identity.Capture Ai Event Has Uuid ✅ 509ms
Identity.Capture Ai Keeps Supplied Uuid ✅ 508ms
Timestamp Format.Non Utc Event Timestamp Is Converted To Utc ✅ 509ms

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 V4 Query Param ✅ 7ms
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 ✅ 8ms
Request Payload.Groups Default To Empty Object ✅ 7ms
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 ✅ 7ms
Request Lifecycle.No Flags Request On Init Alone ✅ 3ms
Request Lifecycle.No Flags Request On Normal Capture ✅ 508ms
Request Lifecycle.Two Flag Calls Produce Two Remote Requests ✅ 11ms
Request Lifecycle.Mock Response Value Is Returned To Caller ✅ 7ms
Retry Behavior.Retries Flags On 502 ✅ 311ms
Retry Behavior.Retries Flags On 504 ✅ 311ms
Side Effect Events.Get Feature Flag Captures Feature Flag Called Event ✅ 509ms

Feature_Flags_V4 Tests

✅ 149/149 tests passed

View Details
Test Status Duration
Legacy Getters.Legacy Getter Reads Reader Fixture[Readers.Complete Split] ✅ 8ms
Legacy Getters.Legacy Getter Reads Reader Fixture[Readers.Partial Split Missing Config Version] ✅ 8ms
Legacy Getters.Legacy Getter Reads Reader Fixture[Readers.Partial Split Missing Rule Type] ✅ 7ms
Legacy Getters.Legacy Getter Reads Reader Fixture[Readers.Partial Split Missing Rule Id] ✅ 8ms
Legacy Getters.Legacy Getter Reads Reader Fixture[Readers.Partial Split Missing Variant Key] ✅ 7ms
Legacy Getters.Legacy Getter Reads Reader Fixture[Readers.Split Wrong Type Config Version] ✅ 7ms
Legacy Getters.Legacy Getter Reads Reader Fixture[Readers.Split Wrong Type Rule Type] ✅ 8ms
Legacy Getters.Legacy Getter Reads Reader Fixture[Readers.Split Wrong Type Rule Id] ✅ 7ms
Legacy Getters.Legacy Getter Reads Reader Fixture[Readers.Split Wrong Type Experiment Id] ✅ 7ms
Legacy Getters.Legacy Getter Reads Reader Fixture[Readers.Split Extra Experiment Id] ✅ 8ms
Legacy Getters.Legacy Getter Reads Reader Fixture[Readers.Split Wrong Type Variant Key] ✅ 7ms
Legacy Getters.Legacy Getter Reads Reader Fixture[Readers.Wrong Rule Type Literal] ✅ 8ms
Legacy Getters.Legacy Getter Reads Reader Fixture[Readers.Unknown Fields] ✅ 7ms
Legacy Getters.Legacy Getter Reads Reader Fixture[Readers.Old Server Variant] ✅ 7ms
Legacy Getters.Legacy Getter Reads Reader Fixture[Readers.Old Server Boolean] ✅ 8ms
Legacy Getters.Legacy Getter Reads Reader Fixture[Readers.Old Server Null Variant] ✅ 7ms
Legacy Getters.Legacy Getter Reads Reader Fixture[Readers.Old Server False] ✅ 7ms
Legacy Getters.Legacy Getter Reads Reader Fixture[Readers.V4 Value Takes Precedence] ✅ 8ms
Legacy Getters.Legacy Getter Reads Reader Fixture[Readers.Missing Flag] ✅ 7ms
Legacy Getters.Legacy Getter Reads Reader Fixture[Readers.Targeting Match Targeted Release] ✅ 7ms
Legacy Getters.Legacy Getter Reads Reader Fixture[Readers.Targeting Match Percentage Rollout] ✅ 8ms
Legacy Getters.Legacy Getter Reads Reader Fixture[Readers.Rollout Miss Percentage Rollout] ✅ 7ms
Legacy Getters.Legacy Getter Reads Reader Fixture[Readers.Rollout Miss Experiment] ✅ 7ms
Legacy Getters.Legacy Getter Reads Reader Fixture[Readers.Experiment Paused] ✅ 8ms
Legacy Getters.Legacy Getter Reads Reader Fixture[Readers.Holdout] ✅ 7ms
Legacy Getters.Legacy Getter Reads Reader Fixture[Readers.Holdout Variant Key] ✅ 8ms
Legacy Getters.Legacy Getter Reads Reader Fixture[Readers.No Rule Match] ✅ 7ms
Legacy Getters.Legacy Getter Reads Reader Fixture[Readers.Missing Group Key] ✅ 7ms
Legacy Getters.Legacy Getter Reads Reader Fixture[Readers.Dependency Error] ✅ 7ms
Legacy Getters.Legacy Getter Reads Reader Fixture[Readers.Error] ✅ 7ms
Legacy Getters.Legacy Getter Reads Reader Fixture[Readers.Error With Value] ✅ 7ms
Legacy Getters.Legacy Getter Reads Reader Fixture[Readers.Malformed Sibling Isolation] ✅ 7ms
Legacy Getters.Legacy Getter Reads Reader Fixture[Readers.Partial Split String Value] ✅ 7ms
Legacy Getters.Legacy Getter Reads Reader Fixture[Readers.V1 At V4] ✅ 8ms
Legacy Getters.Legacy Getter Reads Reader Fixture[Readers.V1 Failed] ✅ 7ms
Legacy Getters.Legacy Getter Reads Reader Fixture[Readers.Integral Json Number Context] ✅ 8ms
Legacy Getters.Legacy Getter Reads Reader Fixture[Readers.Flag Key Seed] ✅ 7ms
Legacy Getters.Legacy Getter Reads Typed Value[V2 Value.String.Target] ✅ 8ms
Legacy Getters.Legacy Getter Reads Typed Value[V2 Value.String.Rollout Hit] ✅ 7ms
Legacy Getters.Legacy Getter Reads Typed Value[V2 Value.String.Miss Return Default] ✅ 7ms
Legacy Getters.Legacy Getter Reads Typed Value[V2 Value.String.Miss Return Default Null] ✅ 7ms
Legacy Getters.Legacy Getter Reads Typed Value[V2 Value.String.Miss Continue] ✅ 8ms
Legacy Getters.Legacy Getter Reads Typed Value[V2 Value.String.No Match Default] ✅ 7ms
Legacy Getters.Legacy Getter Reads Typed Value[V2 Value.String.No Match Null] ✅ 7ms
Legacy Getters.Legacy Getter Reads Typed Value[V2 Value.String.Order First Match] ✅ 7ms
Legacy Getters.Legacy Getter Reads Typed Value[V2 Value.String.Order Targeting Miss] ✅ 7ms
Legacy Getters.Legacy Getter Reads Typed Value[V2 Value.Number.Target] ✅ 9ms
Legacy Getters.Legacy Getter Reads Typed Value[V2 Value.Number.Rollout Hit] ✅ 7ms
Legacy Getters.Legacy Getter Reads Typed Value[V2 Value.Number.Miss Return Default] ✅ 8ms
Legacy Getters.Legacy Getter Reads Typed Value[V2 Value.Number.Miss Return Default Null] ✅ 7ms
Legacy Getters.Legacy Getter Reads Typed Value[V2 Value.Number.Miss Continue] ✅ 7ms
Legacy Getters.Legacy Getter Reads Typed Value[V2 Value.Number.No Match Default] ✅ 7ms
Legacy Getters.Legacy Getter Reads Typed Value[V2 Value.Number.No Match Null] ✅ 21ms
Legacy Getters.Legacy Getter Reads Typed Value[V2 Value.Number.Order First Match] ✅ 8ms
Legacy Getters.Legacy Getter Reads Typed Value[V2 Value.Number.Order Targeting Miss] ✅ 7ms
Legacy Getters.Legacy Getter Reads Typed Value[V2 Value.Object.Target] ✅ 8ms
Legacy Getters.Legacy Getter Reads Typed Value[V2 Value.Object.Rollout Hit] ✅ 7ms
Legacy Getters.Legacy Getter Reads Typed Value[V2 Value.Object.Miss Return Default] ✅ 7ms
Legacy Getters.Legacy Getter Reads Typed Value[V2 Value.Object.Miss Return Default Null] ✅ 7ms
Legacy Getters.Legacy Getter Reads Typed Value[V2 Value.Object.Miss Continue] ✅ 8ms
Legacy Getters.Legacy Getter Reads Typed Value[V2 Value.Object.No Match Default] ✅ 7ms
Legacy Getters.Legacy Getter Reads Typed Value[V2 Value.Object.No Match Null] ✅ 7ms
Legacy Getters.Legacy Getter Reads Typed Value[V2 Value.Object.Order First Match] ✅ 8ms
Legacy Getters.Legacy Getter Reads Typed Value[V2 Value.Object.Order Targeting Miss] ✅ 7ms
Legacy Getters.Legacy Getter Reads Typed Value[V2 Value.String.Unicode] ✅ 8ms
Legacy Getters.Legacy Getter Reads Typed Value[V2 Value.String.Looks Boolean] ✅ 7ms
Legacy Getters.Legacy Getter Reads Typed Value[V2 Value.Number.Zero] ✅ 7ms
Legacy Getters.Legacy Getter Reads Typed Value[V2 Value.Number.Negative Decimal] ✅ 7ms
Legacy Getters.Legacy Getter Reads Typed Value[V2 Value.Number.Short Decimal] ✅ 8ms
Legacy Getters.Legacy Getter Reads Typed Value[V2 Value.Number.Exponent] ✅ 7ms
Legacy Getters.Legacy Getter Reads Typed Value[V2 Value.Number.Max Safe Integer] ✅ 7ms
Legacy Getters.Legacy Getter Reads Typed Value[V2 Value.Number.Min Safe Integer] ✅ 8ms
Legacy Getters.Legacy Getter Reads Typed Value[V2 Value.Object.Empty] ✅ 7ms
Legacy Getters.Legacy Getter Reads Typed Value[V2 Value.Object.Nested] ✅ 7ms
Legacy Getters.Legacy Getter Reads Typed Value[V2 Value.Object.Max Depth] ✅ 7ms
Legacy Payloads.Legacy Payload Reads Reader Fixture[Readers.Complete Split] ✅ 6ms
Legacy Payloads.Legacy Payload Reads Reader Fixture[Readers.Partial Split Missing Config Version] ✅ 6ms
Legacy Payloads.Legacy Payload Reads Reader Fixture[Readers.Partial Split Missing Rule Type] ✅ 5ms
Legacy Payloads.Legacy Payload Reads Reader Fixture[Readers.Partial Split Missing Rule Id] ✅ 5ms
Legacy Payloads.Legacy Payload Reads Reader Fixture[Readers.Partial Split Missing Variant Key] ✅ 5ms
Legacy Payloads.Legacy Payload Reads Reader Fixture[Readers.Split Wrong Type Config Version] ✅ 6ms
Legacy Payloads.Legacy Payload Reads Reader Fixture[Readers.Split Wrong Type Rule Type] ✅ 5ms
Legacy Payloads.Legacy Payload Reads Reader Fixture[Readers.Split Wrong Type Rule Id] ✅ 6ms
Legacy Payloads.Legacy Payload Reads Reader Fixture[Readers.Split Wrong Type Experiment Id] ✅ 5ms
Legacy Payloads.Legacy Payload Reads Reader Fixture[Readers.Split Extra Experiment Id] ✅ 5ms
Legacy Payloads.Legacy Payload Reads Reader Fixture[Readers.Split Wrong Type Variant Key] ✅ 6ms
Legacy Payloads.Legacy Payload Reads Reader Fixture[Readers.Wrong Rule Type Literal] ✅ 5ms
Legacy Payloads.Legacy Payload Reads Reader Fixture[Readers.Unknown Fields] ✅ 6ms
Legacy Payloads.Legacy Payload Reads Reader Fixture[Readers.Old Server Variant] ✅ 5ms
Legacy Payloads.Legacy Payload Reads Reader Fixture[Readers.Old Server Boolean] ✅ 5ms
Legacy Payloads.Legacy Payload Reads Reader Fixture[Readers.Old Server Null Variant] ✅ 6ms
Legacy Payloads.Legacy Payload Reads Reader Fixture[Readers.Old Server False] ✅ 6ms
Legacy Payloads.Legacy Payload Reads Reader Fixture[Readers.V4 Value Takes Precedence] ✅ 5ms
Legacy Payloads.Legacy Payload Reads Reader Fixture[Readers.Missing Flag] ✅ 6ms
Legacy Payloads.Legacy Payload Reads Reader Fixture[Readers.Targeting Match Targeted Release] ✅ 5ms
Legacy Payloads.Legacy Payload Reads Reader Fixture[Readers.Targeting Match Percentage Rollout] ✅ 6ms
Legacy Payloads.Legacy Payload Reads Reader Fixture[Readers.Rollout Miss Percentage Rollout] ✅ 6ms
Legacy Payloads.Legacy Payload Reads Reader Fixture[Readers.Rollout Miss Experiment] ✅ 5ms
Legacy Payloads.Legacy Payload Reads Reader Fixture[Readers.Experiment Paused] ✅ 6ms
Legacy Payloads.Legacy Payload Reads Reader Fixture[Readers.Holdout] ✅ 6ms
Legacy Payloads.Legacy Payload Reads Reader Fixture[Readers.Holdout Variant Key] ✅ 6ms
Legacy Payloads.Legacy Payload Reads Reader Fixture[Readers.No Rule Match] ✅ 6ms
Legacy Payloads.Legacy Payload Reads Reader Fixture[Readers.Missing Group Key] ✅ 5ms
Legacy Payloads.Legacy Payload Reads Reader Fixture[Readers.Dependency Error] ✅ 6ms
Legacy Payloads.Legacy Payload Reads Reader Fixture[Readers.Error] ✅ 5ms
Legacy Payloads.Legacy Payload Reads Reader Fixture[Readers.Error With Value] ✅ 6ms
Legacy Payloads.Legacy Payload Reads Reader Fixture[Readers.Malformed Sibling Isolation] ✅ 6ms
Legacy Payloads.Legacy Payload Reads Reader Fixture[Readers.Partial Split String Value] ✅ 5ms
Legacy Payloads.Legacy Payload Reads Reader Fixture[Readers.V1 At V4] ✅ 6ms
Legacy Payloads.Legacy Payload Reads Reader Fixture[Readers.Integral Json Number Context] ✅ 5ms
Legacy Payloads.Legacy Payload Reads Reader Fixture[Readers.Flag Key Seed] ✅ 6ms
Legacy Payloads.Legacy Payload Is The Typed Value[V2 Value.String.Target] ✅ 6ms
Legacy Payloads.Legacy Payload Is The Typed Value[V2 Value.String.Rollout Hit] ✅ 6ms
Legacy Payloads.Legacy Payload Is The Typed Value[V2 Value.String.Miss Return Default] ✅ 5ms
Legacy Payloads.Legacy Payload Is The Typed Value[V2 Value.String.Miss Return Default Null] ✅ 6ms
Legacy Payloads.Legacy Payload Is The Typed Value[V2 Value.String.Miss Continue] ✅ 5ms
Legacy Payloads.Legacy Payload Is The Typed Value[V2 Value.String.No Match Default] ✅ 6ms
Legacy Payloads.Legacy Payload Is The Typed Value[V2 Value.String.No Match Null] ✅ 5ms
Legacy Payloads.Legacy Payload Is The Typed Value[V2 Value.String.Order First Match] ✅ 5ms
Legacy Payloads.Legacy Payload Is The Typed Value[V2 Value.String.Order Targeting Miss] ✅ 6ms
Legacy Payloads.Legacy Payload Is The Typed Value[V2 Value.Number.Target] ✅ 5ms
Legacy Payloads.Legacy Payload Is The Typed Value[V2 Value.Number.Rollout Hit] ✅ 5ms
Legacy Payloads.Legacy Payload Is The Typed Value[V2 Value.Number.Miss Return Default] ✅ 7ms
Legacy Payloads.Legacy Payload Is The Typed Value[V2 Value.Number.Miss Return Default Null] ✅ 5ms
Legacy Payloads.Legacy Payload Is The Typed Value[V2 Value.Number.Miss Continue] ✅ 5ms
Legacy Payloads.Legacy Payload Is The Typed Value[V2 Value.Number.No Match Default] ✅ 6ms
Legacy Payloads.Legacy Payload Is The Typed Value[V2 Value.Number.No Match Null] ✅ 5ms
Legacy Payloads.Legacy Payload Is The Typed Value[V2 Value.Number.Order First Match] ✅ 6ms
Legacy Payloads.Legacy Payload Is The Typed Value[V2 Value.Number.Order Targeting Miss] ✅ 5ms
Legacy Payloads.Legacy Payload Is The Typed Value[V2 Value.Object.Target] ✅ 6ms
Legacy Payloads.Legacy Payload Is The Typed Value[V2 Value.Object.Rollout Hit] ✅ 5ms
Legacy Payloads.Legacy Payload Is The Typed Value[V2 Value.Object.Miss Return Default] ✅ 5ms
Legacy Payloads.Legacy Payload Is The Typed Value[V2 Value.Object.Miss Return Default Null] ✅ 5ms
Legacy Payloads.Legacy Payload Is The Typed Value[V2 Value.Object.Miss Continue] ✅ 6ms
Legacy Payloads.Legacy Payload Is The Typed Value[V2 Value.Object.No Match Default] ✅ 5ms
Legacy Payloads.Legacy Payload Is The Typed Value[V2 Value.Object.No Match Null] ✅ 6ms
Legacy Payloads.Legacy Payload Is The Typed Value[V2 Value.Object.Order First Match] ✅ 5ms
Legacy Payloads.Legacy Payload Is The Typed Value[V2 Value.Object.Order Targeting Miss] ✅ 5ms
Legacy Payloads.Legacy Payload Is The Typed Value[V2 Value.String.Unicode] ✅ 6ms
Legacy Payloads.Legacy Payload Is The Typed Value[V2 Value.String.Looks Boolean] ✅ 5ms
Legacy Payloads.Legacy Payload Is The Typed Value[V2 Value.Number.Zero] ✅ 5ms
Legacy Payloads.Legacy Payload Is The Typed Value[V2 Value.Number.Negative Decimal] ✅ 6ms
Legacy Payloads.Legacy Payload Is The Typed Value[V2 Value.Number.Short Decimal] ✅ 5ms
Legacy Payloads.Legacy Payload Is The Typed Value[V2 Value.Number.Exponent] ✅ 5ms
Legacy Payloads.Legacy Payload Is The Typed Value[V2 Value.Number.Max Safe Integer] ✅ 6ms
Legacy Payloads.Legacy Payload Is The Typed Value[V2 Value.Number.Min Safe Integer] ✅ 5ms
Legacy Payloads.Legacy Payload Is The Typed Value[V2 Value.Object.Empty] ✅ 6ms
Legacy Payloads.Legacy Payload Is The Typed Value[V2 Value.Object.Nested] ✅ 5ms
Legacy Payloads.Legacy Payload Is The Typed Value[V2 Value.Object.Max Depth] ✅ 6ms

Feature_Flags_Local_Evaluation Tests

✅ 4/4 tests passed

View Details
Test Status Duration
Versioned Boolean Matching.Matching Version Missing ✅ 53ms
Versioned Boolean Matching.Matching Version 1 ✅ 52ms
Versioned Boolean Matching.Matching Version 2 ✅ 52ms
Versioned Boolean Matching.Version Only Reload 1 2 1 2 Missing ✅ 27ms

@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

SDK performance: posthog-python

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
Managed heap after settling — — — unavailable; base:​ unsupported; head:​ unsupported; base:​ CPython has no uninstrumented total managed-heap byte counter; tracing would distort this RSS pass.​; head:​ CPython has no uninstrumented total managed-heap byte counter; tracing would distort this RSS pass.​
Capture and deliver events (4,096-byte payload, burst)
Shard: capture
Managed heap after settling — — — unavailable; base:​ unsupported; head:​ unsupported; base:​ CPython has no uninstrumented total managed-heap byte counter; tracing would distort this RSS pass.​; head:​ CPython has no uninstrumented total managed-heap byte counter; tracing would distort this RSS pass.​
Capture and deliver events (32-byte payload, steady)
Shard: capture
Managed heap after settling — — — unavailable; base:​ unsupported; head:​ unsupported; base:​ CPython has no uninstrumented total managed-heap byte counter; tracing would distort this RSS pass.​; head:​ CPython has no uninstrumented total managed-heap byte counter; tracing would distort this RSS pass.​
Capture and deliver events (4,096-byte payload, steady)
Shard: capture
Managed heap after settling — — — unavailable; base:​ unsupported; head:​ unsupported; base:​ CPython has no uninstrumented total managed-heap byte counter; tracing would distort this RSS pass.​; head:​ CPython has no uninstrumented total managed-heap byte counter; tracing would distort this RSS pass.​
Queue an event (32-byte payload)
Shard: capture
Allocated memory per operation — — — unavailable; base:​ unsupported; head:​ unsupported; base:​ Background preparation has no public completion boundary before flush; see capture.​drain for full-pipeline allocations.​; head:​ Background preparation has no public completion boundary before flush; see capture.​drain for full-pipeline allocations.​
Queue an event (32-byte payload)
Shard: capture
Allocations per operation — — — unavailable; base:​ unsupported; head:​ unsupported; base:​ Background preparation has no public completion boundary before flush; see capture.​drain for full-pipeline allocations.​; head:​ Background preparation has no public completion boundary before flush; see capture.​drain for full-pipeline allocations.​
Queue an event (4,096-byte payload)
Shard: capture
Allocated memory per operation — — — unavailable; base:​ unsupported; head:​ unsupported; base:​ Background preparation has no public completion boundary before flush; see capture.​drain for full-pipeline allocations.​; head:​ Background preparation has no public completion boundary before flush; see capture.​drain for full-pipeline allocations.​
Queue an event (4,096-byte payload)
Shard: capture
Allocations per operation — — — unavailable; base:​ unsupported; head:​ unsupported; base:​ Background preparation has no public completion boundary before flush; see capture.​drain for full-pipeline allocations.​; head:​ Background preparation has no public completion boundary before flush; see capture.​drain for full-pipeline allocations.​
Evaluate 1,000 flags under concurrent load
Shard: flags-memory
Managed heap after settling — — — unavailable; base:​ unsupported; head:​ unsupported; base:​ CPython has no uninstrumented total managed-heap byte counter; tracing would distort this RSS pass.​; head:​ CPython has no uninstrumented total managed-heap byte counter; tracing would distort this RSS pass.​
Refresh 1,000 flag definitions
Shard: flags-memory
Managed heap after settling — — — unavailable; base:​ unsupported; head:​ unsupported; base:​ CPython has no uninstrumented total managed-heap byte counter; tracing would distort this RSS pass.​; head:​ CPython has no uninstrumented total managed-heap byte counter; tracing would distort this RSS pass.​
Capture and deliver events (32-byte payload, burst)
Shard: capture
Allocated memory per operation 113.54 KiB/op 113.54 KiB/op <0.1% less memory Not flagged
Capture and deliver events (32-byte payload, burst)
Shard: capture
Allocations per operation 1,096.59 count/op 1,096.59 count/op <0.1% fewer Not flagged
Capture and deliver events (32-byte payload, burst)
Shard: capture
Time per operation 102.79 µs/op 105.43 µs/op 2.6% more time Not flagged
Capture and deliver events (32-byte payload, burst)
Shard: capture
Idle process memory (RSS) 36.01 MiB 35.94 MiB 0.2% less memory Not flagged
Capture and deliver events (32-byte payload, burst)
Shard: capture
Observed peak process memory (RSS) 37.74 MiB 37.67 MiB 0.2% less memory Not flagged
Capture and deliver events (32-byte payload, burst)
Shard: capture
Process memory after settling (RSS) 37.74 MiB 37.67 MiB 0.2% less memory Not flagged
Capture and deliver events (32-byte payload, burst)
Shard: capture
Process CPU time per operation 102.57 µs/op 105.11 µs/op 2.5% more time Not flagged
Capture and deliver events (32-byte payload, burst)
Shard: capture
Lifetime peak process memory (RSS) 40.3 MiB 40.3 MiB No observed change Not flagged
Capture and deliver events (4,096-byte payload, burst)
Shard: capture
Allocated memory per operation 166.11 KiB/op 166.1 KiB/op <0.1% less memory Not flagged
Capture and deliver events (4,096-byte payload, burst)
Shard: capture
Allocations per operation 1,089.64 count/op 1,089.63 count/op <0.1% fewer Not flagged
Capture and deliver events (4,096-byte payload, burst)
Shard: capture
Time per operation 135.17 µs/op 135.91 µs/op 0.5% more time Not flagged
Capture and deliver events (4,096-byte payload, burst)
Shard: capture
Idle process memory (RSS) 40.89 MiB 40.87 MiB <0.1% less memory Not flagged
Capture and deliver events (4,096-byte payload, burst)
Shard: capture
Observed peak process memory (RSS) 45.98 MiB 45.92 MiB 0.1% less memory Not flagged
Capture and deliver events (4,096-byte payload, burst)
Shard: capture
Process memory after settling (RSS) 45.98 MiB 45.92 MiB 0.1% less memory Not flagged
Capture and deliver events (4,096-byte payload, burst)
Shard: capture
Process CPU time per operation 126.64 µs/op 125.25 µs/op 1.1% less time Not flagged
Capture and deliver events (4,096-byte payload, burst)
Shard: capture
Lifetime peak process memory (RSS) 50.85 MiB 50.71 MiB 0.3% less memory Not flagged
Capture and deliver events (32-byte payload, steady)
Shard: capture
Allocated memory per operation 117.68 KiB/op 117.67 KiB/op <0.1% less memory Not flagged
Capture and deliver events (32-byte payload, steady)
Shard: capture
Allocations per operation 1,136.52 count/op 1,136.52 count/op <0.1% fewer Not flagged
Capture and deliver events (32-byte payload, steady)
Shard: capture
Time per operation 120.64 µs/op 120.28 µs/op 0.3% less time Not flagged
Capture and deliver events (32-byte payload, steady)
Shard: capture
Idle process memory (RSS) 35.95 MiB 35.98 MiB <0.1% more memory Not flagged
Capture and deliver events (32-byte payload, steady)
Shard: capture
Observed peak process memory (RSS) 36.05 MiB 36.09 MiB <0.1% more memory Not flagged
Capture and deliver events (32-byte payload, steady)
Shard: capture
Process memory after settling (RSS) 36.05 MiB 36.09 MiB <0.1% more memory Not flagged
Capture and deliver events (32-byte payload, steady)
Shard: capture
Process CPU time per operation 115.59 µs/op 114.93 µs/op 0.6% less time Not flagged
Capture and deliver events (32-byte payload, steady)
Shard: capture
Lifetime peak process memory (RSS) 40.3 MiB 40.3 MiB No observed change Not flagged
Capture and deliver events (4,096-byte payload, steady)
Shard: capture
Allocated memory per operation 170.56 KiB/op 170.56 KiB/op <0.1% less memory Not flagged
Capture and deliver events (4,096-byte payload, steady)
Shard: capture
Allocations per operation 1,129.41 count/op 1,129.39 count/op <0.1% fewer Not flagged
Capture and deliver events (4,096-byte payload, steady)
Shard: capture
Time per operation 155.18 µs/op 148.21 µs/op 4.5% less time Not flagged
Capture and deliver events (4,096-byte payload, steady)
Shard: capture
Idle process memory (RSS) 40.68 MiB 40.78 MiB 0.2% more memory Not flagged
Capture and deliver events (4,096-byte payload, steady)
Shard: capture
Observed peak process memory (RSS) 40.68 MiB 40.78 MiB 0.3% more memory Not flagged
Capture and deliver events (4,096-byte payload, steady)
Shard: capture
Process memory after settling (RSS) 40.68 MiB 40.78 MiB 0.3% more memory Not flagged
Capture and deliver events (4,096-byte payload, steady)
Shard: capture
Process CPU time per operation 147.01 µs/op 138.58 µs/op 5.7% less time Not flagged
Capture and deliver events (4,096-byte payload, steady)
Shard: capture
Lifetime peak process memory (RSS) 41 MiB 41.05 MiB 0.1% more memory Not flagged
Queue an event (32-byte payload)
Shard: capture
Caller-thread CPU time per operation 71.3 µs/op 70.78 µs/op 0.7% less time Not flagged
Queue an event (32-byte payload)
Shard: capture
Time per operation 72.77 µs/op 75.47 µs/op 3.7% more time Not flagged
Queue an event (4,096-byte payload)
Shard: capture
Caller-thread CPU time per operation 72.26 µs/op 71.47 µs/op 1.1% less time Not flagged
Queue an event (4,096-byte payload)
Shard: capture
Time per operation 76.12 µs/op 76.28 µs/op 0.2% more time Not flagged
Evaluate all 10 flags
Shard: flags-scaling
Allocated memory per operation 200.98 KiB/op 200.98 KiB/op No observed change Not flagged
Evaluate all 10 flags
Shard: flags-scaling
Allocations per operation 2,339.33 count/op 2,339.33 count/op No observed change Not flagged
Evaluate all 10 flags
Shard: flags-scaling
Time per operation 65.01 µs/op 63.67 µs/op 2.1% less time Not flagged
Evaluate all 10 flags
Shard: flags-scaling
Process CPU time per operation 65.01 µs/op 63.66 µs/op 2.1% less time Not flagged
Evaluate all 100 flags
Shard: flags-scaling
Allocated memory per operation 1.93 MiB/op 1.93 MiB/op No observed change Not flagged
Evaluate all 100 flags
Shard: flags-scaling
Allocations per operation 23,013.56 count/op 23,013.56 count/op No observed change Not flagged
Evaluate all 100 flags
Shard: flags-scaling
Time per operation 628.97 µs/op 628.67 µs/op <0.1% less time Not flagged
Evaluate all 100 flags
Shard: flags-scaling
Process CPU time per operation 629 µs/op 628.72 µs/op <0.1% less time Not flagged
Evaluate all 1,000 flags
Shard: flags-scaling
Allocated memory per operation 19.24 MiB/op 19.24 MiB/op No observed change Not flagged
Evaluate all 1,000 flags
Shard: flags-scaling
Allocations per operation 229,654.94 count/op 229,654.94 count/op No observed change Not flagged
Evaluate all 1,000 flags
Shard: flags-scaling
Time per operation 6.78 ms/op 6.59 ms/op 2.8% less time Not flagged
Evaluate all 1,000 flags
Shard: flags-scaling
Process CPU time per operation 6.78 ms/op 6.59 ms/op 2.8% less time Not flagged
Evaluate 1,000 flags under concurrent load
Shard: flags-memory
Idle process memory (RSS) 42.29 MiB 42.34 MiB 0.1% more memory Not flagged
Evaluate 1,000 flags under concurrent load
Shard: flags-memory
Observed peak process memory (RSS) 42.64 MiB 42.66 MiB <0.1% more memory Not flagged
Evaluate 1,000 flags under concurrent load
Shard: flags-memory
Process memory after settling (RSS) 42.64 MiB 42.66 MiB <0.1% more memory Not flagged
Evaluate 1,000 flags under concurrent load
Shard: flags-memory
Lifetime peak process memory (RSS) 42.46 MiB 42.54 MiB 0.2% more memory Not flagged
Refresh 1,000 flag definitions
Shard: flags-memory
Idle process memory (RSS) 41.81 MiB 42.09 MiB 0.7% more memory Not flagged
Refresh 1,000 flag definitions
Shard: flags-memory
Observed peak process memory (RSS) 42.57 MiB 42.17 MiB 0.9% less memory Not flagged
Refresh 1,000 flag definitions
Shard: flags-memory
Process memory after settling (RSS) 42.57 MiB 42.16 MiB 1% less memory Not flagged
Refresh 1,000 flag definitions
Shard: flags-memory
Lifetime peak process memory (RSS) 42.74 MiB 42.57 MiB 0.4% less memory Not flagged
Evaluate one boolean flag
Shard: flags-single
Allocated memory per operation 15.05 KiB/op 15.05 KiB/op No observed change Not flagged
Evaluate one boolean flag
Shard: flags-single
Allocations per operation 173.76 count/op 173.76 count/op No observed change Not flagged
Evaluate one boolean flag
Shard: flags-single
Time per operation 12.55 µs/op 12.65 µs/op 0.9% more time Not flagged
Evaluate one boolean flag
Shard: flags-single
Process CPU time per operation 12.55 µs/op 12.65 µs/op 0.9% more time Not flagged
Evaluate a cohort-filtered flag
Shard: flags-single
Allocated memory per operation 23.12 KiB/op 23.12 KiB/op No observed change Not flagged
Evaluate a cohort-filtered flag
Shard: flags-single
Allocations per operation 270.27 count/op 270.27 count/op No observed change Not flagged
Evaluate a cohort-filtered flag
Shard: flags-single
Time per operation 16.83 µs/op 16.83 µs/op <0.1% more time Not flagged
Evaluate a cohort-filtered flag
Shard: flags-single
Process CPU time per operation 16.83 µs/op 16.83 µs/op <0.1% more time Not flagged
Evaluate a flag (early match)
Shard: flags-single
Allocated memory per operation 35.71 KiB/op 35.71 KiB/op No observed change Not flagged
Evaluate a flag (early match)
Shard: flags-single
Allocations per operation 387.27 count/op 387.27 count/op No observed change Not flagged
Evaluate a flag (early match)
Shard: flags-single
Time per operation 24.09 µs/op 24.1 µs/op <0.1% more time Not flagged
Evaluate a flag (early match)
Shard: flags-single
Process CPU time per operation 24.09 µs/op 24.1 µs/op <0.1% more time Not flagged
Evaluate a flag (late match)
Shard: flags-single
Allocated memory per operation 53.59 KiB/op 53.59 KiB/op No observed change Not flagged
Evaluate a flag (late match)
Shard: flags-single
Allocations per operation 576.27 count/op 576.27 count/op No observed change Not flagged
Evaluate a flag (late match)
Shard: flags-single
Time per operation 34.33 µs/op 34.15 µs/op 0.5% less time Not flagged
Evaluate a flag (late match)
Shard: flags-single
Process CPU time per operation 34.33 µs/op 34.15 µs/op 0.5% less time Not flagged
Evaluate a flag (no match)
Shard: flags-single
Allocated memory per operation 52.14 KiB/op 52.14 KiB/op No observed change Not flagged
Evaluate a flag (no match)
Shard: flags-single
Allocations per operation 556.77 count/op 556.77 count/op No observed change Not flagged
Evaluate a flag (no match)
Shard: flags-single
Time per operation 32.62 µs/op 32.51 µs/op 0.3% less time Not flagged
Evaluate a flag (no match)
Shard: flags-single
Process CPU time per operation 32.62 µs/op 32.51 µs/op 0.3% less time Not flagged
Evaluate a property-filtered flag
Shard: flags-single
Allocated memory per operation 17.84 KiB/op 17.84 KiB/op No observed change Not flagged
Evaluate a property-filtered flag
Shard: flags-single
Allocations per operation 198.27 count/op 198.27 count/op No observed change Not flagged
Evaluate a property-filtered flag
Shard: flags-single
Time per operation 14.02 µs/op 14.02 µs/op <0.1% more time Not flagged
Evaluate a property-filtered flag
Shard: flags-single
Process CPU time per operation 14.02 µs/op 14.02 µs/op <0.1% more time Not flagged
Evaluate a regex-filtered flag
Shard: flags-single
Allocated memory per operation 19.23 KiB/op 19.23 KiB/op No observed change Not flagged
Evaluate a regex-filtered flag
Shard: flags-single
Allocations per operation 210.77 count/op 210.77 count/op No observed change Not flagged
Evaluate a regex-filtered flag
Shard: flags-single
Time per operation 14.92 µs/op 15.02 µs/op 0.7% more time Not flagged
Evaluate a regex-filtered flag
Shard: flags-single
Process CPU time per operation 14.92 µs/op 15.02 µs/op 0.7% more time Not flagged
Evaluate a rollout flag
Shard: flags-single
Allocated memory per operation 14.04 KiB/op 14.04 KiB/op No observed change Not flagged
Evaluate a rollout flag
Shard: flags-single
Allocations per operation 160.76 count/op 160.76 count/op No observed change Not flagged
Evaluate a rollout flag
Shard: flags-single
Time per operation 11.93 µs/op 11.86 µs/op 0.5% less time Not flagged
Evaluate a rollout flag
Shard: flags-single
Process CPU time per operation 11.93 µs/op 11.86 µs/op 0.5% less time Not flagged
Evaluate a multivariate flag
Shard: flags-single
Allocated memory per operation 15.21 KiB/op 15.21 KiB/op No observed change Not flagged
Evaluate a multivariate flag
Shard: flags-single
Allocations per operation 177.77 count/op 177.77 count/op No observed change Not flagged
Evaluate a multivariate flag
Shard: flags-single
Time per operation 13.13 µs/op 13.18 µs/op 0.4% more time Not flagged
Evaluate a multivariate flag
Shard: flags-single
Process CPU time per operation 13.13 µs/op 13.18 µs/op 0.4% 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 9b4639187df3818a24350c522146313c5864d4b6 → 8590215574cebc4cc29b0b93f7457c84f6fe2e69.

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

Silthus commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor Author

Note

🤖 Claude Opus 5.5 responding on behalf of Michael

Decisions for this PR, updated for revision 2 of the contract in PostHog/posthog#132118:

  • 👤 What does category carry? "transactional" or a category object (key, type, name, optional description) that the send creates or updates by key. This replaces the bare key string from the first revision.
  • 👤 Which emails.send form takes category? The code form (template_key) only, in all 8 SDKs. A template send follows its template's category.
  • 🤖 How is the category modelled in Python? A frozen dataclass MessageCategory, with Literal["marketing", "transactional"] for type, plus TRANSACTIONAL_CATEGORY: Final = "transactional". A dataclass reads like the SDK's other value types, and a type checker refuses a bare key string. The alternative, a TypedDict, would also accept plain dicts.
  • 🤖 Are copies_not_allowed docs needed? No. This SDK has no cc or bcc, so a send from it can't hit that code.

Silthus and others added 2 commits November 10, 2026 04:23
category on a code send is now TRANSACTIONAL_CATEGORY or a
MessageCategory with a key, type, name and optional description. The
server creates or updates the category by key, so the wire carries the
object instead of a bare key.

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 faafa5a: 1 Must 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 posthog/emails.py Resolved
The server keeps a category's description when the field is missing and
clears it on an empty string, so the SDK sends "" as "" and leaves the
field out only for None.

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 073154c: no findings.

The category tests now send through an in-memory fake of PostHog's code
send that refuses fields outside the contract's schema and upserts
categories by key. They assert on the stored category and the recorded
send instead of the request body.

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 4836173: no findings.

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 99d6d0e: 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_CATEGORY on a template in a category. The fake 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 8919451: no findings.

… creation

A send that names a category now creates it when the project has none
with that key, and otherwise leaves it as it is. Drop the update and the
keep-or-clear description wording, name copies_not_allowed among the
refusals, and prove a later send leaves the stored category unchanged.

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

Silthus commented Nov 12, 2026

Copy link
Copy Markdown
Contributor Author

Note

🤖 Claude Opus 5.5 responding on behalf of Michael

Decided 2026-11-12. The second line replaces "Are copies_not_allowed docs needed?" in the earlier comment.

  • 👍 Does a send change a category that exists? No: "Create-only, no renames (Recommended)". A send that names a category creates it when the project has none with that key, restores a deleted one, and otherwise leaves it as it is. name and description apply only when the send creates the category. Renames happen only in PostHog or the categories API. Replaces "the server creates or updates the category by its key" and "\"\" clears the stored description".
  • 🤖 Are copies_not_allowed docs needed? Yes. The docstrings and changeset name it beside the other 400 refusals, the same list as the other SDKs, so a caller can branch on every code the send route documents.

A template in a marketing category is refused with marketing_template, so
the docs and changeset name that code, and the test fake seeds a template
in a transactional category for follow-the-template and category_mismatch.

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

Silthus commented Nov 12, 2026

Copy link
Copy Markdown
Contributor Author

Note

🤖 Claude Opus 5.5 responding on behalf of Michael

Decided 2026-11-12.

  • 👍 Can a template made in PostHog be marketing? No: "Ship code sends, park templates (Recommended)". Code sends with a category ship; template categories are parked. A template made in PostHog is transactional only, and a send whose template_key names a template in a marketing category is refused with marketing_template (400). unsubscribe_link_required and copies_not_allowed never apply to a template.

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