Skip to content

: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.

fix(review-hog): serve code review at /code-review not /code_review (#74219)

Andrew Maguire1a14a1c184d3
diff --git a/frontend/src/products.tsx b/frontend/src/products.tsx
index 8f51880602ad..e0f728f805a4 100644
--- a/frontend/src/products.tsx
+++ b/frontend/src/products.tsx
@@ -191,7 +191,7 @@ export const productRoutes: Record<string, [string, string]> = {
'/replay-vision/:id/triggers': ['ReplayVisionScannerEditor', 'replayVisionScannerTriggers'],
'/replay-vision/:id/self-driving': ['ReplayVisionScannerEditor', 'replayVisionScannerSelfDriving'],
'/replay-vision/:id': ['ReplayVisionScanner', 'replayVision'],
- '/code_review': ['CodeReview', 'codeReview'],
+ '/code-review': ['CodeReview', 'codeReview'],
'/session-summaries': ['SessionGroupSummariesTable', 'sessionGroupSummariesTable'],
'/session-summaries/:sessionGroupId': ['SessionGroupSummary', 'sessionGroupSummary'],
'/skills': ['Skills', 'skills'],
@@ -1304,7 +1304,7 @@ export const productUrls = {
replayVisionActionNew: (scannerId: string, mode?: 'group_summary' | 'alert'): string =>
`/replay-vision/${scannerId}/actions/new${mode === 'alert' ? '?mode=alert' : ''}`,
replayVisionActionEdit: (actionId: string): string => `/replay-vision/actions/${actionId}/edit`,
- codeReview: (): string => '/code_review',
+ codeReview: (): string => '/code-review',
sessionSummaries: (): string => '/session-summaries',
sessionSummary: (sessionGroupId: string): string => `/session-summaries/${sessionGroupId}`,
skills: (): string => '/skills',
diff --git a/frontend/src/scenes/sceneLogic.test.tsx b/frontend/src/scenes/sceneLogic.test.tsx
index 8be3cf048463..41447ed0796e 100644
--- a/frontend/src/scenes/sceneLogic.test.tsx
+++ b/frontend/src/scenes/sceneLogic.test.tsx
@@ -81,6 +81,17 @@ describe('sceneLogic', () => {
expect(removeProjectIdIfPresent(router.values.location.pathname)).toEqual(urls.featureFlag('123'))
})
+ it('redirects the old /code_review path to /code-review, preserving the ?review= deep link and hash', async () => {
+ router.actions.push('/code_review', { review: 'r-9' }, { panel: 'max:inspect' })
+ await expectLogic(logic).delay(1)
+ expect(removeProjectIdIfPresent(router.values.location.pathname)).toEqual(urls.codeReview())
+ // ?review=<report id> is a permanent public contract baked into GitHub PR comments — the
+ // redirect must carry it across so those links keep opening the right report. The hash
+ // carries global side-panel state, so it has to survive the redirect too.
+ expect(router.values.searchParams.review).toEqual('r-9')
+ expect(router.values.hashParams.panel).toEqual('max:inspect')
+ })
+
it('persists the loaded scenes', async () => {
const expectedAnnotation = partial({
component: expect.any(Function),
diff --git a/frontend/src/scenes/scenes.ts b/frontend/src/scenes/scenes.ts
index c8976180649a..e0fa044eb97e 100644
--- a/frontend/src/scenes/scenes.ts
+++ b/frontend/src/scenes/scenes.ts
@@ -658,6 +658,9 @@ export const redirects: Record<
'/annotations/:id': ({ id }) => urls.annotation(id),
'/batch_exports/:id': ({ id }) => urls.batchExport(id),
'/batch_exports': urls.destinations(),
+ // The scene lives at /code-review (hyphen); catch the old underscore variant, keeping the
+ // ?review= / ?reviews_scope= deep links that PR status comments bake in
+ '/code_review': (_params, searchParams, hashParams) => combineUrl(urls.codeReview(), searchParams, hashParams).url,
'/comments': () => urls.comments(),
'/dashboards': urls.dashboards(),
'/data-management': urls.eventDefinitions(),
diff --git a/products/review_hog/ARCHITECTURE.md b/products/review_hog/ARCHITECTURE.md
index 375c60a750af..04335edb282e 100644
--- a/products/review_hog/ARCHITECTURE.md
+++ b/products/review_hog/ARCHITECTURE.md
@@ -217,7 +217,7 @@ pr_metadata.head_branch` is threaded (as explicit kwargs, alongside `team_id` /
(`reviewer/status_comment.py`) is posted at kickoff, edited with stage progress, and rewritten with the
outcome: the full found counts, what was published, and — when the urgency threshold held findings back —
whose threshold it was (the author's / the requester's / the default, from `resolved_from`) plus a
- "View them in PostHog" deep link to the exact report (`/project/<team>/code_review?review=<report id>`,
+ "View them in PostHog" deep link to the exact report (`/project/<team>/code-review?review=<report id>`,
a **permanent public contract** — the frontend URL sync and `report_deep_link` must keep agreeing on it).
---
@@ -482,7 +482,7 @@ caller. See [DECISIONS.md](./DECISIONS.md) for each trigger's auth / scope / ide
viewer is the **acting user OR the PR's author** — `author_login` compared case-insensitively against the
viewer's linked GitHub login (`User.get_github_login()`, the reverse of the author→user mapping the reviewer
runs under; no linked login → acting-user match only). `scope=everyone` is the whole project; `retrieve` is
-project-wide so any listed review opens. A specific report is linkable at `/code_review?review=<report id>`
+project-wide so any listed review opens. A specific report is linkable at `/code-review?review=<report id>`
(mirrored to/from the drawer by `reviewHogSettingsLogic`'s URL sync; the status comment's held-back link
targets it, so the param is a permanent contract). The drawer buckets a review's findings into published vs
below-threshold by the detail's stored `run_urgency_threshold` — the viewer's current setting is only the
diff --git a/products/review_hog/backend/reviewer/status_comment.py b/products/review_hog/backend/reviewer/status_comment.py
index eb700ca13946..09e57c9b6b0a 100644
--- a/products/review_hog/backend/reviewer/status_comment.py
+++ b/products/review_hog/backend/reviewer/status_comment.py
@@ -118,7 +118,7 @@ def report_deep_link(team_id: int, report_id: str) -> str:
re-edited); the frontend's Code review URL sync accepts exactly this param, so the two must keep
agreeing. Auth-gated like any app link — the same posture as posting Slack links publicly.
"""
- return f"{settings.SITE_URL}/project/{team_id}/code_review?review={report_id}"
+ return f"{settings.SITE_URL}/project/{team_id}/code-review?review={report_id}"
def _plural(count: int, noun: str) -> str:
diff --git a/products/review_hog/backend/tests/test_status_comment.py b/products/review_hog/backend/tests/test_status_comment.py
index 3753b486fa61..9a335c7c8f7a 100644
--- a/products/review_hog/backend/tests/test_status_comment.py
+++ b/products/review_hog/backend/tests/test_status_comment.py
@@ -145,11 +145,11 @@ class TestRenderFinalBody:
threshold=IssuePriority.SHOULD_FIX,
review_url=None,
resolved_from=resolved_from,
- report_url="https://ph.test/project/1/code_review?review=rid",
+ report_url="https://ph.test/project/1/code-review?review=rid",
)
assert f"2 findings stayed below {expected}" in body, body
# Held-back findings are otherwise invisible to the author — the comment must not dead-end.
- assert "[View them in PostHog](https://ph.test/project/1/code_review?review=rid)" in body
+ assert "[View them in PostHog](https://ph.test/project/1/code-review?review=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:
@@ -360,7 +360,7 @@ class TestFinalizeStatusComment(BaseTest):
assert '2 findings stayed below the author\'s "Should fix" urgency threshold' in body
# The held-back link into the app. `?review=<report id>` is a permanent public contract
# (baked into GitHub comments) — the frontend's URL sync accepts exactly this param.
- assert f"/project/{self.team.id}/code_review?review={report_id})" in body
+ assert f"/project/{self.team.id}/code-review?review={report_id})" in body
def test_failed_edit_rewrites_the_comment_as_failed(
self, mock_request: MagicMock, mock_integration: MagicMock
diff --git a/products/review_hog/manifest.tsx b/products/review_hog/manifest.tsx
index 95bd2ed221ce..1b964b7c1416 100644
--- a/products/review_hog/manifest.tsx
+++ b/products/review_hog/manifest.tsx
@@ -16,10 +16,10 @@ export const manifest: ProductManifest = {
},
},
routes: {
- '/code_review': ['CodeReview', 'codeReview'],
+ '/code-review': ['CodeReview', 'codeReview'],
},
urls: {
- codeReview: (): string => '/code_review',
+ codeReview: (): string => '/code-review',
},
treeItemsProducts: [
{
diff --git a/products/review_hog/mcp/tools.yaml b/products/review_hog/mcp/tools.yaml
index 75cc28376789..f8338a16dde7 100644
--- a/products/review_hog/mcp/tools.yaml
+++ b/products/review_hog/mcp/tools.yaml
@@ -6,7 +6,7 @@
# All other fields (title, description, enrich_url, etc.) are yours to configure.
category: ReviewHog
feature: review_hog
-url_prefix: /code_review
+url_prefix: /code-review
ui_apps: {}
tools:
review-hog-blind-spots-list:
diff --git a/services/mcp/src/tools/generated/review_hog.ts b/services/mcp/src/tools/generated/review_hog.ts
index e41c86735304..586f77dd6d8c 100644
--- a/services/mcp/src/tools/generated/review_hog.ts
+++ b/services/mcp/src/tools/generated/review_hog.ts
@@ -43,7 +43,7 @@ const reviewHogReviewsList = (): ToolBase<
scope: params.scope,
},
})
- return await withPostHogUrl(context, result, '/code_review')
+ return await withPostHogUrl(context, result, '/code-review')
},
})