Repository navigation
Conversation
`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>
|
Note Decisions recorded by Claude Code (Claude Opus 5.5) while building this PR. Updated for contract revision 2.
|
posthog-ruby-sync Compliance ReportDate: 2026-11-27T04:41:29.295824+00:00 ✅ All Tests Passed!47/47 tests passed Capture Tests✅ 30/30 tests passed View Details
Feature_Flags Tests✅ 17/17 tests passed View Details
|
posthog-ruby-async Compliance ReportDate: 2026-11-27T04:41:36.075212+00:00 ✅ All Tests Passed!47/47 tests passed Capture Tests✅ 30/30 tests passed View Details
Feature_Flags Tests✅ 17/17 tests passed View Details
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SDK performance: posthog-rubyBenchmarks 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 |
`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>
There was a problem hiding this comment.
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.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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>
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>
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>
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>
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 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>
|
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 |
…and simplify fake
… and align changeset
…egory_mismatch docs
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>
💡 Motivation and Context
Developers who send email from Ruby with
posthog.emails.sendcan 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
categorykeyword to code sends (thetemplate_keyform). It takes a String: the key of one of the project's message categories, such asnewsletter.{{ unsubscribe_url }}with the recipient's preferences link, and adds List-Unsubscribe headers.ccorbcc: PostHog refuses it withmarketing_copies_unsupported.category_not_found. A marketing email from the PostHog test sender getssandbox_fields_unsupported.template_id) follows its template's own category, so it refusescategorywith anArgumentError, the way it refusessubject.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
categorykeywordcategoryto a code send get it on the wire as a string, and the server's refusals asEmailError; no caller does yet.categoryare unchanged: an unset ornilcategoryis not sent.workflows-code-send-categories; past that, fix forward.Changes
#sendtakescategory:(String). It is checked likehtmlandfrom(a String, orArgumentError) and sent only when set. PostHog owns the key format and the marketing rules.Emailsand#senddescribe the field and the codes above. The server's codes come through asEmailError, namedvalidation_error(HTTP 400).posthog-ruby: minor) and the regenerated public API snapshot.categoryyet. This PR follows the merged server.💚 How did you test it?
ruby:3.4(Bundler 4.0.13):bundle exec rake public_api:generatethenpublic_api:check(clean),bundle exec rubocop(168 files, 0 offenses),bundle exec rspec(2,583 examples, 0 failures, 49 pending otel-bundle specs).spec/posthog/emails_spec.rb, throughclient.emails.sendwith WebMock:"category": "newsletter"when set and nocategorykey whennil;categoryand acategoryon a template send raiseArgumentErrorbefore any request;category_not_foundandmarketing_copies_unsupported(HTTP 400) raiseEmailErrornamedvalidation_error.categoryfrom the payload turns the body spec and the argument spec red.📝 Checklist
If releasing new changes
pnpm changesetto generate a changeset file🤖 Agent context
Autonomy: Human-driven (agent-assisted)
MessageCategorywithkey,type,name,description) and aTRANSACTIONALbuilt-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.categorycarriescategory🤖 Generated with Claude Code