Skip to content

feat(messaging): track transactional email status reads - #125312

Merged
trunk-io[bot] merged 1 commit into
masterfrom
posthog/messaging-email-status-read-tracking
Oct 29, 2026
Merged

trunk-io[bot] merged 1 commit into
masterfrom
posthog/messaging-email-status-read-tracking

Conversation

@mayteio

@mayteio mayteio commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

Problem

Changes

  • GET /api/projects/:id/messaging/emails/:message_id/ captures transactional email api status read on every read that reaches the lookup.
  • Properties: outcome (found or not_found), the returned status, and team_id, with the organization and project groups.
  • The event uses the project secret API key's synthetic user, like the send event, because report_user_action drops that user.
  • A capture failure only logs a warning. The read answers as before.
  • Each poll sends one event. If polling volume makes that too noisy, the next step is to capture only the first read of each message ID.

How did you test this code?

Test rationale: the dashboards that measure adoption depend on this event, so a refactor that drops it would break them silently. The existing found and 404 cases in test_transactional_email_status.py now also assert the event's properties, rather than adding a new test.

Ran locally: test_transactional_email_status.py, ruff and mypy on the view.

Release status

  • This change is behind a feature flag and is not available to users

Docs update

None.

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

Agent: PostHog Desktop (Claude Code), Claude Opus 5.5

  • Skills: /writing-tests, /writing-code-comments, /writing-pr-descriptions.
  • Part of the observability work before turning on the email status writes in PostHog/charts#18736.
  • Duplicate search: no open PR tracks status reads.
  • Public artifact: no session material is in the diff.

🤖 Generated with Claude Code


Created with PostHog Desktop

The status lookup captures `transactional email api status read` with `outcome` (found or not_found) and the `status` it returned, like the send endpoint's `transactional email api send`.

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

Generated-By: PostHog Desktop
Task-Id: e72a2c10-f145-4f7c-8754-a4fcc06a18be
@mayteio mayteio self-assigned this Oct 29, 2026
@trunk-io

trunk-io Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

😎 Merged successfully - details.

@github-actions

github-actions Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

🤖 CI report

⚠️ Trunk lane — backend Python lane

This PR is assigned to the backend Python lane. It runs backend Python tests and may merge in parallel with PRs in other lanes.

✅ Duplication (Python) — clean

New Python code duplication introduced by this branch. Fails at 70+ tokens in app code, or 150+ tokens when both copies live in test files. Advisory while the gate proves itself: extract a shared helper instead of copying.

✅ Duplication (TypeScript) — clean

New TypeScript code duplication introduced by this branch. Fails at 70+ tokens in app code, or 150+ tokens when both copies live in test files. Advisory while the gate proves itself: extract a shared helper instead of copying.

⚠️ Backend coverage — 88.0% of changed backend lines covered — 3 uncovered

🧪 Backend test coverage

Patch coverage — changed backend lines (products + core): ██████████████████░░ 88.0% (24 / 27)

File Patch Uncovered changed lines
products/messaging/backend/presentation/views/transactional_email_status.py 85.7% 134, 146–147

🤖 Agents: add a test only if an uncovered line exposes a realistic regression that existing tests miss. Otherwise explain why no new test is needed under "How did you test this code?". Gap list: the patch-coverage artifact on this run (gh run download 43734943511386 -n patch-coverage), or the coverage-data block at the end of this comment.

Per-product line coverage (touched products)
Product Coverage Lines
demo ███████████░░░░░░░░░ 56.4% 1,542 / 2,736
batch_exports ████████████████░░░░ 81.8% 23,036 / 28,171
engineering_analytics █████████████████░░░ 84.9% 11,484 / 13,521
commands █████████████████░░░ 85.5% 1,618 / 1,893
mcp_analytics █████████████████░░░ 86.3% 5,795 / 6,714
posthog_ai ██████████████████░░ 87.9% 4,296 / 4,886
notebooks ██████████████████░░ 88.5% 15,330 / 17,321
mcp_registry ██████████████████░░ 89.0% 1,596 / 1,794
dashboards ██████████████████░░ 89.4% 8,036 / 8,991
cohorts ██████████████████░░ 89.6% 8,556 / 9,547
product_tours ██████████████████░░ 89.7% 1,355 / 1,510
warehouse_suggestions ██████████████████░░ 89.9% 3,714 / 4,133
signals ██████████████████░░ 90.4% 92,992 / 102,913
today ██████████████████░░ 90.6% 3,546 / 3,912
tasks ██████████████████░░ 91.0% 81,264 / 89,274
managed_warehouse ██████████████████░░ 91.1% 12,410 / 13,626
data_warehouse ██████████████████░░ 91.2% 15,420 / 16,916
canvas ██████████████████░░ 91.2% 8,189 / 8,980
autoresearch ██████████████████░░ 91.4% 11,616 / 12,705
cdp ██████████████████░░ 91.4% 10,296 / 11,261
data_modeling ██████████████████░░ 91.7% 11,149 / 12,163
metrics ██████████████████░░ 91.7% 10,627 / 11,590
wizard ██████████████████░░ 91.7% 6,872 / 7,492
slack_app ██████████████████░░ 91.7% 21,755 / 23,715
business_knowledge ██████████████████░░ 91.8% 10,296 / 11,221
streamlit_apps ██████████████████░░ 91.9% 3,139 / 3,415
error_tracking ██████████████████░░ 92.2% 19,730 / 21,401
conversations ██████████████████░░ 92.3% 30,747 / 33,324
review_hog ██████████████████░░ 92.3% 18,059 / 19,562
early_access_features ███████████████████░ 92.6% 1,339 / 1,446
stamphog ███████████████████░ 92.6% 8,873 / 9,579
alerts_platform ███████████████████░ 92.8% 8,196 / 8,834
notifications ███████████████████░ 92.8% 1,218 / 1,312
alerts ███████████████████░ 92.9% 10,496 / 11,304
web_analytics ███████████████████░ 93.3% 26,193 / 28,069
cross_project_dashboards ███████████████████░ 93.4% 880 / 942
surveys ███████████████████░ 93.4% 6,941 / 7,429
exports ███████████████████░ 93.6% 4,191 / 4,479
messaging ███████████████████░ 93.6% 6,627 / 7,078
approvals ███████████████████░ 93.7% 4,994 / 5,331
workflows ███████████████████░ 93.8% 26,892 / 28,679
context_layer ███████████████████░ 93.8% 3,980 / 4,244
mcp_store ███████████████████░ 93.9% 9,188 / 9,784
marketing_analytics ███████████████████░ 93.9% 21,234 / 22,605
billing_alerts ███████████████████░ 94.0% 2,322 / 2,470
customer_analytics ███████████████████░ 94.0% 29,641 / 31,528
ai_observability ███████████████████░ 94.2% 29,695 / 31,535
replay_vision ███████████████████░ 94.3% 31,608 / 33,519
logs ███████████████████░ 94.5% 19,334 / 20,467
actions ███████████████████░ 94.7% 1,004 / 1,060
experiments ███████████████████░ 94.8% 41,243 / 43,528
reminders ███████████████████░ 94.8% 761 / 803
endpoints ███████████████████░ 94.9% 9,369 / 9,875
growth ███████████████████░ 94.9% 11,450 / 12,063
annotations ███████████████████░ 95.1% 1,095 / 1,151
skills ███████████████████░ 95.2% 7,630 / 8,015
access_control ███████████████████░ 95.5% 8,281 / 8,671
subscriptions ███████████████████░ 95.6% 13,657 / 14,293
data_catalog ███████████████████░ 95.7% 4,714 / 4,927
product_analytics ███████████████████░ 95.8% 29,948 / 31,276
revenue_analytics ███████████████████░ 95.9% 1,877 / 1,958
feature_flags ███████████████████░ 95.9% 29,130 / 30,374
data_quality ███████████████████░ 96.0% 8,561 / 8,915
tracing ███████████████████░ 96.4% 4,418 / 4,582
warehouse_sources ███████████████████░ 96.5% 485,325 / 502,832
account_audits ███████████████████░ 96.7% 770 / 796
pulse ███████████████████░ 97.1% 2,023 / 2,083
analytics_platform ████████████████████ 98.0% 2,855 / 2,912
groups ████████████████████ 98.2% 1,838 / 1,871

Report-only. Patch coverage = changed backend lines covered vs origin/master. Sorted lowest first.
Known gaps: lines covered only by Temporal tests show as uncovered; core line numbers may drift if master changed the same file.

@mayteio
mayteio marked this pull request as ready for review October 29, 2026 09:13
@parameterai

parameterai Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Risk: No findings

This change adds a transactional email api status read analytics event to the existing project-secret-key-authenticated email status endpoint, mirroring the send-side capture already in message_templates.py. The read path's auth, scoping, and 404 behavior are unchanged; the captured data (team_id, outcome, status, org/project groups) is not sensitive, and no new security surface is introduced.

Sentinel reviewed fa7bc83 · Review settings

@pr-assigner-resolver-posthog
pr-assigner-resolver-posthog Bot requested a review from a team October 29, 2026 09:14
@trunk-io

trunk-io Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Static Badge   Static Badge   Static Badge

View Full Report ↗︎ ⋅ Docs

@mayteio mayteio added the stamphog Request AI approval (no full review) label Oct 29, 2026

@stamphog stamphog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved.

The analytics write has owning-team and STRONG-familiarity author assurance, with assertions covering successful and unsuccessful reads. No unresolved review concerns or other refusal grounds were found.

  • Author wrote 100% of the modified lines and has 7 merged PRs in these paths (familiarity STRONG).
Gate mechanics and policy version
Gate Result
prerequisites ✓ all clear
deny-list ✓ no deny categories matched
size ✓ 41L, 1F substantive, 57L/2F incl. docs/generated/snapshots — within ceiling
tier ✓ T1-agent / T1b-small (57L, 2F, single-area, feat)
stamphog 2.6.1 .stamphog/policy.yml @ fa7bc83 · reviewed head fa7bc83

@trunk-io
trunk-io Bot merged commit 469d269 into master Oct 29, 2026
346 of 350 checks passed
@trunk-io
trunk-io Bot deleted the posthog/messaging-email-status-read-tracking branch October 29, 2026 11:11
@deployment-status-posthog

deployment-status-posthog Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Deploy status

Environment Status Deployed At Workflow
dev ✅ Deployed 2026-10-29 11:45 UTC Run
prod-us ✅ Deployed 2026-10-29 12:23 UTC Run
prod-eu ✅ Deployed 2026-10-29 12:32 UTC Run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stamphog Request AI approval (no full review)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant