Repository navigation
Conversation
🧙 Wizard CIRun the Wizard CI and test your changes against wizard-workbench example apps by replying with a GitHub comment using one of the following commands: Test all apps:
Test all apps in a directory:
Test an individual app:
Show more apps
Test against a wizard branch:
Add Results will be posted here when complete. |
The step 7 proxy test matched only the separate-client wording, so dropping "leave the secret key off the app's existing client" still passed. Assert that clause too; it fails without it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A send of a template stored at the provider now moves by bringing the email into the code: its HTML and text become a file next to the send, the code renders the variables with the provider's escaping, and the site sends the code form. A template made in PostHog, sent by its ID, is used only when the person asks for one. - template-to-code.md: the check, where the email goes, how each language renders it without a new dependency, and the escaping rule. - Steps 3, 7 and 9: the new default, the template form on request, and the report items for emails brought into the code. - SendGrid: Handlebars in the code, including the helpers the template form couldn't take. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A send with its own content and legacy substitutions stayed on SendGrid only because SendGrid put the values in. The code now does the same replace before the send, under the escaping rule of template-to-code.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…eat/migrate-email-postmark
…eat/migrate-email-mailgun
…migrate-email-amazon-ses
…at/migrate-email-loops
…pty Text as left out Step 3 reads only the Check part of the template file, so the rule that keeps a template whose provider sent no text part moves there. Resend's Go SDK leaves an empty Text out of the request, so Resend made that text part from the HTML, and such a site moves. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ain text off A dashboard copy shows no plain text both for a template without one and for one whose plain text is an empty string. Ask which, or read the template from the API; when nobody can tell, the site stays. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tion and keep the answer A dashboard copy has no key to read the template from the API, so the question offers to make one. The answer goes into the template's plan note, so a copy made again in Step 7 asks nothing new. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nly in Step 3 The template's note records its plain text however the template was read, so Step 7 never asks again, and the key is offered only in Step 3, before Step 5 asks the person to delete it. A site stays whenever neither the answer nor the API read settles it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PostHog's bulk add takes only bounce, complaint or manual, and writes its own reason text, such as "Imported (bounced)". The removal guard now keys on that prefix, and the import maps each Resend origin to the reason value. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…them PostHog's list records no source an app could check before a removal, a bulk add skips an address removed earlier, and an app can't call the import tool. PostHog blocks a transactional send only to an address that hard-bounced, and records that itself. So each such call becomes a "Before cutover" item. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PostHog blocks a transactional send only to an address that hard-bounced, so the weekly re-import limits mail to bounced addresses, not complaints. A call that removes an address becomes an "After cutover" item the person acts on when a moved send fails with recipient_suppressed. A call that adds one names the action before the deploy. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Re-import only now names bounces alone, and an app call that adds an address also records it where the moved sends can skip it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A moved send reaches every address an app's add call put on the provider's list, and an app-side flag misses past adds and survives a reactivation. So Step 3 asks once which sites rely on the call, and keeps them on the provider. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Step 3 asks which sites rely on the provider's list for addresses added by hand or by the app, and a non-answer keeps every site when the app adds addresses itself. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…the list The suppression-list question gets its own Step 3 section, asks only about sites that would move otherwise, keeps them on a non-answer, and says what would let them move. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e work The question now comes right after the field checks, so a site it keeps needs no template copy or PostHog template, and the plan note carries what would let the site move. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
posthog-rs's async email send waits between retries with tokio::time::sleep and sends through reqwest, so a site on async-std or smol stays on Resend. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…o feat/migrate-email-mailjet
…main Map each suppression entry to PostHog's `reason` (`bounce`, `complaint` or `manual`) as Step 5 now takes it, drop the "which entries count" text Step 5 no longer reads, and name the addresses Mailjet blocks for Step 3's suppression-list question. A template with an empty text part now stays unless Mailjet generated a text version, read from the template's `IsTextPartGenerationEnabled`, and the click row follows Step 7's rule on template keys. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… question, and check an HTML-only send's text part An address in both the hard bounces and the spam reports now imports as `bounce`, the one reason that blocks a moved send. Step 3's question asks only about addresses someone had Mailjet block, since the import already blocks hard bounces in PostHog. A send with `HTMLPart` and no text part moves only when one of its emails shows a `text/plain` part, since Mailjet's docs don't say whether it made one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…count and version, and at run time A `TextPart` the code builds at run time that can be empty now counts like a missing one, and the person checks one email for each Mailjet account and Send API version the HTML-only sites use, each answer deciding only those sites. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… email it sent without text A site whose `TextPart` the code builds at run time keeps sending it as `text` when it moves, left out only when empty, and the person checks an email the site sent with no text, since one with the code's own text can't show whether Mailjet made a text part. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
PostHog Review · Standard · reviewed bacb274: 1 Should fix.
This is review round 7 on this pull request. When findings keep coming back in the same code, the approach is usually the problem. Before the next fix, check whether a different design would remove the whole class of findings.
… that read other answer headers The Node.js error wrapper now carries PostHog's `retryAfterMs`, a read of a `Retry-After` header becomes a read of PostHog's retry delay in the rewrite file's unit, and a site that reads any other header of Mailjet's answer stays, since PostHog's answer carries no headers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… delay" Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Silthus
marked this pull request as draft
November 14, 2026 17:47
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
A person who sends with Mailjet and asks to move those sends to PostHog gets no help:
migrate-emailhas no Mailjet variant.With this PR,
migrate-email-mailjetmoves Mailjet sends to PostHog's email send in each language where both Mailjet and PostHog have an SDK, andwizard migrate mailjetruns it.Note
#472, the core
migrate-emailskill, merged tomain, and this PR now targetsmain. It adds one provider folder, one config variant, oneAGENTS.mdrow and the provider in the bundle test; the shared steps it uses are onmain. The other provider PRs land in any order: the lists they all touch,config.yaml,AGENTS.mdand the skill test, conflict in one line each as they land.Nothing merges until code sends are live and usable for customers: Michael's rule for #451 and every PR stacked on it.
Impact
Sends that arrive with
migratedFrom: 'mailjet'show whether people use this skill to move off Mailjet. Read it 14 days after the Wizard runsmigrateas a family.Merge risk
Caution
🔴 Merge risk: high · two-way door until the next context-mill release ships the skill; one-way once agents run it, because a migration's changes persist in each app's code and PostHog account (senders, imported suppressions, keys, deleted provider templates)
mainnobody changes yet: the skill ships with the next context-mill release, and a person who pickswizard migrate mailjetgets an agent that rewrites their Mailjet sends to PostHog's SDK, where before the command had no Mailjet variant.migrate-email-mailjetbundle and itsmanifest.jsonandskill-menu.jsonentries change; every other bundle,migrate-email-resendincluded, is byte-identical.Rollout
main; this PR merges next, and the skill publishes with the next build.migratedFrom: 'mailjet'and their error codes. No alert pages on a bad migration.Summary
references/mailjet/holds the three files each variant has:sdk-reference.md: Mailjet's official libraries in Node.js, Python, Ruby, PHP, Go, .NET and Java, the v3.1 and v3 Send APIs over HTTP, SMTP, and framework mailers. It covers how each library reports errors, includingmailjet-rest's 401 error at 1.7.0, its typed errors and retries from 1.8.0, the switches that turn a request off (Node's.requestthird argument and 3.xperform_api_call, PHPcall, Rubyperform_api_call, Pythondry_run), the host setting that marks an account on Mailjet's US setup, stored templates and Mailjet's template language, status reads, the Event API webhooks, and the APIs that are not sends.mapping.md:Sender,Headers,CustomID,EventPayload,CustomCampaign,DeduplicateCampaign,MonitoringCategory,Priority,URLTags,anonopen tracking, aReplyTowith a name,SandboxModeor a client switch that is on or set at run time, and sends with several messages or recipients. Sites withCc,Bcc,AttachmentsorInlinedAttachmentsstay too, because no PostHog SDK takes them yet.TrackOpensandTrackClicksare read per send, capped by the account'sEnabled,DisabledorAnonymoussetting, asked once per account with whether any contact refused open tracking. Tracking never maps tocaptureEngagement: PostHog adds its open pixel to every email, and counts clicks only for a PostHog template not marked sensitive. Opens untracked (accountDisabledorTrackOpens: disabled) go to Step 3's "Opens the provider didn't track": the person's yes moves them withopen pixel added: the person agreed, otherwise they stay (open tracking off). Anonymous opens (anonymous open tracking), or a contact who refused open tracking keep the site. Unknown answers keep it too (open tracking not checked): unknown contact open consent keeps every site of the account, and an unknown open setting every site that doesn't setTrackOpens: disabled. Opens tracked moves, and the plan row notes that PostHog counts no clicks for any moved site whose clicks Mailjet tracked. A site that moves to a PostHog template not marked sensitive also needs Mailjet's clicks tracked and no contact refusing click tracking, or the person marks the template sensitive.in-v3.mailjet.comstays, since PostHog has no SMTP relay; Go'sSendMailSMTP, framework mailers including an app's own Rails delivery method, and campaign draft sends stay.TemplateIDsend, and a send withTemplateLanguage: trueand its own content, move by rendering Mailjet's template language in the code (template-to-code.md): values and defaults, nested values, conditions, loops, operators,{% set %}, the named functions, themj:contactandmj:sendervalues, and the template's headers. A tag Mailjet fills from the account,data:,segment:and othermj:reads, an unnamed function, another header, a test of a value alone that can be0,""or empty, and a value without a default that the send can leave out keep it on Mailjet: since October 2025 Mailjet renders such a value as empty when the template's schema declares it, and blocks the email when it doesn't. A template made in PostHog, in Liquid, is used only when the person asks for one.mailjet-rest1.8.0+ threw, each catch mapping to the same kind of PostHog error (a catch ofApiRateLimitError, which 1.8.0+ never raised past its own retries, keeps the site); Python before 1.8.0, PHP and .NETPostAsyncanswered a status, so the status check becomes a catch that raisesnetwork_erroragain, and a Guzzle catch around PHP's call is mapped by what reached it; Go keepsif err != nil, withAPIFeedbackErrorsV31read asvalidation_erroror403; .NETSendTransactionalEmailAsyncmoves only when the old code ended an invalid send answered inMessagesand aMailjetServerExceptionwithHttpCode400 the same way; Mailjet answered the two apart and PostHog throwsvalidation_errorfor both, so many such sites, such as one that logsStatus"error"with nocatch, stay withcan't tell Mailjet's invalid-send paths apart. On the v3.1 Send API, Ruby's gem answered an invalid recipient address without raising and raisedMailjet::BadRequestfor every other400, so a Ruby site moves under the same rule. A400or a message withStatus: 'error'readsvalidation_error, never a status. Raw HTTP follows its client, and a status option that stops the throw for some failed statuses only, such as axios'svalidateStatus: s => s < 500, keeps the site; a Guzzle 7RequestExceptioncatch, or aConnectException-only one, takes one kind of network failure and keeps the site. A site that read no result logs PostHog's error and goes on, apart from a .NETSendTransactionalEmailAsyncsite, which moves only on the rule above. An unknownmailjet-restversion, or a range across 1.7.0 or 1.8.0, keeps the Python sites; 1.7.x's 401 keeps raising. PostHog's error carries the retry delay its answer named and no headers: a read of aRetry-Afterheader becomes a read of PostHog's retry delay, converted to the rewrite file's unit, and the Node.js wrapper carriesretryAfterMs; a site that reads any other header of Mailjet's answer stays,reads <header> from Mailjet's answer.$workflows_email_*event, and a click maps to$workflows_email_link_clickedonly for a PostHog template not marked sensitive: a code send counts no clicks, and a site whose clicks feed a handler moves only to such a template. A handler that matches events byMessageID,CustomIDorPayload, or acts onblockedorunsub, which have no PostHog event, keeps its sites on Mailjet.account.md: Mailjet's DKIM, SPF and ownership records next to PostHog's, and the app's own key pair for templates and suppressions, since Mailjet has no read-only key and a new key can't read another key's templates. It reads the account's tracking settings and contact opt-outs, and hard bounces and spam reports from the message and contact APIs (MessageStatus10and6); soft bounces, the campaign exclusion list and list unsubscribes are left out, with the reason why. Every request goes toapi.us.mailjet.comfor an account on Mailjet's US setup. Each suppression entry is imported with PostHog'sreason: hard bounces asbounce, which wins when an address is also a spam report, spam reports ascomplaint, and blocked addresses of unknown cause asmanual. For Step 3's suppression-list question it asks only about addresses someone had Mailjet block, since the import blocks hard bounces in PostHog too.Text-partstays (turns the plain-text part off) unless itsIsTextPartGenerationEnabledsetting shows Mailjet generated a text version. Mailjet's docs don't say whether the Send API makes a text part for anHTMLPartwith no text, so such a site, or one whoseTextPartis built at run time and can be empty, moves only when an email it sent with no text shows atext/plainpart, checked once per Mailjet account and Send API version. A moved site keeps sending a run-timeTextPartastext, left out only when empty.The mapping names PostHog's fields, client and errors through the rewrite file for the site's language, from #472: one
references/rewrite-<language>.mdper PostHog SDK, and Step 7's single list of what every SDK's send takes.Evidence
f36e3ed:vitest run scriptspasses 344 tests in 30 files, including the core's check that everyStep N says underpointer in the Mailjet bundle names a real section, andnode scripts/build.jsbuilds clean with no stray files. The shared provider test inmigrate-email-skill.test.jspublishes Mailjet as thewizard migrate mailjetsubcommand; the shadow diff below shows the bundle's contents.mainat8cd7381, after feat(migrate-email): move Resend sends in every PostHog SDK's language #472 merged, tof36e3ed: only the newmigrate-email-mailjetbundle,manifest.jsonandskill-menu.jsonchange, and the Mailjet bundle's shared step, rewrite andtemplate-to-code.mdfiles are byte-identical to the Resend bundle's; every other bundle is byte-identical. Saved in proof storage.mailjetorg, plus one npm read. The Mailjet attachments follow-up rechecks them against dev.mailjet.com.buildpasses onf36e3ed, with CodeQL, Semgrep and the Wiz scanners.Enabled/Disabled/Anonymous, contactmjoptinopenandmjoptinclick), and the SDK sources (mailjet-restv1.6.0, v1.7.0, v1.8.0 and v1.9.1 errors and retries, PHP v1.6.5callandRequest::call's Guzzle catches, Guzzle 7's exception classes, node-mailjet 3.xperform_api_call, Rubyperform_api_call, Pythondry_runfrom 1.7.0, the .NET client'sSendTransactionalEmailAsync), and PostHog's Python SDK retries. For the final pass, the Mailjet clients' timeout and retry options: node-mailjet's clientoptions(timeout, andmaxRetriesin newer versions),mailjet-resttimeoutoncreateand onClientfrom 1.7.0 with its 60 s default, PHP v1.6.5setTimeoutandsetConnectionTimeout, the Go client'sSetClientandWithContext, the .NET client'sHttpClientconstructor, and the Ruby gem's connection.f85d254) predate the move of templates into the code and this round's rules, so they are not evidence for this head. No run at this head moves a template site, a tracking-capped site, or amailjet-rest1.8.0+ site.Decisions
captureEngagement: opens untracked moves only with the person's yes to PostHog's open pixel (the core's "Opens the provider didn't track", Michael's later decision), unknown contact consent keeps every site, an unknown open setting every site that doesn't setTrackOpens: disabled, opens tracked moves with a no-clicks note. Replaced moving withcaptureEngagement: falsetimeouttimeoutto axios, whose limit the SDK can't keep, as Step 7 says; a 3.xtimeoutinconnector.post's options stays too, and so does Faraday'stimeouton an adapter other thannet_http10is a hard bounce and9a soft one, as Mailjet's message API reference lists themCustomID,EventPayloadorCustomCampaignSendTransactionalEmailAsyncinvalid sendMessagesand threwMailjetServerExceptionfor one without, even on a400; PostHog throwsvalidation_errorfor both, so the site moves only when the old code ended both the same way, and otherwise staysversionoption or the gem'sapi_versionsays so, since the gem defaults to v3, and a send whose version is still unknown after reading the config or asking the person stays. On the v3.1 Send API, the gem returned an invalid address and raisedMailjet::BadRequestfor other400s; the site moves only when both ended the same way. A raw client whose status option stops the throw for some failed statuses only, such as axios'svalidateStatus: s => s < 500, stays, since PostHog's status codes don't match Mailjet's one to oneandor onlyor, drops the parentheses that hold whole tests or one value, such as(var:count) > 0, and keeps those in a quoted string. One that mixesandwithor, or compares a test or a group of tests with a value, keeps the template on Mailjet: PostHog's Liquid refuses parentheses and readsandandorfrom the rightcritical: context-mill keeps no critical-path list, but a wrong rule silently changes an app's email sends, so agents decide only review rounds and status here, and Michael decides gapsTemplateErrorDeliveris on: since October 2025 Mailjet sends declared values as empty and blocks undefined ones, and these files can't read the schema. Replaced blocking the send in the codeTrackOpens; anonymous opens or any contact who refused open tracking keep the site, untracked opens too, even with the person's yes to the pixelmailjet-restversionsApiRateLimitErrorcatch stays, and the send keeps PostHog's own retries, with a plan note that Mailjet's client retried a 500, 502 or 504; 1.7.x raises on a 401; only a lockfile or exact pin names the version, and an unknown one keeps the Python sites.requestthird argument and 3.xperform_api_callon a call that keeps it, a PHPpostthat makes no call, Rubyperform_api_call, Pythondry_runand .NETisSandboxModekeep the site, likeSandboxModenetwork_errorwhere the old code let a network failure throughdefaultthat can getfalsein a PostHog templatedefaultreplacesfalseand Mailjet's doesn'tapi.us.mailjet.comin a URL or in the client's host setting, and every account request uses that hostbounce, the one reason that blocks a moved sendHTMLPartwith no text parttext/plainpart, checked per Mailjet account and Send API version, since Mailjet's docs don't say whether it makes one; otherwiseturns the plain-text part offRetry-Afterread moves to PostHog's retry delay; a read of any other header keeps the site, since PostHog's answer carries no headers (ReviewHog onbacb274)main: only the Mailjet bundle and its menu entries change. Live run and prod-shape, recorded as gaps until the SDK releasesInvolvement: qa-swarm round 1 at
78a678a(fresh-eyes, correctness, risk, design, anti-overengineering, sweep, and the team lensesreview-hog-perspective-michaelandreview-hog-perspective-analytics-instrumentation), round 2 on the fixes at480e44e, final reads from7f6f215, and PostHog Review at47b2bcb(three findings, fixed in04c01b1and6095e4a)6095e4a(one finding, fixed in21f4681and411373e), and21f4681(one finding, fixed in411373eand13c8078); earlier rounds on older heads. Final pass after the core finished: forward merge of8ead8e1in38b22d9(no conflicts), convergence with the core's deadline, click, sensitive-template and report rules ined36b9e, and two-family final reads on it, with fixes in4c65f72,6fdde89and16ce22f, the last read clean. PostHog Review at16ce22f(three findings: two fixed inecc3ee1, the .NET one ine7aa12b). Second core merge of7ccc0eeine232970(no conflicts), reconciled with Step 7's network-failure and connect-limit rules ine7aa12b, with final reads fixed in3c6d4bd,058fa74,97989d5,ead2406,d7a0fe0,b1b6856and94c5c0c. Third core merge off658354infdfeff9(no conflicts), reconciled with Step 7's library-default and axios timeout rules and Step 3's untracked-click rule in969f0e2, with final reads fixed in77842d3and52776c0. Fourth core merge of17c6ca1inde6c6db(no conflicts), reconciled with Step 3's "Opens the provider didn't track" and the webhook rule for events with no PostHog event ind322359, with a final read fixed ina06f654. The quality judge ona06f654found that a .NETSendTransactionalEmailAsync400 withoutMessagesthrew where one withMessagesreturned; fixed inba8bd63, checked againstMailjetClient.SendTransactionalEmailsAsync. Fifth core merge of090ac92in298746b(no conflicts; its recurring re-import,project-getand test changes needed no Mailjet edit), final read 29 answered in the description. ReviewHog on298746b(two should-fix findings, the Ruby invalid-send paths and a partial axiosvalidateStatus), fixed ine109767, with final reads fixed in0106713,f71d5af,ab583f1andf4592ca, then ReviewHog onf4592ca(one should-fix finding, grouped template conditions), fixed inf23a81c, with final reads 35 to 38 fixed in9d574eb,6b42b8d,f15314aandf9f65f4, and final read 39's one nit fixed in this description. ReviewHog onf9f65f4: no findings. Main merge after #472 landed:f33a2c5merges #472's final head418cc5aand49e5f09merges main8cd7381(one add/add conflict in the shared skill test, where main's blob equals #472's, kept as the branch has it; the merge changes nothing), adapted to #472's final shared steps in3e31918(suppressionreason, Step 3's question, the empty text part, the click row), with final reads 40 to 42 fixed in822e35c,bf64763andbacb274, and final read 43's description finding fixed in this description. Gate onbacb274passed; ReviewHog onbacb274(one should-fix finding, the retry delay #472 added), fixed inaf12ccf, with final read 44's pointer nit fixed inf36e3edand its description finding fixed here. Final read 45 onf36e3ed: no findings; gate onf36e3edpassed; ReviewHog onf36e3ed: no findings. Proof: lane gate, shadow diff againstmainand CI at this head; the live run and prod-shape are gaps.🤖 Agent context
Agent: Claude Code, Claude Opus 5.5 (
claude-opus-5-5, high), as the migration-skills slice of Silthus/posthog#461. Reviews on GPT-6.1 Sol (high), the fresh-eyes lens on Opus 5.5; fixes on Opus 5.5 (high).🤖 Generated with Claude Code