Repository navigation
Conversation
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>
posthog-python Compliance ReportDate: 2026-11-12T14:48:36.161893+00:00 ✅ All Tests Passed!270/270 tests passed Capture_V1 Tests✅ 95/95 tests passed View Details
Capture_Ai Tests✅ 5/5 tests passed View Details
Feature_Flags Tests✅ 17/17 tests passed View Details
Feature_Flags_V4 Tests✅ 149/149 tests passed View Details
Feature_Flags_Local_Evaluation Tests✅ 4/4 tests passed View Details
|
SDK performance: posthog-pythonBenchmarks 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
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 102 metric rows; 102 rows shown in all results. Omitted or shortened data remain in |
|
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:
|
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>
There was a problem hiding this comment.
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.
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>
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>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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>
… 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>
|
Note 🤖 Claude Opus 5.5 responding on behalf of Michael Decided 2026-11-12. The second line replaces "Are
|
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>
|
Note 🤖 Claude Opus 5.5 responding on behalf of Michael Decided 2026-11-12.
|
|
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 |
…en refusal test inputs
The merged server takes `category` on a code send as a plain string, the key of one of the project's message categories. Drop MessageCategory, TRANSACTIONAL_CATEGORY and their validation, and send the key as given. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Depends on PostHog/posthog#142574 and PostHog/posthog#142564, both merged behind the flag
workflows-code-send-categories. Release once customers can use it.💡 Motivation and Context
emails.sendwithtemplate_key) can only send transactional email.Public API change: one new optional field,
CodeEmailArgs.category: NotRequired[Optional[str]]. The merged server defines its shape.Changes
categoryis the key of one of the project's message categories, such as"newsletter":It goes in the body only when the caller sets it.
category=Nonecounts as left out, like the other optional code-send fields, so a send without it builds the same body as before.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 haveccorbcc.The module and
CodeEmailArgsdocstrings name the server's refusals:category_not_foundfor an unknown key andmarketing_copies_unsupportedfor a marketing email with copies. Both are HTTP 400, so they raiseEmailErrorwithname == "validation_error"through the existing status mapping.The template form (
template_id) doesn't takecategory: a template send follows its template's own category. Passing it raisesTypeErrorbefore any request, and a type checker refuses it.Minor changeset.
Note
🟢 Merge risk: low · two-way door at merge, one-way once released (commits the package to
category: Optional[str]on the code form)strfield. A send without it builds the exact same body as before (exact-body tests).categorygets an HTTP 400 field error oncategoryand nothing queues.categoryout to go back to today's body.💚 How did you test it?
test_rendered_content_is_posted_as_is(every_field) sendscategory="newsletter"and asserts the exact body carries"category": "newsletter". Dropping the field from the body turns it red.html_onlyandnone_as_left_outcases assert the exact body withoutcategory, and withcategory=None.test_rejects_a_code_send_that_mixes_or_misses_fields(category_on_template_form) asserts atemplate_idsend withcategoryraisesTypeErrorand makes no request.0178d39:ruff format --check .,ruff check .,mypy --no-site-packages --config-file mypy.ini . | mypy-baseline filter,python -W error -c "import posthog",make public_api_check,.github/scripts/check_strict_types.shandpytest --timeout=30pass.📝 Checklist
If releasing new changes
sampo addto generate a changeset file🤖 Agent context
Autonomy: Human-driven (agent-assisted)
claude-opus-5-5), as one of the workers addingcategoryto every SDK's email send.MessageCategory,TRANSACTIONAL_CATEGORY) to the key string the merged server takes. The class, the constant, their exports, the local validation, their snapshot entries and their tests are gone, and.github/scripts/check_strict_types.shis back tomain.Decisions
categoryemails.sendform takescategory?🤖 Generated with Claude Code