:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(signals): show what and impact in inbox slack notifications (#125162)
Dylan Martin33c4b20e2c2a
diff --git a/products/signals/backend/slack_inbox_notifications.py b/products/signals/backend/slack_inbox_notifications.pyindex 4ed5a6ecbaa0..a1a15c48521d 100644--- a/products/signals/backend/slack_inbox_notifications.py+++ b/products/signals/backend/slack_inbox_notifications.py@@ -15,6 +15,7 @@ All sends are best-effort.from __future__ import annotations+import reimport jsonimport loggingfrom collections.abc import Callable, Collection, Iterable@@ -37,7 +38,6 @@ from posthog.slack.formatting import (from posthog.slack.markdown import slack_markdown_block as _markdown_blockfrom products.signals.backend.assignment_flags import assignment_side_effects_allowed-from products.signals.backend.enums import SIGNAL_SOURCE_PRODUCT_LABELSfrom products.signals.backend.models import (AutonomyPriority,SignalReport,@@ -91,18 +91,11 @@ _PRIORITY_ORDER: tuple[str, ...] = (AutonomyPriority.P4,)-# Only the two highest priorities get a red, alarming emoji; the rest use a calmer severity gradient.-_SLACK_PRIORITY_LABELS: dict[str, str] = {- AutonomyPriority.P0: "‼️ P0",- AutonomyPriority.P1: "❗ P1",- AutonomyPriority.P2: "🟠 P2",- AutonomyPriority.P3: "🟡 P3",- AutonomyPriority.P4: "🔵 P4",-}--_SOURCE_PRODUCT_LABELS: dict[str, str] = {- product.value: label for product, label in SIGNAL_SOURCE_PRODUCT_LABELS.items()-}+# Report titles are PR-style ("fix(scope): Description"). The inbox shows only the description, so+# Slack does too. Keep in sync with CONVENTIONAL_COMMIT_TITLE in frontend/inbox/utils/reportPresentation.ts.+_CONVENTIONAL_COMMIT_TITLE = re.compile(r"^(\w+)(?:\(([^)]*)\))?!?:\s*(.+)$")+# Matches only a heading named exactly "Impact", so "## Expected impact" stays out.+_IMPACT_SECTION = re.compile(r"(?ms)^## Impact[ \t]*\n(.*?)(?=^#{1,2} |\Z)")def _priority_rank(value: str | None) -> int | None:@@ -114,10 +107,6 @@ def _priority_rank(value: str | None) -> int | None:return None-def _slack_priority_label(value: str) -> str:- return _SLACK_PRIORITY_LABELS.get(value, value)--def _meets_min_priority(report_priority: str | None, min_priority: str | None) -> bool:"""Whether a report with the given priority meets the user's min-priority threshold.@@ -304,11 +293,13 @@ def _resolve_reviewer_mentions(slack: SlackIntegration, reviewer_users: list[Usereturn mentions-def _format_source_product_labels(source_products: list[str]) -> str:- if not source_products:- return ""- labels = [_SOURCE_PRODUCT_LABELS.get(product, product.replace("_", " ").title()) for product in source_products]- return ", ".join(labels)+def _cap_excerpt(text: str) -> str:+ if len(text) <= _SUMMARY_EXCERPT_MAX_LEN:+ return text+ text = markdown_links_to_labels(text)+ if len(text) <= _SUMMARY_EXCERPT_MAX_LEN:+ return text+ return text[: _SUMMARY_EXCERPT_MAX_LEN - 3].rstrip() + "..."def _summary_excerpt(summary: str) -> str:@@ -319,45 +310,47 @@ def _summary_excerpt(summary: str) -> str:first_line = text.splitlines()[0].strip()if not first_line:return ""- if len(first_line) <= _SUMMARY_EXCERPT_MAX_LEN:- return first_line- first_line = markdown_links_to_labels(first_line)- if len(first_line) <= _SUMMARY_EXCERPT_MAX_LEN:- return first_line- return first_line[: _SUMMARY_EXCERPT_MAX_LEN - 3].rstrip() + "..."+ return _cap_excerpt(first_line)-def _build_message_blocks(- report: SignalReport,- *,- priority: str | None,- source_products: list[str],- reviewer_mentions: list[str],- repository: str | None = None,-) -> tuple[list[dict], str]:- title_line = report.title or "New report"+def _impact_excerpt(summary: str) -> str:+ """First paragraph of the summary's `## Impact` section, capped at 600 characters."""+ match = _IMPACT_SECTION.search(summary)+ if match is None:+ return ""+ section = match.group(1).strip()+ if not section:+ return ""+ first_paragraph = re.split(r"\n\s*\n", section, maxsplit=1)[0]+ return _cap_excerpt(" ".join(line.strip() for line in first_paragraph.splitlines()))+++def _display_title(title: str | None) -> str:+ title = (title or "").strip()+ if not title:+ return "New report"+ match = _CONVENTIONAL_COMMIT_TITLE.match(title)+ description = match.group(3).strip() if match else ""+ return description or title+++def _build_message_blocks(report: SignalReport, *, reviewer_mentions: list[str]) -> tuple[list[dict], str]:+ title_line = _display_title(report.title)header_text = (title_line if len(title_line) <= _SLACK_HEADER_MAX_LEN else title_line[: _SLACK_HEADER_MAX_LEN - 3] + "...")- meta_parts: list[str] = []- if priority:- meta_parts.append(_slack_priority_label(priority))- sources_line = _format_source_product_labels(source_products)- if sources_line:- meta_parts.append(sources_line)- if repository:- meta_parts.append(repository)-# The body is escaped once as a whole below, so the LLM-derived parts assembled here stay raw.# The `**` this adds is the one piece of Markdown the message means, and escaping leaves it be.body_parts: list[str] = []- if meta_parts:- body_parts.append(f"**{' · '.join(meta_parts)}**")# Strip before excerpting so truncation can't slice a chart link mid-syntax.- summary_text = _summary_excerpt(_strip_chart_references(report.summary or ""))+ summary = _strip_chart_references(report.summary or "")+ summary_text = _summary_excerpt(summary)if summary_text:body_parts.append(summary_text)+ impact_text = _impact_excerpt(summary)+ if impact_text:+ body_parts.append(f"**Impact:** {impact_text}")if not body_parts:body_parts.append(f"**{title_line}**")@@ -366,18 +359,13 @@ def _build_message_blocks(_markdown_block(_prepare_markdown("\n\n".join(body_parts))),]- # Reviewer mentions sit in the context line — they still carry the `<@U…>` token so Slack pings them.- context_parts: list[str] = []- if report.signal_count:- signal_label = "signal" if report.signal_count == 1 else "signals"- context_parts.append(f"{report.signal_count} {signal_label}")+ # Mentions sit in mrkdwn, not plain_text, so the `<@U…>` token still pings the owner.if reviewer_mentions:- context_parts.append(f"👤 Suggested reviewers: {' '.join(reviewer_mentions)}")- if context_parts:+ owner_label = "Suggested owner" if len(reviewer_mentions) == 1 else "Suggested owners"blocks.append({"type": "context",- "elements": [{"type": "mrkdwn", "text": " · ".join(context_parts)}],+ "elements": [{"type": "mrkdwn", "text": f"👤 {owner_label}: {' '.join(reviewer_mentions)}"}],})@@ -390,9 +378,7 @@ def _build_message_blocks(]blocks.append({"type": "actions", "elements": action_elements})- priority_suffix = f" ({priority})" if priority else ""- fallback_text = f"Report{priority_suffix}: {_escape_mrkdwn(title_line)}"- return blocks, fallback_text+ return blocks, _escape_mrkdwn(title_line)# Bound how many evidence signals we post into a thread so a large report can't flood a channel.@@ -672,9 +658,6 @@ def _deliver_route_notification(report: SignalReport,route: _ChannelRoute,*,- priority: str | None,- source_products: list[str],- repository: str | None,trigger: str,signals: list[dict] | None = None,) -> bool:@@ -701,13 +684,7 @@ def _deliver_route_notification(return False# The only reviewer a direct message could mention is the person already reading it.mentions = [] if route.is_direct_message else _resolve_reviewer_mentions(slack, route.users)- blocks, text = _build_message_blocks(- report,- priority=priority,- source_products=source_products,- reviewer_mentions=mentions,- repository=repository,- )+ blocks, text = _build_message_blocks(report, reviewer_mentions=mentions)# Added here rather than inside the block builder, which stays free of the integration so it# can be tested without one. Approval is read now, not assumed from generation time: a# reviewer can be added to a retained report after the org revoked it.@@ -746,24 +723,13 @@ def _deliver_to_routes(report: SignalReport,routes: list[_ChannelRoute],*,- priority: str | None,- source_products: list[str] | None,trigger: str,signals: list[dict] | None = None,) -> int:"""Post the report to every route, returning how many top-level messages were sent."""- repository = report.selected_repository()sent = 0for route in routes:- if _deliver_route_notification(- report,- route,- priority=priority,- source_products=source_products or [],- repository=repository,- trigger=trigger,- signals=signals,- ):+ if _deliver_route_notification(report, route, trigger=trigger, signals=signals):sent += 1return sent@@ -803,7 +769,6 @@ def _capture_notification_delivered(def dispatch_inbox_item_notifications(report_id: str,team_id: int,- source_products: list[str] | None = None,signals: list[dict] | None = None,) -> int:"""Send Slack notifications for a newly-ready report.@@ -836,8 +801,8 @@ def dispatch_inbox_item_notifications(return 0# Mirror the inbox Reports tab: notify only for actionable reports (READY is enforced upstream- # in the notification activity). Priority is read below for the message label and min-priority- # routing, but it's optional now — an actionable report notifies even without a priority.+ # in the notification activity). Priority is read below for min-priority routing, but+ # it's optional now — an actionable report notifies even without a priority.if _latest_actionability(report) not in _ACTIONABLE_VALUES:logger.info("dispatch_inbox_item_notifications: report not actionable, skipping",@@ -871,14 +836,7 @@ def dispatch_inbox_item_notifications()return 0- sent = _deliver_to_routes(- report,- routes,- priority=priority,- source_products=source_products,- trigger="report_ready",- signals=signals,- )+ sent = _deliver_to_routes(report, routes, trigger="report_ready", signals=signals)logger.info("dispatch_inbox_item_notifications: complete",extra={"report_id": report_id, "team_id": team_id, "messages_sent": sent, "routes": len(routes)},@@ -939,7 +897,6 @@ def dispatch_reviewer_added_notifications(report_id: str,team_id: int,added_github_logins: Iterable[str],- source_products: list[str] | None = None,exclude_user_id: int | None = None,added_user_uuids: Iterable[str] | None = None,) -> int:@@ -991,13 +948,7 @@ def dispatch_reviewer_added_notifications(if not routes:return 0- sent = _deliver_to_routes(- report,- routes,- priority=priority,- source_products=source_products,- trigger="reviewer_added",- )+ sent = _deliver_to_routes(report, routes, trigger="reviewer_added")logger.info("dispatch_reviewer_added_notifications: complete",extra={"report_id": report_id, "team_id": team_id, "messages_sent": sent, "routes": len(routes)},diff --git a/products/signals/backend/tasks.py b/products/signals/backend/tasks.pyindex ce8c16f19c51..7dd6bf86c9ed 100644--- a/products/signals/backend/tasks.py+++ b/products/signals/backend/tasks.py@@ -762,28 +762,10 @@ def send_reviewer_added_slack_notifications() -> None:"""Slack-ping reviewers a human just added to a report.- Runs on a worker because delivery makes several network calls (source-product metadata,- Slack user lookups, chat.postMessage) that must not hold up the reviewer-edit request.+ Runs on a worker because delivery makes several network calls (Slack user lookups,+ chat.postMessage) that must not hold up the reviewer-edit request.Best-effort end to end — the dispatcher logs per-destination failures itself."""- # Imported here rather than at module level: signal_metadata drags posthog.schema and- # posthog.hogql.query onto the django.setup() path (tasks are autodiscovered by celery),- # which the startup import budget forbids.- from products.signals.backend.signal_metadata import fetch_source_products_for_reports # noqa: PLC0415-- team = Team.objects.get(id=team_id)- # Source products are cosmetic (one metadata line in the message), so a failure fetching- # them must not suppress the ping itself.- source_products: list[str] | None = None- try:- meta = fetch_source_products_for_reports(team, [report_id], ch_user=ClickHouseUser.SIGNALS).get(report_id)- source_products = meta.source_products if meta else None- except Exception:- logger.exception(- "failed to fetch source products for reviewer-added notification",- report_id=report_id,- team_id=team_id,- )github_logins = [value for value in added_github_logins if not value.startswith("user:")]user_uuids = [value.removeprefix("user:") for value in added_github_logins if value.startswith("user:")]dispatch_reviewer_added_notifications(@@ -791,7 +773,6 @@ def send_reviewer_added_slack_notifications(team_id=team_id,added_github_logins=github_logins,added_user_uuids=user_uuids,- source_products=source_products,exclude_user_id=exclude_user_id,)diff --git a/products/signals/backend/temporal/inbox_notification.py b/products/signals/backend/temporal/inbox_notification.pyindex 1e6399da5582..360ec41299f1 100644--- a/products/signals/backend/temporal/inbox_notification.py+++ b/products/signals/backend/temporal/inbox_notification.py@@ -146,9 +146,8 @@ def _send_report_inbox_notifications(team_id: int, report_id: str) -> int:logger.info("inbox notification skipped: team gone", report_id=report_id, team_id=team_id)return 0- # Re-derive source products at send time so a deferred notification reflects the current signals.+ # Re-fetched at send time so a deferred notification reflects the current signals.signals = _fetch_signals_for_notification(team, report_id)- source_products = sorted({s["source_product"] for s in signals if s.get("source_product")})# Point any support ticket that raised this report at it. Shares this function's READY guard.# This runs above the claim, so it also runs on a settle that sends no card. A note is per ticket@@ -174,7 +173,6 @@ def _send_report_inbox_notifications(team_id: int, report_id: str) -> int:sent = dispatch_inbox_item_notifications(report_id=report_id,team_id=team_id,- source_products=source_products,signals=signals,)except Exception:diff --git a/products/signals/backend/temporal/summary.py b/products/signals/backend/temporal/summary.pyindex 8da1248a74b0..60446ab0eccc 100644--- a/products/signals/backend/temporal/summary.py+++ b/products/signals/backend/temporal/summary.py@@ -1694,7 +1694,6 @@ async def dispatch_inbox_slack_notifications_activity(input: DispatchInboxSlackNreturn await database_sync_to_async(dispatch_inbox_item_notifications, thread_sensitive=False)(report_id=input.report_id,team_id=input.team_id,- source_products=input.source_products,)diff --git a/products/signals/backend/test/test_slack_inbox_notifications.py b/products/signals/backend/test/test_slack_inbox_notifications.pyindex 162635995292..1f5fe40b5d06 100644--- a/products/signals/backend/test/test_slack_inbox_notifications.py+++ b/products/signals/backend/test/test_slack_inbox_notifications.py@@ -100,76 +100,68 @@ def test_build_message_blocks_includes_recipient_and_open_in_posthog_button() ->report = SignalReport(id="report-uuid",team_id=42,- title="Checkout errors spiked",- summary="Error rate rose after deploy.\nIgnored second line.",+ title="fix(checkout): Checkout errors spiked",+ summary=(+ "Error rate rose after deploy.\nIgnored second line.\n\n"+ "## Problem\n\nThe payment form throws.\n\n"+ "## Impact\n\nAbout **300 buyers** could not pay\nin the last hour.\n\nA second paragraph stays out.\n\n"+ "## Expected impact\n\nFailures should drop to zero."+ ),signal_count=12,)- blocks, text = _build_message_blocks(- report,- priority="P1",- source_products=["error_tracking"],- reviewer_mentions=["<@U123>"],- )+ blocks, text = _build_message_blocks(report, reviewer_mentions=["<@U123>"])assert blocks[0]["text"]["text"] == "Checkout errors spiked"- section_text = blocks[1]["text"]- assert section_text.startswith("**❗ P1 · Error tracking**")- assert "Error rate rose after deploy." in section_text- assert "Ignored second line." not in section_text+ assert blocks[1]["text"] == (+ "Error rate rose after deploy.\n\n**Impact:** About **300 buyers** could not pay in the last hour."+ )# A mention in plain_text would render as the raw token, never pinging anyone.assert all("<@" not in t for t in _plain_text_block_texts(blocks))- context_text = blocks[2]["elements"][0]["text"]- assert "12 signals" in context_text- assert "👤 Suggested reviewers: <@U123>" in context_text- assert "Inbox" not in context_text+ assert blocks[2]["elements"][0]["text"] == "👤 Suggested owner: <@U123>"buttons = blocks[3]["elements"]assert len(buttons) == 1assert buttons[0]["text"]["text"] == "Review in PostHog"assert buttons[0]["url"] == f"{settings.SITE_URL}/project/42/inbox/reports/report-uuid?link_source=slack"- assert text == "Report (P1): Checkout errors spiked"+ assert text == "Checkout errors spiked"-def test_build_message_blocks_mentions_every_routed_reviewer() -> None:- report = SignalReport(id="report-uuid", title="Shared channel")- blocks, _ = _build_message_blocks(- report,- priority="P2",- source_products=[],- reviewer_mentions=["<@U1>", "<@U2>"],- )+ ("summary", "expected"),+ [+ ("Lead.\n\n## Impact\n\nUsers lose data.\n\n## Solution\n\nFix it.", "Users lose data."),+ ("Lead.\n\n## Impact\n\nSee [the chart](chart:errors) here.", "See the chart here."),+ ("Lead.\n\n## Expected impact\n\nFailures drop to zero.", ""),+ ("Lead only, no sections.", ""),+ ],+)+def test_build_message_blocks_shows_only_the_impact_section(summary: str, expected: str) -> None:+ report = SignalReport(id="report-uuid", title="Impact test", summary=summary)+ blocks, _ = _build_message_blocks(report, reviewer_mentions=[])- assert blocks[1]["text"] == "**🟠 P2**"- assert blocks[2]["elements"][0]["text"] == "👤 Suggested reviewers: <@U1> <@U2>"+ body = blocks[1]["text"]+ if expected:+ assert body.endswith(f"**Impact:** {expected}")+ else:+ assert "Impact" not in body-def test_build_message_blocks_includes_repository_in_metadata_line() -> None:- report = SignalReport(id="report-uuid", title="Repo test")- blocks, _ = _build_message_blocks(- report,- priority="P2",- source_products=["error_tracking"],- reviewer_mentions=[],- repository="PostHog/posthog",- )+def test_build_message_blocks_mentions_every_routed_reviewer() -> None:+ report = SignalReport(id="report-uuid", title="Shared channel")+ blocks, _ = _build_message_blocks(report, reviewer_mentions=["<@U1>", "<@U2>"])- assert blocks[1]["text"] == "**🟠 P2 · Error tracking · PostHog/posthog**"+ assert blocks[1]["text"] == "**Shared channel**"+ assert blocks[2]["elements"][0]["text"] == "👤 Suggested owners: <@U1> <@U2>"def test_build_message_blocks_escapes_mrkdwn_in_llm_derived_fields() -> None:- # A crafted summary/repository must not inject Slack mentions (<!here>, <@U…>) into mrkdwn.+ # A crafted summary must not inject Slack mentions (<!here>, <@U…>) into mrkdwn.report = SignalReport(id="report-uuid",title="Injection test",- summary="<!here> everyone & <@U999> look",+ summary="<!here> everyone & <@U999> look\n\n## Impact\n\n<!channel> is affected",signal_count=1,)- blocks, _ = _build_message_blocks(- report,- priority="P2",- source_products=[],- reviewer_mentions=[],- repository="<!channel>/repo",- )+ blocks, _ = _build_message_blocks(report, reviewer_mentions=[])section_text = blocks[1]["text"]assert "<!here>" not in section_text@@ -182,29 +174,6 @@ def test_build_message_blocks_escapes_mrkdwn_in_llm_derived_fields() -> None:assert "everyone & " in section_text- ("priority", "expected_priority_label"),- [- (AutonomyPriority.P0, "‼️ P0"),- (AutonomyPriority.P1, "❗ P1"),- (AutonomyPriority.P2, "🟠 P2"),- (AutonomyPriority.P3, "🟡 P3"),- (AutonomyPriority.P4, "🔵 P4"),- ],-)-def test_build_message_blocks_prefixes_priority_with_emoji(priority: str, expected_priority_label: str) -> None:- report = SignalReport(id="report-uuid", title="Priority test")- blocks, _ = _build_message_blocks(- report,- priority=priority,- source_products=[],- reviewer_mentions=["<@U123>"],- )-- assert blocks[1]["text"] == f"**{expected_priority_label}**"- assert blocks[2]["elements"][0]["text"] == "👤 Suggested reviewers: <@U123>"--def test_resolve_reviewer_mentions_uses_slack_mention_when_lookup_succeeds() -> None:user = User(first_name="Marcus", last_name="Twix", email="[email protected]")slack = MagicMock()@@ -360,23 +329,23 @@ def test_dispatch_sends_to_configured_reviewer(org_and_team, target, expected_co),):slack_cls.return_value.client = fake_client- sent = dispatch_inbox_item_notifications(str(report.id), team.id, source_products=["error_tracking"])+ sent = dispatch_inbox_item_notifications(str(report.id), team.id)assert sent == 1assert fake_client.chat_postMessage.call_count == 1call_kwargs = fake_client.chat_postMessage.call_args.kwargsassert call_kwargs["channel"] == expected_conversation- assert "Report (P1)" in call_kwargs["text"]+ assert call_kwargs["text"] == "Test report"blocks = call_kwargs["blocks"]assert blocks[0]["text"]["text"] == "Test report"- assert blocks[1]["text"].startswith("**❗ P1 · Error tracking**")- context_text = blocks[2]["elements"][0]["text"]+ context_texts = [block["elements"][0]["text"] for block in blocks if block["type"] == "context"]if expects_mention:- assert "👤 Suggested reviewers: <@U_REVIEWER>" in context_text+ assert "👤 Suggested owner: <@U_REVIEWER>" in context_textselse:- assert "Suggested reviewers" not in context_text+ assert not any("Suggested owner" in text for text in context_texts)assert all("<@" not in t for t in _plain_text_block_texts(blocks))- assert blocks[3]["elements"][0]["url"] == (+ actions = next(block for block in blocks if block["type"] == "actions")+ assert actions["elements"][0]["url"] == (f"{settings.SITE_URL}/project/{team.id}/inbox/reports/{report.id}?link_source=slack")@@ -521,7 +490,7 @@ def test_dispatch_falls_back_to_team_channel_without_suggested_reviewers(org_andassert sent == 1assert fake_client.chat_postMessage.call_count == 1assert fake_client.chat_postMessage.call_args.kwargs["channel"] == "CTEAM"- assert "Suggested reviewers" not in json.dumps(fake_client.chat_postMessage.call_args.kwargs["blocks"])+ assert "Suggested owner" not in json.dumps(fake_client.chat_postMessage.call_args.kwargs["blocks"])@pytest.mark.django_db@@ -747,40 +716,6 @@ def test_dispatch_team_channel_tags_only_fallback_reviewers(org_and_team):assert "<@U_FALLBACK>" in by_channel["CTEAM"] and "<@U_OWN>" not in by_channel["CTEAM"]-def test_dispatch_includes_repository_from_repo_selection_artefact(org_and_team):- org, team = org_and_team- user = _make_reviewer_user(org, "[email protected]", "repo-bot")- integration = _make_slack_integration(team, user)- SignalUserAutonomyConfig.objects.create(- user=user,- slack_notification_integration=integration,- slack_notification_channel="C123|#inbox",- )- report = _make_ready_report(team, priority=AutonomyPriority.P2, suggested_logins=["repo-bot"])- SignalReportArtefact.objects.create(- team=team,- report=report,- type=SignalReportArtefact.ArtefactType.REPO_SELECTION,- content=json.dumps({"repository": "PostHog/posthog", "reason": "owns the code"}),- )-- fake_client = MagicMock()- with (- patch("products.signals.backend.slack_inbox_notifications.SlackIntegration") as slack_cls,- patch(- "products.signals.backend.slack_inbox_notifications.lookup_slack_user_id_by_email",- return_value=None,- ),- ):- slack_cls.return_value.client = fake_client- sent = dispatch_inbox_item_notifications(str(report.id), team.id)-- assert sent == 1- blocks = fake_client.chat_postMessage.call_args.kwargs["blocks"]- assert "PostHog/posthog" in blocks[1]["text"]--@pytest.mark.django_dbdef test_dispatch_respects_per_user_min_priority_filter(org_and_team):org, team = org_and_team@@ -932,7 +867,7 @@ def test_dispatch_sends_once_per_channel_when_reviewers_share_channel(org_and_teassert call_kwargs["channel"] == "C123"# The single message still tags both reviewers that resolved to the channel.context_text = call_kwargs["blocks"][2]["elements"][0]["text"]- assert "👤 Suggested reviewers: <@U_ONE> <@U_TWO>" in context_text+ assert "👤 Suggested owners: <@U_ONE> <@U_TWO>" in context_text@pytest.mark.parametrize(@@ -1320,7 +1255,7 @@ def test_notification_respects_project_access(post_message = slack_cls.return_value.client.chat_postMessagepost_message.assert_called_once()assert post_message.call_args.kwargs["channel"] == team_channel- assert "Suggested reviewers" not in json.dumps(post_message.call_args.kwargs["blocks"])+ assert "Suggested owner" not in json.dumps(post_message.call_args.kwargs["blocks"])@pytest.mark.django_db@@ -1420,38 +1355,10 @@ def test_reviewer_added_excludes_actor(org_and_team):assert slack_cls.call_count == 0-def test_reviewer_added_task_still_dispatches_when_source_product_lookup_fails(org_and_team):- # Source products are cosmetic; a failure fetching them must not suppress the ping.- org, team = org_and_team- with (- # The task imports this lazily from signal_metadata, so patch it at its source module.- patch(- "products.signals.backend.signal_metadata.fetch_source_products_for_reports",- side_effect=Exception("clickhouse unavailable"),- ),- patch("products.signals.backend.tasks.dispatch_reviewer_added_notifications") as mock_dispatch,- ):- send_reviewer_added_slack_notifications(- report_id="019f0000-0000-7000-8000-000000000000",- team_id=team.id,- added_github_logins=["someone"],- )-- mock_dispatch.assert_called_once()- assert mock_dispatch.call_args.kwargs["source_products"] is None--@pytest.mark.django_dbdef test_reviewer_added_task_decodes_uuid_from_the_legacy_argument(org_and_team):_, team = org_and_team- with (- patch(- "products.signals.backend.signal_metadata.fetch_source_products_for_reports",- return_value={},- ),- patch("products.signals.backend.tasks.dispatch_reviewer_added_notifications") as mock_dispatch,- ):+ with patch("products.signals.backend.tasks.dispatch_reviewer_added_notifications") as mock_dispatch:send_reviewer_added_slack_notifications(report_id="019f0000-0000-7000-8000-000000000000",team_id=team.id,