Repository navigation
feat(analytics): ask about the email provider after install - #1508
Conversation
The codebase scan already finds email-sending services such as Resend. Set them on the person as wizard_detected_email_providers and wizard_detected_email_provider_at, through $set on the `warehouse sources detected` event. A $set captured before login is set again at identify, so it reaches the person who uses the PostHog app. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Set the person properties when the scan is shared after login, so CI, headless, warehouse and self-driving runs set them too, and drop the pre-login replay in Analytics. Count Campaign Monitor, ConvertKit, beehiiv and Drip as email providers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Read the new account's user after provisioning and identify it, as the OAuth login does, so a signup run's events and the detected email providers land on its person. A failed read keeps the signup. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A login without a user, such as a signup whose user could not be read, has no person to set them on. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An interactive install run whose scan found an email provider now asks one question after the outro: try sending email with PostHog Workflows? The answer goes out as `wizard: email provider offer answered` and is set on the person. Yes shows a link to Workflows in the project. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…entified A signup whose user read failed logs in without identifying the user, so the answer and its person properties would land on the anonymous person. The offer now also needs the session's user. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A Ctrl-C or signal after a successful run now waits for its analytics flush, so a slow network could hold the process after the terminal is restored. The signal path races the report against the same budget as a screen's exit request. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…l together The offer held provider kinds and labels in two arrays that had to stay in step. It now holds one non-empty list of kind and label pairs; the copy reads the labels and the events send the kinds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
🧙 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 Context Mill branch:
Add Results will be posted here when complete. |
…-offer Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rson Setting them on the person can track more than the user agreed to. Send the kinds once per run on `wizard: email providers detected` instead, after login and under the same sharing gates, and drop setPersonProperties. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…-offer # Conflicts: # src/services/codebase-scan/email-providers.ts
The answer already rides on `wizard: email provider offer answered`. Drop the $set of wizard_email_offer_answer and _answered_at, so the offer writes nothing to the person. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each attempt had its own 10-second timeout, so a stalled remote read ran about 32 seconds across its retries. Share one AbortSignal deadline across the attempts, and don't retry a cancelled request. Drop a duplicate assertion from the email provider event test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The 10-second deadline cancelled each request but not the wait between retries, so a late 503 plus 1.5 s of backoff ran past it. retryTransient now takes the signal, cuts its backoff short when it aborts, and throws the last failure. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nto feat/email-provider-offer
The question opens with the cursor on "Yes, show me how", so a quick second Enter meant for the outro answered yes before the question could be read, inflating the yes share the offer measures. The picker now ignores Enter for 500 ms after the question opens. Esc and arrow keys still work at once. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The question named the providers the scan found and its decline choice named the provider again. It now says what PostHog does, with no provider names: PostHog can send this app's transactional emails directly from code, with delivery and engagement events next to your product analytics. The decline choice is "No thanks". Detection and the analytics properties still carry the providers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Quoting a path for every shell kept leaving cases cmd.exe or PowerShell read differently. The screen now says where to run the email command, and the command carries only --project-id, so no shell parses the path. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An exported POSTHOG_WIZARD_INSTALL_DIR would point the command at another directory. It now ends in --install-dir=., which outranks the variable and needs no quoting, and the screen test builds its paths with path.join. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Count and take an answer only while the question is on screen, and only after a pause, so a held Enter or a too-small terminal can't answer it. - Print the email command and Workflows link in the exit summary after yes. - Carry the run's --base-url into the email command. - Report a Ctrl-C's cancelled run without a time limit; give only the final flush the budget. - Test delivery at the ingestion boundary instead of mocking the client. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Wait a full second before the question takes an answer, longer than a held key's first repeat on default desktop settings. - Pass --base-url unchanged, path included, and single-quote it when a shell could expand it. - Show control characters in the directory name as "?". - Check that a stalled Ctrl-C report exits within its budget. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Keep --base-url in the command only when no shell can expand it, and otherwise ask in text to add the one this run used. Trim it first, as host resolution does. - Show a directory name with control characters escaped, so it can't read as a different directory. - Let Esc skip at once; it can only decline, so it needs no read guard. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This reverts commit 9bc725b. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This reverts commit b089312. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
"Yes" shows the full `email --project-id N --install-dir=.` command only when the run had no --base-url and the install directory's name is plain text: letters, accents and digits in any script, a plain space, and the punctuation paths use. Otherwise it shows the Workflows link and names the `email` command without flags, so nothing the user supplied is printed into a command. Brings back the 1 s read guard, Esc that skips at once, the visibility checks, the exit summary, and the stalled Ctrl-C test's deadline from the reverted fixes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
314e18d to
8ee245c
Compare
The command keeps `--project-id` and `--install-dir=.` on every branch: neither comes from the user, and without them an exported install dir or a different project grant could send the email run elsewhere. Only the line above it changes for a pinned or non-plain run. The Workflows link is built by parsing the app host, which drops credentials and line breaks from a pinned URL; a host that doesn't parse means no offer. A blank --base-url pins nothing, as in host resolution. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
8ee245c to
4038df1
Compare
|
✅ Security review complete — No findings above the confidence threshold, in 6 min. Add the |
The email provider offer is now the last screen of the default flow. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
edwinyjlim
left a comment
There was a problem hiding this comment.
good to go. i moved the email screen after the MCP install which takes priority rn
i think we can come up with a better email conversion flow, but let's get it in the wizard for v1
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The quick-Enter test still passed with the read guard switched off: its one press landed before the picker mounted. Hold Enter through the MCP-to-offer transition instead, then show the picker takes a key after a pause. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Still owed after merge:
|
Problem
The Wizard's scan finds the email service a developer's app sends with, such as Resend. Nothing asks them whether they would send that email from PostHog instead, so we can't tell how many would, or point the ones who would at a way to start.
With this PR, an interactive install that found an email provider can ask one question as the run's last step, after the MCP step: "PostHog can send this app's transactional emails directly from code, with delivery and engagement events next to your product analytics. Want to try it?" "Yes" points at the Wizard's new
emailcommand (#1507), which sets up that first send. The answer goes on an analytics event, and nothing is set on the person. The question only shows while the flagwizard-email-provider-offeris on for the run, and the flag is at 0%.Impact
emailcommand.wizard: email provider offer answeredbyanswer, joined on the person to atransactional-emailrun within 7 days. The insight is owed at rollout, once the flag is widened.Merge risk
Note
🔵 Merge risk: low · two-way door (merge-risk rubric)
wizard-email-provider-offeronly when both hold:workflows-email-from-codeis at 100% (it is, as of 18 Nov), and the npmlatestWizard runsemail(2.97.0 or later). Before that, "Yes" names a command the published package doesn't have.mainthey wait for the run stream andanalytics.shutdown('cancelled'), then unmount the TUI and exit. Here they unmount first, then also flush the events captured after the run report, for at most 2 seconds, before they exit.$feature/wizard-email-provider-offer: falseon each wizard event, plus a$feature_flag_calledevent, the same as every other Wizard flag. It is additive analytics and stops when the key is removed.--project-idstill keeps it on the same project.wizard-email-provider-offerto off; the step and its events stop on the next run. The signal-order change has no switch; fix forward.Tier: non-critical
Changes
When it asks (
emailProviderOfferinsrc/programs/posthog-integration/email-provider-offer.ts): the flag is'true'in the run's cached flag snapshot, the run is interactive and not--ci, the run identified the user, scan results may be shared, the outro reports success, and the scan found an email provider (detectedEmailProvidersfrom feat(analytics): report detected email providers and identify signup runs #1506). Otherwise the step never shows. A flag that is off, missing or failed to load means no question, and the run never waits on it.The question (
EmailProviderOfferScreen, a newemail-provider-offerstep, the run's last, after the MCP step): "Yes, show me how", "Not now", "No thanks". It asks once per run. Every answer ends the run, and after "Yes" the next key does.skipped.After "Yes":
--project-idkeeps the email run on the project this install used, and--install-dir=.outranks an exportedPOSTHOG_WIZARD_INSTALL_DIR. Neither comes from the user, so both stay on every run.._-/\:@+,~'(). A directory with any other character, or a run pinned with--base-url, gets "Run this in your app" (plus "adding the --base-url this run used"). Nothing the user typed is printed into the command.Events, through
wizardCapture:wizard: email provider offer shownwithproviders(every detected kind), andwizard: email provider offer answeredwithprovidersandanswer(yes,not_now,no,skipped). Neither sets anything on the person.Ctrl-C and signals deliver the answer (
src/tui/run.ts): after a successful run the run report has already gone out, so the process could exit before askippedevent left. The signal handler now unmounts first, then awaits the shutdown and a flush, within the 2-second report budget.Test plan
Gates on
88b08b32:pnpm typecheckgreen,pnpm lintwith no errors, and the full suite green (297 files, 4555 tests) apart from the known cold-import timeout incli.test.ts"accepts us as a valid region", which passed on rerun (44 of 44).New and changed tests, each red when its line is broken:
email-setup-command.test.ts: the full command on every branch; the directory named for a subdirectory, an outside path, decomposed accents and..web; no directory for control, bidi, line-separator,$(…), backtick, no-break-space or emoji names; no URL and no directory for a pinned run.email-provider-offer.test.ts: a blank--base-urlpins nothing; the Workflows link on a pinned instance drops credentials and line breaks and keeps IPv6; an unparseable host means no offer.EmailProviderOfferScreen.test.tsx: what the person sees after "Yes" and in the exit summary for a plain run, a pinned run with credentials, and a non-plain directory; Enter ignored for the first second; Esc at once; an Enter held from the previous screen with a first repeat at 700 ms never answers yes; Enter held through the real MCP step into the question never answers yes, and fails the test with the guard off; a hidden question counts and takes nothing.run-offer-delivery.test.tsx: throughrunTuiand the realAnalyticswith a recording transport, a Ctrl-C on the question deliversskipped, and a stalled ingestion still exits within the 2-second budget.Wizard walk on
d67e4faf, 19 Nov, with the question after the MCP step. The commits since change only tests. The real interactive Wizard ran in a PTY, launched from the parent ofapps/web, with a real agent install into a Next.js app that sends withresend, in a sandbox project. The MCP step was answered with real Enter presses. One install per row:shown,answeredyesshown,answerednot_nowshown,answerednoshown,answeredskippedshown,answeredskippedshown,answerednot_nowEvery event carried
providers: ["Resend"]and nothing in$setbeyond$app_name. The Enter that left the MCP step never answered the question.Two rows come from the 18 Nov walk on
4038df17, before the reorder. The screen code they exercise is unchanged since:shownonly once visible,answerednot_nowshown,answeredyesThe other answers, and the 18 Nov rows
Known issues
Accepted under Michael's stop rule for this PR (2026-11-18, "Command only when plain (Recommended)"): after the last read, majors and below are listed here, not fixed.
src/tui/programs/posthog-integration/screens/EmailProviderOfferScreen.tsx:103: a held Enter whose first key repeat comes 1 second or more after the press can still answer yes. No terminal input reports a key release, so any guard has a threshold. Michael accepted this limit.src/tui/programs/posthog-integration/email-setup-command.ts:48: when the directory can't be shown, or the run was pinned, "Run this in your app" doesn't name the directory. Someone who pastes from a monorepo root still has to change into the app first.src/programs/posthog-integration/email-provider-offer.ts:46: a parseable non-web pinned URL, such asfile:, passes the link check. A run only reaches the offer after its API calls to that host succeeded.src/programs/posthog-integration/email-provider-offer.ts:44: the comment credits parsing for clearing credentials, which the two assignments below it do.src/tui/programs/posthog-integration/screens/EmailProviderOfferScreen.tsx:150: while a too-small terminal hides the question, arrow keys still move the highlighted choice, so a different one can be highlighted after the resize. Answering still needs Enter on the visible question.src/tui/programs/posthog-integration/screens/EmailProviderOfferScreen.tsx:170: the setup lines after "Yes" can be dismissed by any key while a too-small terminal hides them. They stay in the exit summary.src/tui/programs/posthog-integration/screens/__tests__/EmailProviderOfferScreen.test.tsx:250: the pinned-run and non-plain cases check the exit summary through the formatter, not through the host's scrollback. The walk checked scrollback on a plain and a non-plain run, not a pinned one.src/tui/__tests__/run-offer-delivery.test.tsx:136: the Ctrl-C test takes the interrupt from a mocked mount, not a real one.src/tui/__tests__/run-offer-delivery.test.tsx:195: the stalled-ingestion test checks only that the exit comes within the budget, so it would also pass if the host exited before trying the flush.LLM context
Agent context, decisions and involvement
Built by Claude Code, Claude Opus 5.5 (
claude-opus-5-5), first as lanewiz-offerof the Wizard email map. The 18 Nov revision is a takeover by the same model.migratefamilyemailcommand for this project, with Workflows as the other way in--base-urland a plain directory name, by a strict allowlist; otherwise "Run this in your app". Rejected: quoting the path or the URL per shell, which three review rounds kept breaking--project-idand--install-dir=.aren't user-supplied, and without them the run can land in another app or projectd67e4faf, kept as the reviewing team's choice;88b08b32adds a test that Enter held from the MCP step can't answerd67e4faf88b08b32?main's #1506 keeps it on signup only; a follow-upAnalytics.shutdownto always flush?Involvement: no grilling rounds, no prototypes. Reviews: two fleet panels and three full-diff reads on the fork (GPT-6.1 Sol and Claude Opus 5.5). On 18 Nov, five GPT-6.2 Sol rounds and one final read. Valid blockers and majors were fixed test-first through round 4. Two fix commits whose round-3 blockers came back were reverted, Michael chose the design, and round 5 closed under his stop rule. On 19 Nov, Edwin Lim (team-wizard-docs) moved the question after the MCP step and updated the tests to match.
Follow-ups:
Analytics.shutdowncould always flush, which would let the TUI host drop its extra flush.mainlacks.cli.test.ts"accepts us as a valid region" sits near its 5-second timeout on a cold import.🤖 Generated with Claude Code
How did you test this code?
88b08b3(reused fromd67e4fa)88b08b3(reused fromd67e4fa)88b08b3(reused from4038df1)eecdaa8to4038df188b08b3Not checked: none recorded
Full receipt (PostHog team): https://artifacts.posthog.com/a/N1lGBCZjnxrHDDc0Y5dgsZ