: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(review-hog): randomize clean review media (#73029)
Paul D'Ambra5f13a2882302
diff --git a/products/review_hog/backend/reviewer/status_comment.py b/products/review_hog/backend/reviewer/status_comment.pyindex e1474bc6d1d4..007efdd9b6e0 100644--- a/products/review_hog/backend/reviewer/status_comment.py+++ b/products/review_hog/backend/reviewer/status_comment.py@@ -11,6 +11,7 @@ Every entry point here is best-effort by construction: a status comment must nevretry a review, so all exceptions are swallowed after logging."""+import randomimport loggingfrom datetime import timedeltafrom typing import Any@@ -69,13 +70,25 @@ _PRIORITY_LABELS = {}# A clean review deserves a reward, not a bare "nothing here". We still post the comment (so "no-# comment" can never be mistaken for "the run broke"), but swap the flat sign-off for a calming gif.-# Self-hosted on pr-assets (SHA-pinned, permanent) rather than hotlinked, to keep it copyright-clean.-_NO_ISSUES_GIF_URL = (- "https://raw.githubusercontent.com/PostHog/pr-assets/"- "2cfa8ec2d6e5c88ed94a98881499a09153681886/2026/07/41e56d03-cfbe-4660-b7d5-8774d805af5c.gif"+# comment" can never be mistaken for "the run broke"), but swap the flat sign-off for calming media.+# Assets are optimized and self-hosted on pr-assets (SHA-pinned, permanent) rather than hotlinked.+_NO_ISSUES_MEDIA = (+ (+ "https://raw.githubusercontent.com/PostHog/pr-assets/"+ "2cfa8ec2d6e5c88ed94a98881499a09153681886/2026/07/41e56d03-cfbe-4660-b7d5-8774d805af5c.gif",+ "Someone relaxing in a sunny garden",+ ),+ (+ "https://raw.githubusercontent.com/PostHog/pr-assets/"+ "e58e5703b12db9127e450347a5dc7882eec1a8dd/2026/07/fb797d93-c7f5-4f67-869b-68f630e0e1a2.png",+ "A happy dog on a sunny path",+ ),+ (+ "https://raw.githubusercontent.com/PostHog/pr-assets/"+ "3cf9366a6d40bc591284b00304cb6ecd84164343/2026/07/c755cc49-ef33-4435-87e0-51074f110b19.gif",+ "A panda relaxing and waving",+ ),)-_NO_ISSUES_GIF_ALT = "Someone relaxing in a sunny garden"def status_marker(report_id: str) -> str:@@ -130,11 +143,12 @@ def render_final_body()lines = ["### \U0001f994 ReviewHog reviewed this pull request", ""]if found_total == 0:+ media_url, media_alt = random.choice(_NO_ISSUES_MEDIA)lines.extend([- "Nothing worth raising this time, so here's a calming gif instead:",+ "Nothing worth raising this time, so here's a calming picture instead:","",- f"",+ f"",])else:diff --git a/products/review_hog/backend/tests/test_status_comment.py b/products/review_hog/backend/tests/test_status_comment.pyindex 733330a7f929..b8ec755e80ca 100644--- a/products/review_hog/backend/tests/test_status_comment.py+++ b/products/review_hog/backend/tests/test_status_comment.py@@ -92,7 +92,7 @@ class TestRenderFinalBody:0,IssuePriority.SHOULD_FIX,None,- ["Nothing worth raising this time, so here's a calming gif instead:", "![", "pr-assets"],+ ["Nothing worth raising this time, so here's a calming picture instead:", "![", "pr-assets"],["Published", "stayed below"],),# Posted on a prior crashed attempt (marker skip): published, but no link to render.@@ -124,6 +124,20 @@ class TestRenderFinalBody:assert fragment not in body, f"unexpected {fragment!r} in:\n{body}"assert status_marker("rid") in body+ @patch(f"{_MODULE}.random.choice", return_value=("https://example.test/dog.png", "A happy dog"))+ def test_uses_the_randomly_selected_clean_review_media(self, mock_choice: MagicMock) -> None:+ body = render_final_body(+ "rid",+ counts={IssuePriority.MUST_FIX: 0, IssuePriority.SHOULD_FIX: 0, IssuePriority.CONSIDER: 0},+ published_count=0,+ held_back_count=0,+ threshold=IssuePriority.SHOULD_FIX,+ review_url=None,+ )++ assert "" in body+ mock_choice.assert_called_once()+def _pr_metadata(pr_number: int = 123) -> PRMetadata:return PRMetadata(