Repository navigation
feat(alerts): cut over insight alerts that use the investigation agent - #127926
trunk-io[bot] merged 17 commits into
Conversation
The platform now runs the investigation agent and the metrics investigation for the insight alerts it owns, so the per-team cutover no longer skips an alert with the agent on, and an edit that turns the agent on stays on the platform. Real-time alerts still stay with the insight stack. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
🤖 CI report
|
| File | Patch | Uncovered changed lines |
|---|---|---|
products/alerts/backend/platform_ownership.py |
0.0% | 62 |
products/alerts_platform/backend/facade/testing.py |
50.0% | 258 |
products/alerts_platform/backend/facade/api.py |
50.0% | 94 |
products/alerts_platform/backend/logic/delivery_holds.py |
57.1% | 196–198 |
products/alerts/backend/platform_cutover.py |
91.7% | 168 |
🤖 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 334446966888636 -n patch-coverage), or the coverage-data block at the end of this comment.
Per-product line coverage (touched products)
| Product | Coverage | Lines |
|---|---|---|
knowledge_writer |
█░░░░░░░░░░░░░░░░░░░ 4.8% |
5 / 105 |
platform_features |
██░░░░░░░░░░░░░░░░░░ 12.1% |
7 / 58 |
data_tools |
████████████░░░░░░░░ 60.9% |
95 / 156 |
warehouse_sources_queue |
█████████████░░░░░░░ 65.2% |
2,161 / 3,314 |
demo |
██████████████░░░░░░ 71.2% |
1,979 / 2,778 |
batch_exports |
████████████████░░░░ 82.2% |
23,536 / 28,622 |
engineering_analytics |
█████████████████░░░ 84.9% |
11,753 / 13,841 |
commands |
█████████████████░░░ 85.4% |
1,621 / 1,898 |
ml_inference |
█████████████████░░░ 86.3% |
524 / 607 |
mcp_analytics |
█████████████████░░░ 86.3% |
5,812 / 6,731 |
posthog_ai |
██████████████████░░ 87.9% |
4,303 / 4,895 |
apm |
██████████████████░░ 88.2% |
1,973 / 2,236 |
notebooks |
██████████████████░░ 88.8% |
15,454 / 17,407 |
mcp_registry |
██████████████████░░ 89.0% |
1,596 / 1,794 |
dashboards |
██████████████████░░ 89.4% |
8,048 / 9,003 |
product_tours |
██████████████████░░ 89.7% |
1,355 / 1,510 |
warehouse_suggestions |
██████████████████░░ 90.1% |
3,836 / 4,257 |
cohorts |
██████████████████░░ 90.1% |
9,032 / 10,021 |
signals |
██████████████████░░ 90.7% |
101,663 / 112,105 |
visual_review |
██████████████████░░ 90.7% |
9,849 / 10,860 |
today |
██████████████████░░ 91.1% |
3,907 / 4,291 |
canvas |
██████████████████░░ 91.2% |
8,199 / 8,988 |
tasks |
██████████████████░░ 91.3% |
82,241 / 90,102 |
managed_warehouse |
██████████████████░░ 91.3% |
12,839 / 14,066 |
data_warehouse |
██████████████████░░ 91.3% |
15,840 / 17,343 |
data_modeling |
██████████████████░░ 91.4% |
11,664 / 12,757 |
autoresearch |
██████████████████░░ 91.5% |
11,717 / 12,805 |
cdp |
██████████████████░░ 91.5% |
10,433 / 11,399 |
metrics |
██████████████████░░ 91.7% |
11,255 / 12,275 |
slack_app |
██████████████████░░ 91.8% |
22,406 / 24,401 |
wizard |
██████████████████░░ 91.8% |
6,908 / 7,521 |
streamlit_apps |
██████████████████░░ 91.9% |
3,139 / 3,415 |
business_knowledge |
██████████████████░░ 92.0% |
10,556 / 11,476 |
review_hog |
██████████████████░░ 92.3% |
17,768 / 19,256 |
conversations |
██████████████████░░ 92.3% |
31,161 / 33,749 |
stamphog |
███████████████████░ 92.6% |
9,009 / 9,733 |
early_access_features |
███████████████████░ 92.6% |
1,339 / 1,446 |
error_tracking |
███████████████████░ 92.6% |
20,656 / 22,305 |
alerts_platform |
███████████████████░ 92.6% |
8,632 / 9,317 |
notifications |
███████████████████░ 92.8% |
1,218 / 1,312 |
alerts |
███████████████████░ 93.1% |
11,701 / 12,574 |
surveys |
███████████████████░ 93.3% |
7,256 / 7,780 |
webmcp |
███████████████████░ 93.3% |
277 / 297 |
ai_training |
███████████████████░ 93.3% |
598 / 641 |
web_analytics |
███████████████████░ 93.4% |
26,472 / 28,347 |
aeo |
███████████████████░ 93.4% |
2,312 / 2,475 |
ai_gateway |
███████████████████░ 93.6% |
787 / 841 |
approvals |
███████████████████░ 93.7% |
5,004 / 5,341 |
marketing_analytics |
███████████████████░ 93.8% |
22,043 / 23,512 |
context_layer |
███████████████████░ 93.8% |
3,984 / 4,247 |
messaging |
███████████████████░ 93.8% |
7,016 / 7,478 |
exports |
███████████████████░ 93.9% |
4,320 / 4,603 |
cross_project_dashboards |
███████████████████░ 93.9% |
858 / 914 |
workflows |
███████████████████░ 93.9% |
27,562 / 29,360 |
mcp_store |
███████████████████░ 93.9% |
9,193 / 9,789 |
ai_observability |
███████████████████░ 93.9% |
32,846 / 34,965 |
authorization |
███████████████████░ 94.0% |
671 / 714 |
billing_alerts |
███████████████████░ 94.0% |
2,322 / 2,470 |
customer_analytics |
███████████████████░ 94.1% |
30,487 / 32,403 |
managed_migrations |
███████████████████░ 94.1% |
1,877 / 1,994 |
replay_vision |
███████████████████░ 94.4% |
33,354 / 35,345 |
legal_documents |
███████████████████░ 94.4% |
2,313 / 2,451 |
logs |
███████████████████░ 94.5% |
19,437 / 20,572 |
experiments |
███████████████████░ 94.7% |
44,228 / 46,715 |
reminders |
███████████████████░ 94.8% |
782 / 825 |
actions |
███████████████████░ 94.9% |
997 / 1,051 |
endpoints |
███████████████████░ 94.9% |
9,610 / 10,123 |
growth |
███████████████████░ 95.0% |
11,563 / 12,176 |
warehouse_sources |
███████████████████░ 95.0% |
156,303 / 164,494 |
annotations |
███████████████████░ 95.1% |
1,097 / 1,153 |
skills |
███████████████████░ 95.2% |
7,633 / 8,018 |
uptime_monitoring |
███████████████████░ 95.3% |
306 / 321 |
access_control |
███████████████████░ 95.5% |
8,395 / 8,794 |
data_catalog |
███████████████████░ 95.7% |
4,714 / 4,928 |
subscriptions |
███████████████████░ 95.7% |
14,017 / 14,651 |
product_analytics |
███████████████████░ 95.8% |
30,387 / 31,726 |
feature_flags |
███████████████████░ 95.8% |
29,654 / 30,953 |
revenue_analytics |
███████████████████░ 95.9% |
1,877 / 1,958 |
data_quality |
███████████████████░ 96.0% |
8,561 / 8,915 |
tracing |
███████████████████░ 96.5% |
4,572 / 4,737 |
account_audits |
███████████████████░ 96.7% |
770 / 796 |
security |
███████████████████░ 96.8% |
1,597 / 1,650 |
pulse |
███████████████████░ 97.3% |
2,036 / 2,093 |
analytics_platform |
████████████████████ 98.0% |
2,879 / 2,939 |
groups |
████████████████████ 98.3% |
1,862 / 1,895 |
field_notes |
████████████████████ 99.4% |
172 / 173 |
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.
✅ Django migration risk — migration analysis complete
We've analyzed your migrations for potential risks.
Summary: 1 Safe | 0 Needs Review | 0 Blocked
✅ Safe
Brief or no lock, backwards compatible
alerts.0016_insight_alert_investigation_age_index
└─ #1 ✅ SafeAddIndexConcurrently
PostHog concurrent-index helper: idempotent (timeout disabling + invalid-leftover recovery)
model: insightalertinvestigation, index: insight_alert_inv_age_idx
Last updated: 2026-11-04 01:24 UTC (65de5a1)
There was a problem hiding this comment.
PostHog Review · Standard · reviewed ad115f3: 2 Should fix.
This is the only automatic review while this pull request is a draft. Comment @posthog review to review new changes sooner. Otherwise, a review of the new changes runs when you mark it ready for review.
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.
…-investigation-cutover
…-investigation-cutover
|
Risk: No findings This increment adds an Sentinel reviewed |
…-investigation-cutover # Conflicts: # products/alerts/backend/platform_cutover.py # products/alerts/backend/platform_ownership.py # products/alerts/backend/test/test_platform_cutover.py
…-investigation-cutover
An alert whose insight-stack agent still runs, or whose held notification is neither sent nor suppressed, now stays with the insight stack. Moved earlier, that notification could not go out, and the platform would start a second agent for the next firing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…-investigation-cutover
There was a problem hiding this comment.
Not approved — this change needs a human reviewer.
Re-add the stamphog label to request another review once you have addressed this.
The author has owning-team membership and strong familiarity, but the current-head review retains substantive concerns confirmed in the checkout. Address the notification-loss, overlapping-investigation, and missing-history threads with @PostHog/team-apm before re-requesting.
- Author wrote 100% of the modified lines and has 25 merged PRs in these paths (familiarity STRONG).
- PostHog Review (Standard) reviewed the current head: 2 findings, posted on the PR.
- posthog[bot] reviewed the current head.
- @PostHog, products/alerts/backend/platform_cutover.py: Pending legacy notifications can be lost during handover. The cutover checks current firing state and owed evaluations but not outstanding investigation deliveries; posthog/tasks/alerts/utils.py:656-663 rejects legacy notification dispatch after platform ownership changes. Defer handover until legacy deliveries settle and address this thread before re-requesting.
- @PostHog and @parameterai, products/alerts/backend/platform_cutover.py: Handover still permits an unresolved legacy investigation to overlap a new platform investigation. products/alerts/backend/platform_investigation.py:131-137 checks only InsightAlertInvestigation, whereas posthog/temporal/alerts/investigation.py:119-122 checks only AlertCheck. Add an in-flight investigation handover guard or cross-stack coordination and address these threads before re-requesting.
- @PostHog, outdated thread on products/alerts/backend/platform_cutover.py: Investigation results remain absent from moved-alert history. products/alerts/backend/platform_alert_reads.py builds history without joining investigation rows, and products/alerts/backend/presentation/views/alert.py:1500-1518 does not populate investigation fields. Land the history integration identified in the thread and verify it in the reviewed checkout before re-requesting; the author's promise to wait does not resolve the concern.
Gate mechanics and policy version
| Gate | Result | |
|---|---|---|
| prerequisites | ✓ | all clear |
| deny-list | ✓ | no deny categories matched |
| size | ✓ | 14L, 2F substantive, 20L/3F incl. docs/generated/snapshots — within ceiling |
| tier | ✓ | T1-agent / T1a-trivial (20L, 3F, single-area, feat) |
| stamphog 2.7.0 | .stamphog/policy.yml @ 5a846d7 · reviewed head 5a846d7 |
…-investigation-cutover
…-investigation-cutover
There was a problem hiding this comment.
Not approved — this change needs a human reviewer.
Re-add the stamphog label to request another review once you have addressed this.
Owning-team authorship and strong familiarity provide assurance for the risky changes, but @PostHog's investigation-history concern remains present in the current checkout. Land the history fix and request verification from @PostHog/team-apm before re-requesting.
- Author wrote 100% of the modified lines and has 25 merged PRs in these paths (familiarity STRONG).
- @PostHog on products/alerts/backend/platform_cutover.py: the investigation-history concern remains unfixed. products/alerts/backend/platform_alert_reads.py builds moved history without reading InsightAlertInvestigation, and presentation/views/alert.py::_as_alert_check does not populate investigation results. Land the history hydration fix and have the reviewer verify it before re-requesting; the author's promise to defer team cutovers does not resolve the concern.
Gate mechanics and policy version
| Gate | Result | |
|---|---|---|
| prerequisites | ✓ | all clear |
| deny-list | ✓ | no deny categories matched |
| size | ✓ | 41L, 2F substantive, 85L/3F incl. docs/generated/snapshots — within ceiling |
| tier | ✓ | T1-agent / T1b-small (85L, 3F, single-area, feat) |
| stamphog 2.7.0 | .stamphog/policy.yml @ 673732a · reviewed head 673732a |
…275c09' into jimmy/insight-investigation-cutover
There was a problem hiding this comment.
Approved.
The change enters alert ownership write paths, with assurance supplied by owning-team authorship and STRONG familiarity plus focused tests. The older reviews provide no concrete concerns to verify, and no unresolved substantive concern is evidenced in the supplied context.
- Author wrote 100% of the modified lines and has 24 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, 2F substantive, 85L/3F incl. docs/generated/snapshots — within ceiling |
| tier | ✓ | T1-agent / T1b-small (85L, 3F, single-area, feat) |
| stamphog 2.7.0 | .stamphog/policy.yml @ a14ffc3 · reviewed head a14ffc3 |
|
/trunk merge |
|
😎 Stack merged successfully - details. |
|
/trunk merge |
Problem
Changes
Note
This PR moves no alert by itself. The cutover command moves one team at a time.
can_movekeeps neither gate.How did you test this code?
Test rationale: the moved-alert case for an agent-on alert replaces the skip case, so a reintroduced gate fails it.
Ran the cutover and alert API suites locally.
Release status
Docs update
🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Agent: Claude Code, Claude Opus 5.5 (
claude-opus-5-5)Skills:
/writing-tests,/writing-code-comments,/writing-user-facing-copy,/stacking-prs,/reviewing-with-coderabbit,/simplify,/code-review,/writing-pr-descriptions🤖 Generated with Claude Code