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.

feat(review_hog): split the code review scene into activity and settings tabs (#113798)

Julian Bez6007ef55d0f7
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index 05d946bfc19d..18a64c0b30e1 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -14445,25 +14445,33 @@ snapshots:
scenes-app-workflows-createaitaskconnectors--unavailable-connector--light:
hash: v1.k794b7964.c4fdab3ab5190ace67d354d7010b49cbd37e9ec72feaa3fab9760d1f1010c8b0.S5qBDGrQNUo7qygcV1_MG_nu9RWeaMnoOFrYdhnV97E
scenes-code-review--default--dark:
- hash: v1.k794b7964.7c64d83189e847d347f64fce34a566e49e4b660e736b8111b7eb91b0a954bec3.kE8ewW6NXBQgEwoUUWzKzUAsqqk4yv4lT6pjGrxpavo
+ hash: v1.k794b7964.b33a0c3ec9d3743910d83bf6fc9e8e8df50243a9fcc4e9829429bee7df637fcc.b_1XIxTY9N2TEsb_TJUEhr_PuMJwuuk6tmJ6vgNPKNI
scenes-code-review--default--light:
- hash: v1.k794b7964.3ab8c8f6e5e5a22665158b54ebd53359a8808f510b331ac1f9a82c8e497f4984.gan4zW1Fa49DdiGaOn8D_Jk_fNxHV-PT5w9-YOS_Ig0
+ hash: v1.k794b7964.25e78fe975e3493ea0553b856b0f04a5f400c7d9b5e5d2430be6ccf9180d6124.-MB_Cb1sluGuZ5l0mKOzA_Ve5LA6dZf-ximsFGZ8Fj0
scenes-code-review--flag-disabled-for-staff--dark:
hash: v1.k794b7964.af1b6736f5a6e6ffb329599ed7407d25dbee0939861cd554e0c94b84b2970a7c.HwLX1pgZqjpFAoG4ni16T0wtf1PJQkw0Evr2jBw2vG4
scenes-code-review--flag-disabled-for-staff--light:
hash: v1.k794b7964.a71251e301794f51a0a9140ab1442fada37b1cc0fb54095a5eb19499e0cb1b34.3GhhJCqNfLkY2WdBTTn0LHJifxiCqyEJ7viaHaoCoGA
scenes-code-review--internal-features--dark:
- hash: v1.k794b7964.d9a19def03194e6034b2e789d152aa7fa3a4800c71844ee4048bf9da0bde65cf.OScd4AhOSHEMklEIfhxY4X6T6tI3Ldy-P0HrR-X-J80
+ hash: v1.k794b7964.f6fb596ec6cb9c4ff96fe685204c35cf6620d81ec0b4c267397e5260b4cba319.BC-PojonLRRIkCmE1w06SMLHAj3vNpBDmwz1Lqy6DQg
scenes-code-review--internal-features--light:
- hash: v1.k794b7964.bcf88d581a51854f65fbd28871f3ea415206c6d4411c7193c67950e7253e3b7c.1wk9q4e_YatldElhcW76JX2q5P0d_UoCmQevhDGM35Y
+ hash: v1.k794b7964.cc5e5c672572877fbae0c266e6b3a320a20666c6c058b9245364754bd5a0ad98.5IL4ttzXBh-wBA2axgr4Sg8RQirVQDZUS2aVOAO7Y0w
scenes-code-review--narrow--dark:
- hash: v1.k794b7964.35849f88cd28db56cb71ca5beaf1cf0c8817abf8714f4035113a75f1aa1a7def.w8ZUBwj8pOSIMaqaxNfLstA4-2GD7_oPox7tm2lrG5o
+ hash: v1.k794b7964.05d25786fae644e7fa985bd997708d94de95f69d1b2ddd4e3fa797f12a39e2ea.6daW2P95kD6OWHL3Dp3UsaCEdjNTltcu82kl6IF-yVY
scenes-code-review--narrow--light:
- hash: v1.k794b7964.88aeb5533c67b9045bd9b08012f3c3e6ee43909731404e0615d087189d479ef5.rEgrSeDVoFM2CbvwI57WgRZBUf0TD8TEjOWMEsDShhQ
+ hash: v1.k794b7964.546bd878a0869e18a235c9653ca3cd245dc4219e1f0d97b04cdb8dd10e109130.W3x_iacIB7oY0C-rAolmf2UZegpJAotIzO-oQ1tzKDg
+ scenes-code-review--narrow-settings--dark:
+ hash: v1.k794b7964.cdf782bbb06ad94833e6b370163fc38086adae3e0a7262204fb245f484db4c0a.x2g0bLhG1lXqXuQ1WOLFYG8jt0ZbG7ZPyzn8y_vQGRo
+ scenes-code-review--narrow-settings--light:
+ hash: v1.k794b7964.3d58a1e7d291237164789d4283eecb8b6d9bd48a72dd6cd60c81210b09cb4793.I8lBN5q2lRsu4FICyoVZlxcfrdouG5hwNATxfEjgum0
scenes-code-review--saved-inbox-opt-ins--dark:
- hash: v1.k794b7964.e17fe7708756d2621bb504f9e6d6db1ecfe1639d01a44de6e18424544467ac34.Tt6qVsdw2jHfcy2VU9usalpz1LCTd4xdMAmsbMWptac
+ hash: v1.k794b7964.f2d5c819a2e808c16ea634d50e27386af5e2418a47d37950b56bf20070b50a7c.wJyEO2-rtSg4H8z15MqXn2qNBlPKRmWiHTN-miC6P9E
scenes-code-review--saved-inbox-opt-ins--light:
- hash: v1.k794b7964.a7b83b405218dad929bd1dc8739ed410afccf4c98d6807bc27d38bfc77eb2566.KSHymdCYdRa0C6RdxJD4uJGSjIzFNOrV_hT_ygJgfEw
+ hash: v1.k794b7964.4e398ebc4687896fe093730c3df7538acb3dc6188c7afc737651422ab83bd677.49hCSJzvrkG78fsVgvZjOx2ReOUKjatfD-hEHJ55ZZk
+ scenes-code-review--settings--dark:
+ hash: v1.k794b7964.99c0bd08641752ff41107c904dd346706928328f357d5cee6c8d67b946349bd1.CIS_WydEc4kgzx25Z5qaNfYp8vyTjSFsA9YGkQfvuAs
+ scenes-code-review--settings--light:
+ hash: v1.k794b7964.430953687f20772b29338454be7c40ca64b1fe5ace6e550db2d0abadbe4652cd.pz_T7gTs8y0XkZkRpHI_S4sh65K2UENhgIbkdu1vjD4
scenes-dashboards-customize-breakdown-colors--customize-breakdown-colors--dark:
hash: v1.k794b7964.cf89a12669d5221b2441fbfb4439b8b1b38191943438a2c1a220444148329954.B4ew6uW3gZCbPU_3vTOggsOyHojRlyvuXxh5FZnlO-0
scenes-dashboards-customize-breakdown-colors--customize-breakdown-colors--light:
diff --git a/products/review_hog/frontend/CodeReviewScene.stories.tsx b/products/review_hog/frontend/CodeReviewScene.stories.tsx
index 9f6b47386b65..d2ef751df11f 100644
--- a/products/review_hog/frontend/CodeReviewScene.stories.tsx
+++ b/products/review_hog/frontend/CodeReviewScene.stories.tsx
@@ -1,21 +1,27 @@
import { MOCK_DEFAULT_USER } from 'lib/api.mock'
-import { Meta, StoryObj } from '@storybook/react'
+import { Decorator, Meta, StoryObj } from '@storybook/react'
import { waitFor, within } from '@testing-library/dom'
+import { router } from 'kea-router'
+import { useEffect } from 'react'
import { FEATURE_FLAGS } from 'lib/constants'
+import { urls } from 'scenes/urls'
import { userLogic } from 'scenes/userLogic'
import { mswDecorator } from '~/mocks/browser'
import type {
PatchedReviewUserSettingsApi,
+ ReviewPerspectiveStatsApi,
+ ReviewRecentReviewApi,
ReviewUserSettingsApi,
} from 'products/review_hog/frontend/generated/api.schemas'
import { expect } from 'storybook/test'
import { CodeReviewScene } from './CodeReviewScene'
+import { CodeReviewTab } from './reviewHogSettingsLogic'
const defaultSettings: ReviewUserSettingsApi = {
default_review_mode: 'follow',
@@ -36,18 +42,85 @@ const defaultSettings: ReviewUserSettingsApi = {
stamphog_connected: false,
}
+function completedReview(overrides: Partial<ReviewRecentReviewApi>): ReviewRecentReviewApi {
+ return {
+ id: 'review-1',
+ repository: 'example-org/example-repo',
+ pr_number: 101,
+ pr_title: 'Add retry to the export job',
+ pr_author: 'example-dev',
+ additions: 120,
+ deletions: 34,
+ changed_files: 6,
+ head_branch: 'feat/export-retry',
+ github_url: 'https://github.com/example-org/example-repo/pull/101',
+ run_count: 1,
+ last_run_at: '2026-09-30T10:00:00Z',
+ published: true,
+ in_progress: false,
+ progress: null,
+ resolution: null,
+ must_fix_count: 1,
+ should_fix_count: 2,
+ consider_count: 1,
+ candidate_count: 7,
+ dismissed_count: 3,
+ files_reviewed: 6,
+ chunk_count: 2,
+ perspective_count: 3,
+ perspective_issue_count: 8,
+ blind_spot_issue_count: 2,
+ ...overrides,
+ }
+}
+
+const recentReviews: ReviewRecentReviewApi[] = [
+ completedReview({}),
+ completedReview({
+ id: 'review-2',
+ pr_number: 98,
+ pr_title: 'Fix timezone handling in the weekly digest',
+ github_url: 'https://github.com/example-org/example-repo/pull/98',
+ head_branch: 'fix/digest-timezone',
+ last_run_at: '2026-09-29T15:30:00Z',
+ must_fix_count: 0,
+ should_fix_count: 1,
+ consider_count: 0,
+ dismissed_count: 1,
+ }),
+]
+
+const perspectiveStats: ReviewPerspectiveStatsApi = {
+ report_count: 2,
+ perspectives: [
+ { skill_name: 'review-hog-perspective-logic-correctness', raised: 6, kept: 4, dismissed: 2 },
+ { skill_name: 'review-hog-perspective-performance-reliability', raised: 3, kept: 1, dismissed: 2 },
+ { skill_name: 'review-hog-blind-spots-general', raised: 2, kept: 1, dismissed: 1 },
+ ],
+}
+
+function OpenTab({ tab, children }: { tab: CodeReviewTab; children: JSX.Element }): JSX.Element {
+ useEffect(() => {
+ router.actions.replace(urls.codeReview(), tab === 'settings' ? { tab } : {})
+ }, [tab])
+ return children
+}
+
const meta: Meta<typeof CodeReviewScene> = {
component: CodeReviewScene,
title: 'Scenes/Code review',
parameters: {
layout: 'fullscreen',
featureFlags: [FEATURE_FLAGS.REVIEW_HOG],
+ mockDate: '2026-10-01T12:00:00Z',
},
decorators: [
- (Story): JSX.Element => (
- <div className="p-4">
- <Story />
- </div>
+ (Story, context): JSX.Element => (
+ <OpenTab tab={context.parameters.tab ?? 'activity'}>
+ <div className="p-4">
+ <Story />
+ </div>
+ </OpenTab>
),
(Story, context): JSX.Element => {
let settings: ReviewUserSettingsApi = {
@@ -61,11 +134,8 @@ const meta: Meta<typeof CodeReviewScene> = {
{ ...MOCK_DEFAULT_USER, is_staff: context.parameters.isStaff ?? false },
],
'/api/projects/:team_id/review_hog/settings/': () => [200, settings],
- '/api/projects/:team_id/review_hog/reviews/': { results: [], has_more: false },
- '/api/projects/:team_id/review_hog/reviews/perspective_stats/': {
- report_count: 0,
- perspectives: [],
- },
+ '/api/projects/:team_id/review_hog/reviews/': { results: recentReviews, has_more: false },
+ '/api/projects/:team_id/review_hog/reviews/perspective_stats/': perspectiveStats,
'/api/projects/:team_id/review_hog/perspectives/': [],
'/api/projects/:team_id/review_hog/blind_spots/': [],
'/api/projects/:team_id/review_hog/validators/': [],
@@ -87,11 +157,23 @@ export default meta
type Story = StoryObj<typeof CodeReviewScene>
export const Default: Story = {
+ play: async ({ canvasElement }) => {
+ const canvas = within(canvasElement)
+ await expect(await canvas.findByText('Review a pull request')).toBeVisible()
+ await expect(await canvas.findByText('Add retry to the export job')).toBeVisible()
+ await expect(canvas.getByText('Mine')).toBeVisible()
+ await expect(canvas.queryByLabelText('Celebrate clean reviews')).not.toBeInTheDocument()
+ },
+}
+
+export const Settings: Story = {
+ parameters: { tab: 'settings' },
play: async ({ canvasElement }) => {
userLogic.actions.loadUser()
await waitFor(() => expect(userLogic.values.user?.is_staff).toBe(false))
const canvas = within(canvasElement)
- await expect(await canvas.findByText('Review a pull request')).toBeVisible()
+ await expect(await canvas.findByText('What gets reviewed')).toBeVisible()
+ await expect(canvas.queryByText('Review a pull request')).not.toBeInTheDocument()
await expect(canvas.queryByLabelText('Review all your Inbox PRs')).not.toBeInTheDocument()
await expect(canvas.queryByLabelText('Let Stamphog review your Inbox PRs')).not.toBeInTheDocument()
await expect(canvas.queryByLabelText('Review all your PRs in Flash mode')).not.toBeInTheDocument()
@@ -104,6 +186,7 @@ export const InternalFeatures: Story = {
parameters: {
featureFlags: [FEATURE_FLAGS.REVIEW_HOG, FEATURE_FLAGS.REVIEW_HOG_INTERNAL],
savedSettings: { stamphog_connected: true },
+ tab: 'settings',
},
play: async ({ canvasElement }) => {
const canvas = within(canvasElement)
@@ -114,7 +197,7 @@ export const InternalFeatures: Story = {
}
export const SavedInboxOptIns: Story = {
- parameters: { savedSettings: { review_inbox_prs: true, stamphog_review_inbox_prs: true } },
+ parameters: { savedSettings: { review_inbox_prs: true, stamphog_review_inbox_prs: true }, tab: 'settings' },
play: async ({ canvasElement }) => {
const canvas = within(canvasElement)
const inboxSwitch = await canvas.findByLabelText('Review all your Inbox PRs')
@@ -138,12 +221,17 @@ export const FlagDisabledForStaff: Story = {
},
}
+const narrowDecorator: Decorator = (Story): JSX.Element => (
+ <div className="max-w-130">
+ <Story />
+ </div>
+)
+
export const Narrow: Story = {
- decorators: [
- (Story): JSX.Element => (
- <div className="max-w-130">
- <Story />
- </div>
- ),
- ],
+ decorators: [narrowDecorator],
+}
+
+export const NarrowSettings: Story = {
+ parameters: { tab: 'settings' },
+ decorators: [narrowDecorator],
}
diff --git a/products/review_hog/frontend/CodeReviewScene.tsx b/products/review_hog/frontend/CodeReviewScene.tsx
index c2339a8bac49..b75512c2da63 100644
--- a/products/review_hog/frontend/CodeReviewScene.tsx
+++ b/products/review_hog/frontend/CodeReviewScene.tsx
@@ -63,7 +63,13 @@ import {
import { AdoptSkillModal } from './AdoptSkillModal'
import { PipelineDetailModal } from './PipelineDetailModal'
-import { REVIEWS_PAGE_SIZE, ReviewDrawerTab, ReviewSkillKind, reviewHogSettingsLogic } from './reviewHogSettingsLogic'
+import {
+ CodeReviewTab,
+ REVIEWS_PAGE_SIZE,
+ ReviewDrawerTab,
+ ReviewSkillKind,
+ reviewHogSettingsLogic,
+} from './reviewHogSettingsLogic'
/** "review-hog-perspective-logic-correctness" → "Logic correctness" */
function prettifySkillName(skillName: string): string {
@@ -180,11 +186,32 @@ function SectionHeader({
)
}
+// The Mine tooltip states what the backend's `mine` scope matches: the PR author OR the user who started the run.
+const REVIEWS_SCOPE_OPTIONS: {
+ value: ReviewHogReviewsListScope
+ label: string
+ tooltip: string
+ 'data-attr': string
+}[] = [
+ {
+ value: ReviewHogReviewsListScope.Mine,
+ label: 'Mine',
+ tooltip: 'Reviews of pull requests you authored, plus reviews you started',
+ 'data-attr': 'code-review-reviews-scope-mine',
+ },
+ {
+ value: ReviewHogReviewsListScope.Everyone,
+ label: 'Everyone',
+ tooltip: 'Reviews of every pull request in this project',
+ 'data-attr': 'code-review-reviews-scope-everyone',
+ },
+]
+
/**
- * Page-level scope switch: one control governing the hero proof card, the effectiveness cards,
- * and the recent-reviews list below. Skill toggles stay per-user regardless of scope.
+ * Filter on the recent-reviews list. It also scopes the proof card and the effectiveness cards on
+ * the Settings tab. Skill toggles stay per-user regardless of scope.
*/
-function PageScopeSwitch(): JSX.Element {
+function ReviewsScopeFilter(): JSX.Element {
const { reviewsScope } = useValues(reviewHogSettingsLogic)
const { setReviewsScope } = useActions(reviewHogSettingsLogic)
return (
@@ -192,24 +219,25 @@ function PageScopeSwitch(): JSX.Element {
size="small"
value={reviewsScope}
onChange={(value) => setReviewsScope(value)}
- options={[
- {
- value: ReviewHogReviewsListScope.Mine,
- label: 'For you',
- tooltip: 'Stats and reviews for pull requests you authored',
- },
- {
- value: ReviewHogReviewsListScope.Everyone,
- label: 'Entire project',
- tooltip: 'Stats and reviews for every pull request on this project',
- },
- ]}
+ options={REVIEWS_SCOPE_OPTIONS}
/>
)
}
+function StatsWindowLabel({ reportCount }: { reportCount: number }): JSX.Element {
+ const { reviewsScope } = useValues(reviewHogSettingsLogic)
+ const scopeOption = REVIEWS_SCOPE_OPTIONS.find((option) => option.value === reviewsScope)
+ return (
+ <Tooltip title={`${scopeOption?.tooltip}. Set by the Mine / Everyone filter on recent reviews.`}>
+ <span className="text-xxs text-tertiary">
+ <span translate="no">{`Last ${reportCount} completed review${reportCount === 1 ? '' : 's'} · ${scopeOption?.label}`}</span>
+ </span>
+ </Tooltip>
+ )
+}
+
/**
- * Hero proof block: the validation funnel across the in-scope recent reviews, summed from the same
+ * Proof block: the validation funnel across the in-scope recent reviews, summed from the same
* stats the effectiveness cards use. Hidden while there are no reviewed findings in scope yet.
*/
function ProofCard(): JSX.Element | null {
@@ -227,7 +255,7 @@ function ProofCard(): JSX.Element | null {
}
return (
- <LemonCard hoverEffect={false} className="mt-2 flex flex-col gap-3 p-5">
+ <LemonCard hoverEffect={false} className="flex flex-col gap-3 p-5">
<div className="flex flex-wrap items-baseline gap-x-2 gap-y-1">
<span className="text-3xl font-bold tabular-nums text-warning">{kept}</span>
<span className="text-sm font-semibold">
@@ -237,9 +265,8 @@ function ProofCard(): JSX.Element | null {
from <span className="font-semibold text-default">{raised}</span> raised ·{' '}
<span className="font-semibold text-default">{dismissed}</span> filtered as noise
</span>
- <span className="ml-auto text-xxs text-tertiary">
- {everyone ? "This project's last" : 'Your last'} {perspectiveStats.report_count} review
- {perspectiveStats.report_count === 1 ? '' : 's'}
+ <span className="ml-auto">
+ <StatsWindowLabel reportCount={perspectiveStats.report_count} />
</span>
</div>
<div className="h-2.5 w-full overflow-hidden rounded-full bg-fill-highlight-100">
@@ -260,7 +287,7 @@ function ProofCard(): JSX.Element | null {
function PipelineSection(): JSX.Element {
const { openPipelineDetail } = useActions(reviewHogSettingsLogic)
return (
- <section className="flex flex-col gap-4 border-t border-primary pt-8">
+ <section className="flex flex-col gap-4">
<SectionHeader
icon={<IconDirectedGraph />}
title="How we review your PRs"
@@ -420,7 +447,7 @@ function resolutionLabel(resolution: ReviewResolutionStatusApi): string {
/** A first review still running: no findings to expand into yet, just the live stage. */
function RunningReviewRow({ review }: { review: ReviewRecentReviewApi }): JSX.Element {
const { reviewsScope } = useValues(reviewHogSettingsLogic)
- // On the Entire project scope, whose PR it is matters at a glance; on For you it's always yours.
+ // On Everyone, whose PR it is matters at a glance; on Mine it is mostly yours.
const showAuthor = reviewsScope === ReviewHogReviewsListScope.Everyone && !!review.pr_author
return (
<div className="flex items-center gap-3 px-4 py-3">
@@ -460,7 +487,7 @@ function RecentReviewRow({ review }: { review: ReviewRecentReviewApi }): JSX.Ele
const { toggleReviewRowExpanded, openReviewDetail } = useActions(reviewHogSettingsLogic)
const expanded = expandedReviewIds.includes(review.id)
const validated = review.must_fix_count + review.should_fix_count + review.consider_count
- // On the Entire project scope, whose PR it is matters at a glance; on For you it's always yours.
+ // On Everyone, whose PR it is matters at a glance; on Mine it is mostly yours.
const showAuthor = reviewsScope === ReviewHogReviewsListScope.Everyone && !!review.pr_author
// A first review has no completed turn to expand into — it renders as a live progress row.
@@ -595,7 +622,7 @@ function RecentReviewRow({ review }: { review: ReviewRecentReviewApi }): JSX.Ele
)
}
-/** Compact proof-of-life block under the hero — hidden entirely until the project has reviews. */
+/** Proof card and review list with their scope filter, hidden entirely until the project has reviews. */
function RecentReviewsSection(): JSX.Element | null {
const {
recentReviews,
@@ -609,10 +636,10 @@ function RecentReviewsSection(): JSX.Element | null {
const everyone = reviewsScope === ReviewHogReviewsListScope.Everyone
const loadedEmpty = recentReviews !== null && recentReviews.length === 0
- // Settled-and-empty on the Entire project scope means the project has no reviews at all — hide
+ // Settled-and-empty on the Everyone scope means the project has no reviews at all — hide
// the section entirely (an in-flight load keeps it mounted with skeletons instead of flashing
- // it away mid-switch). An empty For-you scope keeps the section, with an empty state pointing
- // at the page-level scope switch.
+ // it away mid-switch). An empty Mine scope keeps the section, with an empty state pointing
+ // at the scope filter in the section header.
if (loadedEmpty && everyone && !recentReviewsPageLoading) {
return null
}
@@ -622,13 +649,13 @@ function RecentReviewsSection(): JSX.Element | null {
const emptyAwaitingReload = loadedEmpty && (recentReviewsPageLoading || !hasUserChosenReviewsScope)
return (
- // The one section without a top hairline — it reads as a continuation of the hero.
<section className="flex flex-col gap-4">
- <SectionHeader icon={<IconPullRequest />} title={everyone ? 'Recent reviews' : 'Your recent reviews'}>
+ <SectionHeader icon={<IconPullRequest />} title="Recent reviews" action={<ReviewsScopeFilter />}>
{everyone
? 'The latest PostHog Review runs on pull requests across this project. Expand a review for its details and findings.'
- : 'The latest PostHog Review runs on pull requests you authored. Expand a review for its details and findings.'}
+ : 'The latest PostHog Review runs on pull requests you authored, plus reviews you started. Expand a review for its details and findings.'}
</SectionHeader>
+ <ProofCard />
<LemonCard hoverEffect={false} className="divide-y divide-primary p-0">
{recentReviews === null || emptyAwaitingReload ? (
[0, 1, 2].map((i) => (
@@ -670,8 +697,8 @@ function RecentReviewsSection(): JSX.Element | null {
</>
) : (
<div className="px-4 py-6 text-center text-sm text-secondary">
- No reviews of your pull requests yet. Switch to "Entire project" at the top of the page to see
- the whole team's.
+ No reviews of your pull requests or reviews you started yet. Pick "Everyone" above to see the
+ whole team's.
</div>
)}
</LemonCard>
@@ -700,7 +727,7 @@ function TriggerReviewSection(): JSX.Element {
<section className="flex flex-col gap-4">
<SectionHeader icon={<IconGithub />} title="Review a pull request">
Start a review of any pull request the GitHub App can access. The review is posted back to the pull
- request, runs with your perspectives, and shows up under your recent reviews.
+ request, runs with your perspectives, and shows up under recent reviews.
</SectionHeader>
<form
className="ml-9 flex flex-wrap items-center gap-2"
@@ -1496,12 +1523,11 @@ function EffectivenessRows({
* bar of findings it raised split into validator-kept (green) vs dismissed (muted). Rendered once
* in the Perspectives section and once in the Blind-spot section, above each one's skill cards;
* both cards share one scale so bar lengths stay comparable. Hidden until there is data for the
- * kind. On the Entire project scope this can list skills beyond the user's own cards below — the
+ * kind. On the Everyone scope this can list skills beyond the user's own cards below — the
* stats describe the project, while the toggles stay per-user.
*/
function EffectivenessCard({ kind }: { kind: 'perspectives' | 'blind_spots' }): JSX.Element | null {
- const { perspectiveStats, reviewsScope } = useValues(reviewHogSettingsLogic)
- const everyone = reviewsScope === ReviewHogReviewsListScope.Everyone
+ const { perspectiveStats } = useValues(reviewHogSettingsLogic)
if (!perspectiveStats?.perspectives.length) {
return null
@@ -1520,11 +1546,14 @@ function EffectivenessCard({ kind }: { kind: 'perspectives' | 'blind_spots' }):
{/* Overline header: this card is an instrument panel about the skills below, not one of
them — it must not share the skill cards' title style. */}
<div className="flex flex-col gap-1">
- <span className="text-xxs font-semibold uppercase tracking-wide text-tertiary">Effectiveness</span>
+ <div className="flex flex-wrap items-baseline gap-x-2">
+ <span className="text-xxs font-semibold uppercase tracking-wide text-tertiary">Effectiveness</span>
+ <span className="ml-auto">
+ <StatsWindowLabel reportCount={perspectiveStats.report_count} />
+ </span>
+ </div>
<p className="m-0 text-xs text-secondary">
- Findings each {noun} raised across {everyone ? "this project's" : 'your'} last{' '}
- {perspectiveStats.report_count} review{perspectiveStats.report_count === 1 ? '' : 's'}, and how many
- survived validation.
+ Findings each {noun} raised in these reviews, and how many survived validation.
</p>
</div>
<EffectivenessRows items={items} maxRaised={maxRaised} />
@@ -1561,11 +1590,15 @@ function ValidatorEffectivenessCard(): JSX.Element | null {
return (
<LemonCard hoverEffect={false} className="flex flex-col gap-3 p-4">
<div className="flex flex-col gap-1">
- <span className="text-xxs font-semibold uppercase tracking-wide text-tertiary">Effectiveness</span>
+ <div className="flex flex-wrap items-baseline gap-x-2">
+ <span className="text-xxs font-semibold uppercase tracking-wide text-tertiary">Effectiveness</span>
+ <span className="ml-auto">
+ <StatsWindowLabel reportCount={perspectiveStats.report_count} />
+ </span>
+ </div>
<p className="m-0 text-xs text-secondary">
- {everyone
- ? `Of the ${judged} findings reviewers raised across this project's last ${perspectiveStats.report_count} review${perspectiveStats.report_count === 1 ? '' : 's'}, this is how much noise validation kept off pull requests.`
- : `Of the ${judged} findings your reviewers raised across your last ${perspectiveStats.report_count} review${perspectiveStats.report_count === 1 ? '' : 's'}, this is how much noise your quality bar kept off your pull requests.`}
+ Of the <span translate="no">{judged}</span> findings reviewers raised in these reviews, this is how
+ much noise validation kept off pull requests.
</p>
</div>
<Tooltip
@@ -1592,7 +1625,7 @@ function ValidatorEffectivenessCard(): JSX.Element | null {
)}
</div>
<span className="w-24 shrink-0 text-right text-xs tabular-nums text-secondary">
- {dismissed} of {judged} dismissed
+ <span translate="no">{`${dismissed} of ${judged} dismissed`}</span>
</span>
</div>
</Tooltip>
@@ -1741,16 +1774,83 @@ export const scene: SceneExport = {
logic: reviewHogSettingsLogic,
}
+function ActivityTab(): JSX.Element {
+ return (
+ <>
+ <TriggerReviewSection />
+ <RecentReviewsSection />
+ </>
+ )
+}
+
+function SettingsTab(): JSX.Element {
+ const { blindSpots, validators, resolutionSkills } = useValues(reviewHogSettingsLogic)
+ const { selectBlindSpots, selectValidator, selectResolutionSkill } = useActions(reviewHogSettingsLogic)
+
+ return (
+ <>
+ <PipelineSection />
+ <TriggersSection />
+ <section className="flex flex-col gap-8 border-t border-primary pt-8">
+ <div className="flex flex-col gap-1.5">
+ <h2 className="m-0 text-xl font-bold">Review skills</h2>
+ <p className="m-0 max-w-160 text-sm text-secondary">
+ Everything below is a regular skill, stored in your PostHog skills store like anything else
+ you've added. Review skills read your changed code, a blind-spot sweep catches what they missed,
+ and validation criteria decide what reaches the pull request. Toggling one here applies only to
+ your pull request reviews; editing a skill changes it for the whole team.
+ </p>
+ </div>
+ <PerspectivesSection />
+ <SingleActiveSection
+ icon={<IconSearch />}
+ title="Blind-spot check"
+ intro="After the enabled perspectives finish, PostHog Review runs one more sweep over each chunk. It sees what they found and hunts for real issues they all missed. Add as many sweeps as you like, but only one runs."
+ kind="blind_spots"
+ kindLabel="blind-spot check"
+ preamble={<EffectivenessCard kind="blind_spots" />}
+ createLabel="Create your own blind-spot check"
+ skills={blindSpots?.map((s) => ({ ...s, on: s.active })) ?? null}
+ onSelect={selectBlindSpots}
+ />
+ <SingleActiveSection
+ icon={<IconShield />}
+ title="Validation criteria"
+ intro="Every candidate finding is checked against your quality bar before publishing, so noisy, speculative, or low-value issues never reach the pull request. Keep several bars on hand, but only one is applied."
+ kind="validator"
+ kindLabel="validator"
+ createLabel="Create your own validation criteria"
+ preamble={<ValidatorEffectivenessCard />}
+ skills={validators?.map((s) => ({ ...s, on: s.active })) ?? null}
+ onSelect={selectValidator}
+ />
+ <SingleActiveSection
+ icon={<IconWrench />}
+ title="Resolution criteria"
+ intro="After a review is published, PostHog Review works through the pull request's unresolved comment threads: asks that are worth it and safe get implemented on the branch, and every thread gets a reply. These criteria set that bar. Keep several on hand, but only one is applied."
+ kind="resolution"
+ kindLabel="resolution criteria"
+ createLabel="Create your own resolution criteria"
+ skills={resolutionSkills?.map((s) => ({ ...s, on: s.active })) ?? null}
+ onSelect={selectResolutionSkill}
+ />
+ </section>
+ <UrgencySection />
+ </>
+ )
+}
+
/**
- * The "Code review" scene: ReviewHog's combined onboarding and settings page. One scrollable
- * guided-configuration page — every control is live from load, no save step. See
- * `reviewHogSettingsLogic` for the data flow. Access is gated on FEATURE_FLAGS.REVIEW_HOG, the same
- * flag that shows the menu entry, so whoever discovers the entry can open the page.
+ * The "Code review" scene: ReviewHog's activity and settings page, split into an Activity tab
+ * (trigger a review, recent reviews) and a Settings tab (what gets reviewed, skills, threshold).
+ * Every control is live from load, no save step. See `reviewHogSettingsLogic` for the data flow.
+ * Access is gated on FEATURE_FLAGS.REVIEW_HOG, the same flag that shows the menu entry, so whoever
+ * discovers the entry can open the page.
*/
export function CodeReviewScene(): JSX.Element {
const { featureFlags } = useValues(featureFlagLogic)
- const { blindSpots, validators, resolutionSkills, initialLoadFailed } = useValues(reviewHogSettingsLogic)
- const { selectBlindSpots, selectValidator, selectResolutionSkill, loadAll } = useActions(reviewHogSettingsLogic)
+ const { activeTab, initialLoadFailed } = useValues(reviewHogSettingsLogic)
+ const { setActiveTab, loadAll } = useActions(reviewHogSettingsLogic)
if (!featureFlags[FEATURE_FLAGS.REVIEW_HOG]) {
return <NotFound object="page" />
@@ -1760,88 +1860,28 @@ export function CodeReviewScene(): JSX.Element {
<SceneContent>
<SceneTitleSection
name="Code review"
- description="Automated code reviews of your pull requests, and your review agent settings."
+ description="PostHog Review reads your pull requests and posts the findings worth fixing. Start a review, see recent ones, and choose what gets reviewed."
resourceType={{ type: 'code_review' }}
/>
- <div className="mx-auto flex w-full max-w-3xl flex-col gap-8 px-6 pb-30 pt-4">
- <section className="flex flex-col gap-3">
- <div className="flex flex-wrap items-center gap-2">
- <span className="size-1.5 rounded-full bg-warning" />
- <span className="text-xxs font-semibold uppercase tracking-widest text-tertiary">
- Automated pull request review
- </span>
- {/* Top of the page so it visibly governs everything below it, not one section. */}
- <div className="ml-auto">
- <PageScopeSwitch />
- </div>
- </div>
- <h2 className="m-0 text-3xl font-bold" style={{ textWrap: 'balance' }}>
- PostHog Review reviews pull requests before humans do
- </h2>
- <p className="m-0 max-w-155 text-sm text-secondary">
- Specialist review skills read your changed code in parallel each from their own perspective, a
- blind-spot sweep catches what they missed, and only validated findings get published back to the
- pull request.
- </p>
- <ProofCard />
- </section>
-
+ <LemonTabs<CodeReviewTab>
+ activeKey={activeTab}
+ onChange={setActiveTab}
+ tabs={[
+ { key: 'activity', label: 'Activity', 'data-attr': 'code-review-tab-activity' },
+ { key: 'settings', label: 'Settings', 'data-attr': 'code-review-tab-settings' },
+ ]}
+ sceneInset
+ />
+ <div className="flex flex-col gap-8 pb-8">
{initialLoadFailed && (
<LemonBanner type="error" action={{ children: 'Retry', onClick: () => loadAll() }}>
Some PostHog Review settings failed to load.
</LemonBanner>
)}
- <TriggerReviewSection />
- <RecentReviewsSection />
- <PipelineSection />
- <TriggersSection />
- <section className="flex flex-col gap-8 border-t border-primary pt-8">
- <div className="flex flex-col gap-1.5">
- <h2 className="m-0 text-xl font-bold">Review skills</h2>
- <p className="m-0 max-w-160 text-sm text-secondary">
- Everything below is a regular skill, stored in your PostHog skills store like anything else
- you've added. Review skills read your changed code, a blind-spot sweep catches what they
- missed, and validation criteria decide what reaches the pull request. Toggling one here
- applies only to your pull request reviews; editing a skill changes it for the whole team.
- </p>
- </div>
- <PerspectivesSection />
- <SingleActiveSection
- icon={<IconSearch />}
- title="Blind-spot check"
- intro="After the enabled perspectives finish, PostHog Review runs one more sweep over each chunk. It sees what they found and hunts for real issues they all missed. Add as many sweeps as you like, but only one runs."
- kind="blind_spots"
- kindLabel="blind-spot check"
- preamble={<EffectivenessCard kind="blind_spots" />}
- createLabel="Create your own blind-spot check"
- skills={blindSpots?.map((s) => ({ ...s, on: s.active })) ?? null}
- onSelect={selectBlindSpots}
- />
- <SingleActiveSection
- icon={<IconShield />}
- title="Validation criteria"
- intro="Every candidate finding is checked against your quality bar before publishing, so noisy, speculative, or low-value issues never reach the pull request. Keep several bars on hand, but only one is applied."
- kind="validator"
- kindLabel="validator"
- createLabel="Create your own validation criteria"
- preamble={<ValidatorEffectivenessCard />}
- skills={validators?.map((s) => ({ ...s, on: s.active })) ?? null}
- onSelect={selectValidator}
- />
- <SingleActiveSection
- icon={<IconWrench />}
- title="Resolution criteria"
- intro="After a review is published, PostHog Review works through the pull request's unresolved comment threads: asks that are worth it and safe get implemented on the branch, and every thread gets a reply. These criteria set that bar. Keep several on hand, but only one is applied."
- kind="resolution"
- kindLabel="resolution criteria"
- createLabel="Create your own resolution criteria"
- skills={resolutionSkills?.map((s) => ({ ...s, on: s.active })) ?? null}
- onSelect={selectResolutionSkill}
- />
- </section>
- <UrgencySection />
+ {activeTab === 'activity' ? <ActivityTab /> : <SettingsTab />}
+ {/* Overlays stay mounted on both tabs, so a `?review=` deep link opens on either. */}
<SkillDrawer />
<AdoptSkillModal />
<ReviewDetailDrawer />
diff --git a/products/review_hog/frontend/reviewHogSettingsLogic.test.ts b/products/review_hog/frontend/reviewHogSettingsLogic.test.ts
index 88328608428d..20d7d9589e51 100644
--- a/products/review_hog/frontend/reviewHogSettingsLogic.test.ts
+++ b/products/review_hog/frontend/reviewHogSettingsLogic.test.ts
@@ -406,6 +406,21 @@ describe('reviewHogSettingsLogic', () => {
expect(logic.values.reviewDrawerOpen).toBe(false)
})
+ it('opens the tab from ?tab= and mirrors tab changes back to the URL', async () => {
+ logic.mount()
+ router.actions.push(urls.codeReview(), { tab: 'settings' })
+ expect(logic.values.activeTab).toBe('settings')
+
+ // Activity is the default, so it keeps the URL clean; other params survive the write.
+ router.actions.push(urls.codeReview(), { tab: 'settings', reviews_scope: 'everyone' })
+ logic.actions.setActiveTab('activity')
+ expect(router.values.searchParams.tab).toBeUndefined()
+ expect(router.values.searchParams.reviews_scope).toBe('everyone')
+
+ logic.actions.setActiveTab('settings')
+ expect(router.values.searchParams.tab).toBe('settings')
+ })
+
it('closes a deep-linked drawer when the review fails to load', async () => {
// A stale ?review= link (deleted report, wrong project) has no list row to fall back on —
// without the failure path the drawer would sit open on skeletons forever.
diff --git a/products/review_hog/frontend/reviewHogSettingsLogic.ts b/products/review_hog/frontend/reviewHogSettingsLogic.ts
index 2177017f7fee..be940e6fc892 100644
--- a/products/review_hog/frontend/reviewHogSettingsLogic.ts
+++ b/products/review_hog/frontend/reviewHogSettingsLogic.ts
@@ -51,6 +51,8 @@ export type ReviewSkillKind = 'perspective' | 'blind_spots' | 'validator' | 'res
export type ReviewDrawerTab = 'published' | 'below_threshold' | 'dismissed' | 'chunks' | 'review'
+export type CodeReviewTab = 'activity' | 'settings'
+
export const REVIEW_PRIORITY_RANK: Record<ReviewIssuePriorityEnumApi, number> = {
consider: 0,
should_fix: 1,
@@ -229,6 +231,7 @@ function parsePrPath(url: string): string | null {
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface reviewHogSettingsLogicValues {
+ activeTab: CodeReviewTab
adoptNewSkillName: string
adoptSkillGroups: SkillPickerGroup[]
adoptSkillKind: ReviewSkillKind | null
@@ -474,6 +477,9 @@ export interface reviewHogSettingsLogicActions {
selectValidator: (skillName: string) => {
skillName: string
}
+ setActiveTab: (tab: CodeReviewTab) => {
+ tab: CodeReviewTab
+ }
setAdoptSlug: (slug: string) => {
slug: string
}
@@ -630,12 +636,13 @@ export const reviewHogSettingsLogic = kea<reviewHogSettingsLogicType>([
closeReviewDrawer: true,
openPipelineDetail: true,
closePipelineDetail: true,
+ setActiveTab: (tab: CodeReviewTab) => ({ tab }),
setReviewDrawerTab: (tab: ReviewDrawerTab) => ({ tab }),
toggleReviewRowExpanded: (reviewId: string) => ({ reviewId }),
setReviewsScope: (scope: ReviewHogReviewsListScope) => ({ scope }),
showMoreReviews: true,
showFewerReviews: true,
- // Auto-select a default scope (Entire project when the user has no reviews of their own)
+ // Auto-select a default scope (Everyone when the user has no reviews of their own)
// without marking it as an explicit user choice, so a later real choice still wins.
applyDefaultReviewsScope: (scope: ReviewHogReviewsListScope) => ({ scope }),
startSkillAuthorTask: (kind: ReviewSkillKind) => ({ kind }),
@@ -860,6 +867,12 @@ export const reviewHogSettingsLogic = kea<reviewHogSettingsLogicType>([
closePipelineDetail: () => false,
},
],
+ activeTab: [
+ 'activity' as CodeReviewTab,
+ {
+ setActiveTab: (_, { tab }) => tab,
+ },
+ ],
reviewDrawerTab: [
'published' as ReviewDrawerTab,
{
@@ -920,9 +933,9 @@ export const reviewHogSettingsLogic = kea<reviewHogSettingsLogicType>([
loadRecentReviewsFailure: () => false,
},
],
- // The page-level "For you / Entire project" switch (mirroring the inbox's): it scopes the
- // recent-reviews list AND every stat surface fed by perspectiveStats (hero proof card,
- // effectiveness cards). Skill lists and their toggles stay per-user regardless.
+ // The "Mine / Everyone" filter on the recent-reviews list: it scopes the list AND every stat
+ // surface fed by perspectiveStats (proof card, effectiveness cards on the Settings tab).
+ // Skill lists and their toggles stay per-user regardless.
reviewsScope: [
ReviewHogReviewsListScope.Mine as ReviewHogReviewsListScope,
{ persist: true },
@@ -932,7 +945,7 @@ export const reviewHogSettingsLogic = kea<reviewHogSettingsLogicType>([
},
],
// Whether the user has explicitly picked a scope. Once true, the empty-list auto-default
- // no longer fires, so a deliberate choice of "For you" is respected even with zero reviews.
+ // no longer fires, so a deliberate choice of "Mine" is respected even with zero reviews.
// A shared link is an explicit choice too, so URL hydration goes through setReviewsScope.
hasUserChosenReviewsScope: [
false,
@@ -1502,6 +1515,7 @@ export const reviewHogSettingsLogic = kea<reviewHogSettingsLogicType>([
// can be shared via a link; the default scope keeps the URL clean. The auto-default deliberately
// does NOT write the URL: hydrating from a link marks the scope as chosen (below), so mirroring
// the fallback would silently upgrade it into a permanent explicit choice on reload.
+ // The tab mirrors to `?tab=settings` so a link can open the Settings tab; Activity keeps the URL clean.
// The drawer mirrors to `?review=<report id>` the same way — a PERMANENT PUBLIC CONTRACT (PR
// status comments bake these links into GitHub, where they are never re-edited). Always
// `replace`, never push, so opening/closing the drawer doesn't stack history entries.
@@ -1525,6 +1539,15 @@ export const reviewHogSettingsLogic = kea<reviewHogSettingsLogicType>([
router.values.hashParams,
{ replace: true },
],
+ setActiveTab: (): [string, Record<string, any>, Record<string, any>, { replace: boolean }] => [
+ router.values.location.pathname,
+ {
+ ...router.values.searchParams,
+ tab: values.activeTab === 'activity' ? undefined : values.activeTab,
+ },
+ router.values.hashParams,
+ { replace: true },
+ ],
openReviewDetail: ({ review }) => withReviewParam(review.id),
openReviewDetailById: ({ reviewId }) => withReviewParam(reviewId),
closeReviewDrawer: () => withReviewParam(undefined),
@@ -1540,6 +1563,10 @@ export const reviewHogSettingsLogic = kea<reviewHogSettingsLogicType>([
) {
actions.setReviewsScope(parsed)
}
+ const tab: CodeReviewTab = searchParams.tab === 'settings' ? 'settings' : 'activity'
+ if (tab !== values.activeTab) {
+ actions.setActiveTab(tab)
+ }
// ?review=<report id>: open that review's drawer. `openedReviewId` (set synchronously by
// both open paths) makes the guard hold before the detail loads, so the open's own URL
// write-back — a repeat location event with the same param — can't re-dispatch forever.