: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(experiments): health panel UI improvements (#129963)
Marcel Poelker76fb2d9039ee
diff --git a/frontend/snapshots.yml b/frontend/snapshots.ymlindex f9b0ce2b7fb8..a9ff690b3cf3 100644--- a/frontend/snapshots.yml+++ b/frontend/snapshots.yml@@ -3404,50 +3404,30 @@ snapshots:hash: v1.k794b7964.7cb2348662f942bc00e904aca1cf74990ac3b8e25549be308b29e907c156d0eb.WQ5R8L0lbbFdH9oG3RShU2S1nHfj_SHpnz9PrjLAx6Aerrortracking-volumesparkline--events-before-data-range--light:hash: v1.k794b7964.c88c4e3b028915efba3fdbbac7107a063662d8210dfb6ba8667e96d719fa3d4f.tzwEQFa4F1f1O9PGqBkcaqSavbFVgAwPAjyh9Uf9NL8- experiments-healthchecksoverview--check-details-from-an-answer-cached-before-the-values--dark:- hash: v1.k794b7964.8f06822792edb869dc302b1b55548e750711a680282af87becf23fa05ff88d0d.d5sAlitIKlk05A9pvaewVVf5bmgf-Jxn0WhagfbAam4- experiments-healthchecksoverview--check-details-from-an-answer-cached-before-the-values--light:- hash: v1.k794b7964.3e6c929f9052c3e07b0a179bddf874b6f3389a6cc7a2cf13b3dea38eeb53411f.LV5Czi7t5fgxV4apeVQOOYZqBBxBH4SVLVQ5bcmLzZo- experiments-healthchecksoverview--check-details-of-a-check-that-does-not-apply--dark:- hash: v1.k794b7964.f9a702503f7f187702a14ddd3de2e6e87d1a2a9eeb93e5c0944b008f60fc2406.OfmUY-ruWZYUwkuauRF1-UvnqXLIVIkNISJloTzaa5I- experiments-healthchecksoverview--check-details-of-a-check-that-does-not-apply--light:- hash: v1.k794b7964.1ad45af88c4579b2bca14bd94ca1e8db84fb9d1b0dd930972a718c49db52d3bb.JA0TofrwELYzgN6_hJRbKtoUgq9d7e6iA8gFkntEl-A- experiments-healthchecksoverview--check-details-with-what-it-read--dark:- hash: v1.k794b7964.15654ee956b9a9d101396b1b7970b7a5864812b6ddeceb943d122996334ed09a.V-Gvw6sFRFzPGS4jTAAvqqo9pi3pEOh3Z-iuU5wjVyg- experiments-healthchecksoverview--check-details-with-what-it-read--light:- hash: v1.k794b7964.1e88a7a4ee790962b68b1be6e6ba05335df73a2440c17800339c1facf04c6cef.bP3feLTH_LmNroRUhcey63jaQ2rbbawbccTEhC1RhiM- experiments-healthchecksoverview--checks-that-could-not-run--dark:- hash: v1.k794b7964.d5ff75d2345d4acad2dd357cbe3cb0eac67c0a2e91cb936e72775a4d2d77198b.3UZCkvoHukOJrcqPAJECf262qjn1mVcGr9bjEHUdcc8- experiments-healthchecksoverview--checks-that-could-not-run--light:- hash: v1.k794b7964.6446f8babaebdd8b81ddd828f1031a1ae80f26f85a1aaa181c3b4eaf9a93c547.KqHa1VyB5KyRLkIbZEfDHPEw0lophWgsO9uok7Zgp8Y- experiments-healthchecksoverview--draft--dark:- hash: v1.k794b7964.80d8b34eaf6e2b119692d44a3b9dc07fb0292001d41b8a0acc1623a4fed8bb10.4iISmQeCOJBV6HenWEbD9iLVn80J9O0kWz_QtGwkXoc- experiments-healthchecksoverview--draft--light:- hash: v1.k794b7964.678e7486ead3fd5e8476124bd525fbf1dbefb6340bde0318f6fda206fbe2d150.wKVKdMEYziHlPLyjMxi9JyyJVnKcRTHDqUCTLAJXJ9c- experiments-healthchecksoverview--draft-with-events-not-received--dark:- hash: v1.k794b7964.6993e570e66f28385d6f90c5fd7327238c1f8cb33e14a0f0d114142a2d3cf415.q5LY1guwiqXaN_A6t6AKeUbOySr3n6gVyCF65URiAbk- experiments-healthchecksoverview--draft-with-events-not-received--light:- hash: v1.k794b7964.1cf599b962a0359cc2ddedb5aca6d265cf1e8e61e542688f642427c03cb6f867.hykUIYStN2_H2jq0WxAfvDpFAR8xR5RslDKlR0aDo8s- experiments-healthchecksoverview--narrow-with-an-issue--dark:- hash: v1.k794b7964.9718730e1a0d477004c4bb34c5faf5a2763f67864e6231b5c0852c7bfbd0ae07.JSr581FVrLGjyPO3svu7NNijgQGwkEf2ANN-Wkm5g2o- experiments-healthchecksoverview--narrow-with-an-issue--light:- hash: v1.k794b7964.d8deed8c590e874802ae03f8cbd5868dd05fe39a7f8e08234b073df8420f5ba6.i4Sxti3ECbsyi78FEv9DpEyUdtqRThBEn6dK579IDGc- experiments-healthchecksoverview--nothing-to-fix--dark:- hash: v1.k794b7964.b5775825d9c3c2cb42f08e9d924b53e72349ad819f0b39059c59612c0c5c3c38.ILV2tLsPBEFrkCSTe2V_154Ygy3SIU3t02tT8HxMk18- experiments-healthchecksoverview--nothing-to-fix--light:- hash: v1.k794b7964.cb2740830df02f246e5e583a5a932b89675a18d372bb9ee950189bd4ba5b587c.FIiF22sl59xysGx9kRsn56UCjjs04StNSgBCd-dZqEA- experiments-healthchecksoverview--running-with-an-issue--dark:- hash: v1.k794b7964.cfeab0bb22f3c73d6a3cc9d03badffaaee9cc8f6ba57a7f5ae5b8a12db5dbf9b.qPfC-Q6cR-Et4ycTR5ATF1gDFW6_Zyo40kqy_D-xdFo- experiments-healthchecksoverview--running-with-an-issue--light:- hash: v1.k794b7964.e0b528bdab2ca1dd5732c5e6862f9aa5e8d50609e8de1b69410258a615a153e2.LVlExPVbLi5Pp_iCgEPyfiUQvj-qL-2KmilHtk8ruBE- experiments-healthchecksoverview--running-with-metric-windows-not-complete--dark:- hash: v1.k794b7964.d57e30783abd1f0d6448f28461131248858a0e43d99444dd1ab5a65966a46842.KSkJ9WFy6ed_Xey7QR8R8mrYY9KSjO1IdXkNUw9eW-o- experiments-healthchecksoverview--running-with-metric-windows-not-complete--light:- hash: v1.k794b7964.5084584e83f8fe4c09292423b875b194212ab07f6facff466ebb09a31840fba8.lB0STpZwwj3obAUJM6DtowBvXEWQebWoqE8XUxiWA5M- experiments-healthchecksoverview--running-with-significance-on-a-small-sample--dark:- hash: v1.k794b7964.f5000f107e4b86ada149997b6857bb26fbac21ff340dac43f639529afd0b2e16.rGkjvMCD2W33zjvTcOOhnqBBZfCajq7UBWYXXpwglsc- experiments-healthchecksoverview--running-with-significance-on-a-small-sample--light:- hash: v1.k794b7964.85c6232b61d332c1027575be6d240043f8b146d1f5aab7392935024396aeef1d.2gjoE0_YzfcmmBAnySN4x_3cFZQZyvhUCG2YGE3iK4g+ experiments-healthcheckspanel--check-details-with-what-it-read--dark:+ hash: v1.k794b7964.ddbe021e2c89eeb0536d1c54add63da823081b5133f4af4979b0d685e6a819dc.MYeoibRiaMpJ4GWN7IWF0pndZpF_Ea_zMoQaowruNfo+ experiments-healthcheckspanel--check-details-with-what-it-read--light:+ hash: v1.k794b7964.b972235ea0cb78fba70fc272ed054ce88a62574b00c9e96a6982cc2ce7a12bb0.BIUsDQpbw4WXHA5kHVv_z3CNtRYDMXDtaf3Qf3ye-fw+ experiments-healthcheckspanel--checks-that-could-not-run--dark:+ hash: v1.k794b7964.d40e32b4f02cc8c2f28f8bba9259ea6a7b8619e7f017cb46805e2c81620a57e6.XVGhNx-c0kkMWKv2YMy5EodyfCUzr_dLBnQgub9iwTc+ experiments-healthcheckspanel--checks-that-could-not-run--light:+ hash: v1.k794b7964.f14b364697e2e9fe04df324b25c81aedf2a72271a50a5a385c0ddbb966e18394.YmcUvdrSNrxrLVnF00NfBKypA3uGWNVBfmWInrTDAZ8+ experiments-healthcheckspanel--draft--dark:+ hash: v1.k794b7964.12c43a4e3af6f3f141e99358b4f430e5631f228e14da63628f66ba5ca3ede944.YSoOqvyDsvDsbSdiqFOw0WB8KR0nArtowhludsTh2gg+ experiments-healthcheckspanel--draft--light:+ hash: v1.k794b7964.9a731c4ad2004e45422138702b183fae8eca71e089f90f7cf2ed9bcc523ed830.jmwofiT4P521SlI3K3aCMAZGIDsDg3xfdQApfLhotFk+ experiments-healthcheckspanel--issue-details--dark:+ hash: v1.k794b7964.20959570e46e358ad5efdbf6ffcb3f2f807356cdcc07780bbd3f48d5553bf75d.7CYm_laYDOXD7hMnqJYVG1ckMWL2kCbRT7umMF_Fn_g+ experiments-healthcheckspanel--issue-details--light:+ hash: v1.k794b7964.4a8af83fde716aadd87689e4f76178573cc50f3aa83d01cff7aeabd8d4503769.CzUe0qt2yeZoPe8bKVGVySkf-kZOEmQLcKvkYvGZWvI+ experiments-healthcheckspanel--narrow-with-an-issue--dark:+ hash: v1.k794b7964.48456222f795d3edb94017143a9c5c15a920392118965c6bad6a6885dc71cce7.BvsCbEkztwGHiodNVeB4GFpi1apkGig-K_NimZy7ndE+ experiments-healthcheckspanel--narrow-with-an-issue--light:+ hash: v1.k794b7964.79b21158d70a6475aa255d50d6cd9345bd9b37c6ff1705b7601ffe24597ea2b6.Tz0BCGqeLvaQgEIgzuVKbqG-e9u6_TsLozrf28cicNM+ experiments-healthcheckspanel--running-with-an-issue--dark:+ hash: v1.k794b7964.4c136751c92c11ae57dffe849c99e33edebba097e9f9db34e24c92912ae3c70e.Kr2h1nmE2OO9EJNr-VL8fHkChi8li0ZeLBpSY8gzb-U+ experiments-healthcheckspanel--running-with-an-issue--light:+ hash: v1.k794b7964.a65e2d0ecaeef87c76951bfa3c27c6db4bcfc8916de08c457dc78e5247f51b7e.7ir3doo4oeNTqJxo8_cWZkBWEb6Y_EGrR7fRQEG4FyMexperiments-howtoreadtooltip--intervals-bayesian--dark:hash: v1.k794b7964.a06d267cee9cb54bafc732335b35d461d3c1a59250c6daa8becace0fcb8492d2.vR5tecOozn6B51xE8LrByAFVsi03J4w-iUu-j2hQUTUexperiments-howtoreadtooltip--intervals-bayesian--light:diff --git a/frontend/src/scenes/experiments/ExperimentView/healthFindingReporting.test.tsx b/frontend/src/scenes/experiments/ExperimentView/healthFindingReporting.test.tsxindex 7898933d97b2..c5e9fe01659b 100644--- a/frontend/src/scenes/experiments/ExperimentView/healthFindingReporting.test.tsx+++ b/frontend/src/scenes/experiments/ExperimentView/healthFindingReporting.test.tsx@@ -234,7 +234,7 @@ describe('health finding reporting', () => {it.each([{- pick: null,+ pick: 'The experiment is paused',control: 'Open feature flag',step: 'acted on',code: 'flag_off_while_running',@@ -251,9 +251,7 @@ describe('health finding reporting', () => {'reports $code as $step with $kind when a person uses "$control" in the health tab',async ({ pick, control, step, code, kind }) => {renderHealth(UNEVEN_EXPOSURES)- if (pick) {- await pickFromList(pick)- }+ await pickFromList(pick)captureSpy.mockClear()await userEvent.click(screen.getByText(control))@@ -267,6 +265,7 @@ describe('health finding reporting', () => {container: 'wide',isNarrow: false,expected: [+ ['experiment health finding opened', 'flag_off_while_running'],['experiment health finding opened', 'srm'],['experiment health check expanded', 'no_metric'],['experiment health summary opened', undefined],@@ -293,7 +292,7 @@ describe('health finding reporting', () => {narrowStyles.textContent = isNarrow ? '.hidden { display: none; }' : ''try {renderHealth(UNEVEN_EXPOSURES)- expect(screen.getByText(/The linked feature flag is disabled/)).toBeInTheDocument()+ expect(screen.getByText('Overview')).toBeInTheDocument()const pickEvents = (): (string | undefined)[][] =>captureSpy.mock.calls.filter(([event]) =>diff --git a/frontend/src/scenes/experiments/experimentLogic.tsx b/frontend/src/scenes/experiments/experimentLogic.tsxindex a6b173d4397a..5368b1a8d23d 100644--- a/frontend/src/scenes/experiments/experimentLogic.tsx+++ b/frontend/src/scenes/experiments/experimentLogic.tsx@@ -84,7 +84,7 @@ import {type ExperimentHealthUi,captureExperimentHealthChecked,captureExperimentHealthCheckExpanded,- captureExperimentHealthSummaryOpened,+ captureExperimentHealthOverviewOpened,captureExperimentHealthChecksOpened,captureExperimentHealthFindingActedOn,captureExperimentHealthFindingOpened,@@ -784,7 +784,7 @@ export interface experimentLogicActions {reportHealthFindingShown: (finding: ExperimentHealthFinding) => {finding: ExperimentHealthFinding}- reportHealthSummaryOpened: () => {+ reportHealthOverviewOpened: () => {value: true}resetRunningExperiment: () => {@@ -1098,7 +1098,7 @@ export const experimentLogic = kea<experimentLogicType>([) => ({ finding, actionKind }),reportHealthChecksOpened: (openedFrom: ExperimentHealthChecksOpenedFrom) => ({ openedFrom }),reportHealthCheckExpanded: (check: HealthPanelCheck) => ({ check }),- reportHealthSummaryOpened: true,+ reportHealthOverviewOpened: true,setExperimentMissing: true,setExperiment: (experiment: Partial<Experiment>) => ({ experiment }),setLaunchExperimentLoading: (loading: boolean) => ({ loading }),@@ -1587,8 +1587,8 @@ export const experimentLogic = kea<experimentLogicType>([reportHealthCheckExpanded: ({ check }) => {captureExperimentHealthCheckExpanded(values.experiment, check, values.healthUi)},- reportHealthSummaryOpened: () => {- captureExperimentHealthSummaryOpened(+ reportHealthOverviewOpened: () => {+ captureExperimentHealthOverviewOpened(values.experiment,values.healthChecks ?? [],values.healthFindings?.length ?? 0,diff --git a/frontend/src/scenes/experiments/stories/ExperimentHealthTab.stories.tsx b/frontend/src/scenes/experiments/stories/ExperimentHealthTab.stories.tsxindex 47ed5988eb31..974813a11117 100644--- a/frontend/src/scenes/experiments/stories/ExperimentHealthTab.stories.tsx+++ b/frontend/src/scenes/experiments/stories/ExperimentHealthTab.stories.tsx@@ -111,18 +111,6 @@ const EXPOSURES_WITH_SRM = {health_checks: withStatus(EXPOSURE_CHECKS, 'srm', 'finding'),}-const METRIC_NOTE = {- code: 'metrics_not_matured',- subcode: null,- reason: null,- severity: 'info',- title: 'Some users are still inside the conversion window',- detail: 'The primary metric counts conversions up to 7 days after exposure. Users exposed in the last 7 days can still convert, so the results can still change.',- evidence: {},- actions: [],- diagnostic_ref: null,-}-const RECALCULATION = recalculationMocks(EXPERIMENT_WITH_MEAN_METRIC,resultsByMetricType(EXPERIMENT_WITH_MEAN_METRIC, { mean: MEAN_METRIC_RESULT })@@ -167,14 +155,7 @@ export default metatype Story = StoryObj<{}>export const AllChecksPassed: Story = {- decorators: [- mswDecorator(- healthMocks(- { findings: [METRIC_NOTE], checks: withStatus(EXPERIMENT_CHECKS, 'metrics_not_matured', 'finding') },- HEALTHY_EXPOSURES- )- ),- ],+ decorators: [mswDecorator(healthMocks({ findings: [], checks: EXPERIMENT_CHECKS }, HEALTHY_EXPOSURES))],play: async () => {await makeDelay(1500)()},diff --git a/products/experiments/frontend/health/ExperimentHealthChip.tsx b/products/experiments/frontend/health/ExperimentHealthChip.tsxindex 2c1489588e05..2976131d697a 100644--- a/products/experiments/frontend/health/ExperimentHealthChip.tsx+++ b/products/experiments/frontend/health/ExperimentHealthChip.tsx@@ -2,7 +2,7 @@ import { useActions, useValues } from 'kea'import { useEffect } from 'react'import { IconWarning } from '@posthog/icons'-import { LemonButton, Spinner } from '@posthog/lemon-ui'+import { LemonButton } from '@posthog/lemon-ui'import { pluralize } from 'lib/utils/strings'import { experimentLogic } from 'scenes/experiments/experimentLogic'@@ -12,10 +12,10 @@ import { healthChipState } from './healthPanelChecks'import { healthIssues } from './healthPanelFindings'export function ExperimentHealthChip(): JSX.Element | null {- const { healthFindings, healthChecks, healthExposureChecks, experimentLoadCount } = useValues(experimentLogic)+ const { healthFindings, experimentLoadCount } = useValues(experimentLogic)const { reportHealthChecksOpened, reportHealthFindingShown } = useActions(experimentLogic)const { setActiveTabKey } = useActions(experimentSceneLogic)- const state = healthChipState(healthFindings, healthChecks, healthExposureChecks)+ const state = healthChipState(healthFindings)// The chip is the sign of an issue on every tab, so it reports the issues as shown on load. The logic reports each// finding once per load, so the health tab does not report them again.@@ -28,19 +28,11 @@ export function ExperimentHealthChip(): JSX.Element | null {if (state.kind === 'hidden') {return null}- if (state.kind === 'pending') {- return (- <span className="flex items-center gap-1 text-secondary" data-attr="experiment-health-chip-pending">- <Spinner className="text-sm" />- <span>Checking health</span>- </span>- )- }const openHealthTab = (): void => {setActiveTabKey('health')reportHealthChecksOpened('meta_bar')}- return state.kind === 'issues' ? (+ return (<LemonButtontype="secondary"size="xsmall"@@ -51,15 +43,5 @@ export function ExperimentHealthChip(): JSX.Element | null {>{pluralize(state.count, 'issue')}</LemonButton>- ) : (- <LemonButton- type="tertiary"- size="xsmall"- tooltip="Show the health checks"- onClick={openHealthTab}- data-attr="experiment-health-checks-button"- >- <span className="font-normal">{state.label}</span>- </LemonButton>)}diff --git a/products/experiments/frontend/health/ExperimentHealthTab.tsx b/products/experiments/frontend/health/ExperimentHealthTab.tsxindex 7e1e91a47491..680f8e3152c8 100644--- a/products/experiments/frontend/health/ExperimentHealthTab.tsx+++ b/products/experiments/frontend/health/ExperimentHealthTab.tsx@@ -4,7 +4,7 @@ import { LemonBanner, LemonCard, Spinner } from '@posthog/lemon-ui'import { experimentLogic } from 'scenes/experiments/experimentLogic'-import { HealthChecksOverview } from './HealthChecksOverview'+import { HealthChecksPanel } from './HealthChecksPanel'export function ExperimentHealthTab(): JSX.Element {const {@@ -30,7 +30,7 @@ export function ExperimentHealthTab(): JSX.Element {return (<div className="flex flex-col gap-2" data-attr="experiment-health-tab"><LemonCard hoverEffect={false} className="p-0">- <HealthChecksOverview+ <HealthChecksPanelchecks={healthChecks}findings={healthFindings}// A reset to draft keeps the previous exposure answer in the page, as for the checks.diff --git a/products/experiments/frontend/health/HealthCheckDetail.tsx b/products/experiments/frontend/health/HealthCheckDetail.tsxindex f43c0abdb7dd..fc54a52821e0 100644--- a/products/experiments/frontend/health/HealthCheckDetail.tsx+++ b/products/experiments/frontend/health/HealthCheckDetail.tsx@@ -18,13 +18,13 @@ export function HealthCheckDetail({checkedAt: string | null}): JSX.Element {return (- <div className="flex flex-col gap-4" data-attr="experiment-health-check-detail">+ <div className="flex flex-col gap-6" data-attr="experiment-health-check-detail"><div className="flex flex-col gap-1">- <h3 className="m-0 flex items-center gap-2 text-base font-semibold">- <span className="flex shrink-0">{HEALTH_CHECK_STATUS_DISPLAY[check.status].icon}</span>+ <h3 className="m-0 flex items-start gap-2 text-xl font-semibold">+ <span className="flex shrink-0 pt-1">{HEALTH_CHECK_STATUS_DISPLAY[check.status].icon}</span><span>{check.name}</span></h3>- <span className="pl-6 text-xs text-secondary">{healthCheckStatusText(check)}</span>+ <span className="pl-7 text-xs text-secondary">{healthCheckStatusText(check)}</span></div>{check.description && (<HealthPanelSection title="What it looks for">diff --git a/products/experiments/frontend/health/HealthCheckList.tsx b/products/experiments/frontend/health/HealthCheckList.tsxindex 94afe5385be9..7c62fcefc271 100644--- a/products/experiments/frontend/health/HealthCheckList.tsx+++ b/products/experiments/frontend/health/HealthCheckList.tsx@@ -36,10 +36,10 @@ export function HealthCheckList({onSelect: (check: ListedHealthCheck) => void}): JSX.Element {return (- <div className="flex flex-col gap-4 px-3 py-2" data-attr="experiment-health-check-list">+ <div className="flex flex-col gap-5 px-4 py-3" data-attr="experiment-health-check-list">{exposureChecksMissing && (// The exposure checks come with the exposure answer, so without one the page has no names for them.- <div className="flex flex-col gap-1">+ <div className="flex flex-col gap-1.5"><span className="text-xs font-semibold text-secondary">Couldn't check. Refresh the results to run these checks.</span>@@ -51,7 +51,7 @@ export function HealthCheckList({</div>)}{groupByOutcome(checks).map((group) => (- <div key={`${group.status}:${group.label}`} className="flex flex-col gap-1">+ <div key={`${group.status}:${group.label}`} className="flex flex-col gap-1.5"><span className="text-xs font-semibold text-secondary">{group.label}</span><ul className="-mx-2 m-0 p-0 list-none flex flex-col">{group.checks.map((check) => (diff --git a/products/experiments/frontend/health/HealthChecksCoverageNote.tsx b/products/experiments/frontend/health/HealthChecksCoverageNote.tsxnew file mode 100644index 000000000000..afaefb6476c3--- /dev/null+++ b/products/experiments/frontend/health/HealthChecksCoverageNote.tsx@@ -0,0 +1,10 @@+export function HealthChecksCoverageNote({ isDraft }: { isDraft: boolean }): JSX.Element {+ return (+ // Spans only, because the note sits inside the button that opens the overview.+ // pinned: `data-attr` value, so renaming it breaks autocapture insights+ <span className="text-secondary" data-attr="experiment-health-summary">+ {isDraft && <span>More checks run after launch. </span>}+ <span>We're still adding checks, so they don't cover every problem yet.</span>+ </span>+ )+}diff --git a/products/experiments/frontend/health/HealthChecksOverview.stories.tsx b/products/experiments/frontend/health/HealthChecksPanel.stories.tsxsimilarity index 64%rename from products/experiments/frontend/health/HealthChecksOverview.stories.tsxrename to products/experiments/frontend/health/HealthChecksPanel.stories.tsxindex 6dca5e7a9d2e..6f897dd5c1c0 100644--- a/products/experiments/frontend/health/HealthChecksOverview.stories.tsx+++ b/products/experiments/frontend/health/HealthChecksPanel.stories.tsx@@ -6,7 +6,7 @@ import { type ExperimentExposureQueryResponse, NodeKind } from '~/queries/schemaimport { userEvent } from 'storybook/test'import type { ExperimentHealthCheckResultApi, ExperimentHealthCheckRuleApi } from '../generated/api.schemas'-import { HealthChecksOverview } from './HealthChecksOverview'+import { HealthChecksPanel } from './HealthChecksPanel'import type { HealthPanelCheck } from './healthPanelChecks'import type { HealthPanelFinding } from './healthPanelFindings'@@ -56,9 +56,9 @@ const FLAG_SETUP_CHECKS = [passed('forced_variant_release_condition', 'Release conditions that force a variant'),]-const meta: Meta<typeof HealthChecksOverview> = {- title: 'Experiments/HealthChecksOverview',- component: HealthChecksOverview,+const meta: Meta<typeof HealthChecksPanel> = {+ title: 'Experiments/HealthChecksPanel',+ component: HealthChecksPanel,parameters: {layout: 'centered',mockDate: '2026-11-03 12:00:00',@@ -75,7 +75,7 @@ const meta: Meta<typeof HealthChecksOverview> = {}export default meta-type Story = StoryObj<typeof HealthChecksOverview>+type Story = StoryObj<typeof HealthChecksPanel>export const Draft: Story = {args: {@@ -116,100 +116,6 @@ const found = (key: HealthPanelCheck['key'], name: string): ExperimentHealthChecrule: null,})-export const DraftWithEventsNotReceived: Story = {- args: {- checks: [- ...FLAG_SETUP_CHECKS,- skipped('no_metric', 'Metrics not set up', 'not_applicable', 'Runs after launch'),- found('metric_event_not_ingested', 'Metric events not received yet'),- found('exposure_criteria_cannot_match', "Exposure criteria that can't match"),- ],- findings: [- {- code: 'metric_event_not_ingested',- subcode: null,- reason: null,- severity: 'info',- title: "A metric uses an event this project hasn't received",- detail: 'The primary metric "Revenue" uses the event "purchase_completed", which this project hasn\'t received yet. Until it arrives, the metric can\'t compare the variants. Launch the experiment after your code starts sending it.',- evidence: {- metric_1: 'Revenue',- metric_1_role: 'primary',- metric_1_events: 'purchase_completed',- },- actions: [],- },- {- code: 'exposure_criteria_cannot_match',- subcode: 'exposure_event_not_ingested',- reason: null,- severity: 'info',- title: "This project hasn't received the exposure event",- detail: 'The experiment counts users as exposed when they send the event "checkout_viewed", which this project hasn\'t received yet. Until it arrives, nobody is counted as exposed. Launch the experiment after your code starts sending it.',- evidence: { event: 'checkout_viewed' },- actions: ['edit_exposure_criteria'],- },- ],- isDraft: true,- exposureChecksMissing: false,- },-}--export const RunningWithSignificanceOnASmallSample: Story = {- args: {- checks: [- ...FLAG_SETUP_CHECKS,- passed('no_metric', 'Metrics not set up'),- found('early_significance', 'Significance on a small sample'),- ],- findings: [- {- code: 'early_significance',- subcode: 'below_detectable_effect',- reason: null,- severity: 'info',- title: 'Significant result on a small sample',- detail: 'The variant "test" shows a +20% difference on the metric "Checkout", which is significant. With 2,000 users so far, the experiment can reliably detect differences of about 38% or more, so this difference may shrink or go away as more users arrive. The running time estimate needs about 3,201 users to detect a 30% difference. Wait for that sample before you decide.',- evidence: {- variant: 'test',- observed_effect: 20,- detectable_effect: 37.9,- minimum_detectable_effect: 30,- samples: 2000,- planned_samples: 3201,- },- actions: [],- },- ],- isDraft: false,- exposureChecksMissing: false,- },-}--export const RunningWithMetricWindowsNotComplete: Story = {- args: {- checks: [- ...FLAG_SETUP_CHECKS,- passed('no_metric', 'Metrics not set up'),- found('metrics_not_matured', 'Metric windows not complete yet'),- ],- findings: [- {- code: 'metrics_not_matured',- subcode: null,- reason: null,- severity: 'info',- title: "No results yet because the metric windows aren't complete",- detail: 'The Exposures panel counts users without waiting for these windows. A metric counts a user only after its conversion or retention window has passed, so no primary metric has results yet. The first users can count for "Checkout" on October 5, 2026 at 2:00 PM CEST and for "Return visits" on October 15, 2026 at 2:00 PM CEST. To see results sooner, turn off "Require completed conversion or retention window" in the experiment\'s Settings tab. Users whose window is still open then count too.',- evidence: { hours_since_launch: 72, first_users_count_at: '2026-10-05T12:00:00+00:00' },- actions: [],- },- ],- isDraft: false,- exposureChecksMissing: false,- },-}-export const ChecksThatCouldNotRun: Story = {args: {checks: [@@ -343,46 +249,18 @@ export const RunningWithAnIssue: Story = {},}-export const NothingToFix: Story = {- args: {- checks: READ_CHECKS,- findings: [],- exposures: UNEVEN_SPLIT_EXPOSURES,- isDraft: false,- exposureChecksMissing: false,- },-}--export const CheckDetailsWithWhatItRead: Story = {- args: NothingToFix.args,- play: async ({ canvasElement }) => {- await userEvent.click(- await within(canvasElement).findByRole('button', { name: /Split of users across variants/ })- )- },-}--export const CheckDetailsOfACheckThatDoesNotApply: Story = {- args: NothingToFix.args,+export const IssueDetails: Story = {+ args: RunningWithAnIssue.args,play: async ({ canvasElement }) => {await userEvent.click(- await within(canvasElement).findByRole('button', { name: /Metric windows not complete yet/ })+ await within(canvasElement).findByRole('button', { name: /The uneven split may bias the results/ }))},}-export const CheckDetailsFromAnAnswerCachedBeforeTheValues: Story = {+export const CheckDetailsWithWhatItRead: Story = {args: {- checks: [- ...FLAG_SETUP_CHECKS,- {- key: 'srm',- name: 'Split of users across variants',- description: description('srm'),- status: 'passed',- reason: null,- },- ],+ checks: READ_CHECKS,findings: [],exposures: UNEVEN_SPLIT_EXPOSURES,isDraft: false,diff --git a/products/experiments/frontend/health/HealthChecksOverview.tsx b/products/experiments/frontend/health/HealthChecksPanel.tsxsimilarity index 84%rename from products/experiments/frontend/health/HealthChecksOverview.tsxrename to products/experiments/frontend/health/HealthChecksPanel.tsxindex 8132daa2c069..2cd4f43424fd 100644--- a/products/experiments/frontend/health/HealthChecksOverview.tsx+++ b/products/experiments/frontend/health/HealthChecksPanel.tsx@@ -13,15 +13,15 @@ import type { ExperimentExposureQueryResponse } from '~/queries/schema/schema-geimport { exposureAnswerComputedAt } from './exposureHealth'import { HealthCheckDetail } from './HealthCheckDetail'import { HealthCheckList } from './HealthCheckList'-import { HealthChecksSummary } from './HealthChecksSummary'-import { HealthChecksSummaryDetail } from './HealthChecksSummaryDetail'+import { HealthChecksCoverageNote } from './HealthChecksCoverageNote'import { HealthFindingDetail } from './HealthFindingDetail'import { HealthFindingListItem } from './HealthFindingListItem'+import { HealthOverviewDetail } from './HealthOverviewDetail'import { type HealthPanelCheck, listedHealthChecks } from './healthPanelChecks'-import { type HealthPanelFinding, healthIssues } from './healthPanelFindings'+import type { HealthPanelFinding } from './healthPanelFindings'import { type HealthPanelSelection, healthFindingKey, resolveHealthPanelSelection } from './healthPanelSelection'-export function HealthChecksOverview({+export function HealthChecksPanel({checks,findings,exposures,@@ -43,9 +43,8 @@ export function HealthChecksOverview({const [isDetailOpenWhenNarrow, setIsDetailOpenWhenNarrow] = useState(false)const { experiment } = useValues(experimentLogic)const { aggregationLabel } = useValues(groupsModel)- const { reportHealthCheckExpanded, reportHealthSummaryOpened } = useActions(experimentLogic)+ const { reportHealthCheckExpanded, reportHealthOverviewOpened } = useActions(experimentLogic)const listedChecks = listedHealthChecks(checks)- const issueCount = healthIssues(findings).lengthconst selection = resolveHealthPanelSelection(pickedSelection, findings, listedChecks)const units = aggregationLabel(experiment.feature_flag?.filters?.aggregation_group_type_index, true).pluralconst exposureCheckKeys = new Set<string>(exposures?.health_checks?.map(({ key }) => key))@@ -56,7 +55,7 @@ export function HealthChecksOverview({const detailRef = useRef<HTMLElement>(null)- // Returns whether the pick puts a detail on screen, which is what reports it as opened. The first issue shows+ // Returns whether the pick puts a detail on screen, which is what reports it as opened. The overview shows// without a click, but only beside the list: a narrow container hides the detail behind the list, so there a// click opens even the item that is already picked. Only the container query knows the width, so ask the page.const select = (next: HealthPanelSelection, isSelected: boolean): boolean => {@@ -76,31 +75,32 @@ export function HealthChecksOverview({isDetailOpenWhenNarrow ? 'hidden' : 'flex')}>- <div className="px-1 py-1">+ <div className="p-2"><LemonButtonfullWidth- active={selection.kind === 'summary'}+ active={selection.kind === 'overview'}onClick={() => {- if (select({ kind: 'summary' }, selection.kind === 'summary')) {- reportHealthSummaryOpened()+ if (select({ kind: 'overview' }, selection.kind === 'overview')) {+ reportHealthOverviewOpened()}}}- aria-current={selection.kind === 'summary' ? 'true' : undefined}+ aria-current={selection.kind === 'overview' ? 'true' : undefined}+ // pinned: `data-attr` value, so renaming it breaks autocapture insightsdata-attr="experiment-health-summary-header">- <span className="flex flex-col gap-1 py-1 text-left font-normal">+ <span className="flex flex-col gap-1 py-1.5 text-left font-normal"><span className="flex items-center gap-2"><span className="text-sm font-semibold">Health checks</span><LemonTag type="completion">Beta</LemonTag></span>- <HealthChecksSummary checks={checks} issueCount={issueCount} isDraft={isDraft} />+ <HealthChecksCoverageNote isDraft={isDraft} /></span></LemonButton></div>{findings.length > 0 && (// A note mounts, and so reports as shown, only when the reader opens the health tab. An issue// reports once per load, from the header chip or from here, whichever shows it first.- <ul className="m-0 list-none flex flex-col gap-0.5 border-t px-1 py-2">+ <ul className="m-0 list-none flex flex-col gap-1 border-t p-2">{findings.map((finding) => {const key = healthFindingKey(finding)const isSelected = selection.kind === 'finding' && selection.key === key@@ -135,7 +135,7 @@ export function HealthChecksOverview({ref={detailRef}aria-label="Health check details"className={cn(- 'flex-1 min-w-0 flex-col gap-3 px-4 py-3 @min-[48rem]/health-checks:flex',+ 'flex-1 min-w-0 flex-col gap-4 p-4 @min-[48rem]/health-checks:flex @min-[48rem]/health-checks:p-6',isDetailOpenWhenNarrow ? 'flex' : 'hidden')}>@@ -165,13 +165,7 @@ export function HealthChecksOverview({checkedAt={checkedAt(selection.check.key)}/>) : (- <HealthChecksSummaryDetail- checks={checks}- issueCount={issueCount}- units={units}- countedFrom={exposures?.date_range.date_from ?? null}- checkedAt={exposureCheckedAt}- />+ <HealthOverviewDetail checks={checks} findings={findings} />)}</section></div>diff --git a/products/experiments/frontend/health/HealthChecksSummary.tsx b/products/experiments/frontend/health/HealthChecksSummary.tsxdeleted file mode 100644index 060791b7409d..000000000000--- a/products/experiments/frontend/health/HealthChecksSummary.tsx+++ /dev/null@@ -1,27 +0,0 @@-import { pluralize } from 'lib/utils/strings'--import { type HealthPanelCheck, countHealthChecks, healthChecksVerdict } from './healthPanelChecks'--export function HealthChecksSummary({- checks,- issueCount,- isDraft,-}: {- checks: HealthPanelCheck[]- issueCount: number- isDraft: boolean-}): JSX.Element {- const notCheckedCount = countHealthChecks(checks, 'not_checked')-- return (- // Spans only, because the summary sits inside the button that opens it.- <span className="flex flex-col gap-0.5" data-attr="experiment-health-summary">- <span className="font-semibold">{healthChecksVerdict(checks, issueCount)}</span>- <span className="text-secondary">- {notCheckedCount > 0 && <span>{pluralize(notCheckedCount, 'check')} couldn't run. </span>}- {isDraft && <span>More checks run after launch. </span>}- <span>We're still adding checks, so they don't cover every problem yet.</span>- </span>- </span>- )-}diff --git a/products/experiments/frontend/health/HealthChecksSummaryDetail.tsx b/products/experiments/frontend/health/HealthChecksSummaryDetail.tsxdeleted file mode 100644index a4690c862fec..000000000000--- a/products/experiments/frontend/health/HealthChecksSummaryDetail.tsx+++ /dev/null@@ -1,55 +0,0 @@-import { pluralize } from 'lib/utils/strings'--import { type HealthReading, healthSummaryReadings } from './healthCheckValues'-import { type HealthPanelCheck, countHealthChecks, healthChecksVerdict } from './healthPanelChecks'-import { HealthPanelSection } from './HealthPanelSection'-import { HealthReadingList } from './HealthReadingList'--export function HealthChecksSummaryDetail({- checks,- issueCount,- units,- countedFrom,- checkedAt,-}: {- checks: HealthPanelCheck[]- issueCount: number- units: string- /** The start of the exposure count, when the page has an exposure answer. */- countedFrom: string | null- /** When the exposure checks ran. */- checkedAt: string | null-}): JSX.Element {- const passedCount = countHealthChecks(checks, 'passed')- const notApplicableCount = countHealthChecks(checks, 'not_applicable')- const counts = [- passedCount > 0 ? `${pluralize(passedCount, 'check')} found no issue.` : null,- notApplicableCount > 0- ? `${pluralize(notApplicableCount, 'check')} ${notApplicableCount === 1 ? "doesn't" : "don't"} apply to this experiment.`- : null,- ]- .filter(Boolean)- .join(' ')- const readings = healthSummaryReadings(checks, units)- const exposureTimes: HealthReading[] = readings.length- ? [- ...(countedFrom ? [{ label: 'Exposures counted from', time: countedFrom, asDate: true }] : []),- ...(checkedAt ? [{ label: 'Exposure checks ran', time: checkedAt }] : []),- ]- : []-- return (- <div className="flex flex-col gap-4" data-attr="experiment-health-summary-detail">- <div className="flex flex-col gap-1">- <h3 className="m-0 text-base font-semibold">{healthChecksVerdict(checks, issueCount)}</h3>- {counts && <p className="m-0 max-w-prose text-secondary">{counts}</p>}- </div>- {readings.length > 0 && (- <HealthPanelSection title="What the checks read">- <HealthReadingList readings={[...readings, ...exposureTimes]} />- </HealthPanelSection>- )}- <p className="m-0 max-w-prose text-secondary">Pick a check to see what it looks for and what it read.</p>- </div>- )-}diff --git a/products/experiments/frontend/health/HealthFindingActionButton.tsx b/products/experiments/frontend/health/HealthFindingActionButton.tsxindex c3356b603f58..2ac06c830054 100644--- a/products/experiments/frontend/health/HealthFindingActionButton.tsx+++ b/products/experiments/frontend/health/HealthFindingActionButton.tsx@@ -35,7 +35,7 @@ export function HealthFindingActionButton({)const buttonProps = {size: 'small',- type: 'secondary',+ type: 'primary',// pinned: `data-attr` value, so renaming it breaks autocapture insights'data-attr': `experiment-health-action-${actionKind}`,} as constdiff --git a/products/experiments/frontend/health/HealthFindingDetail.tsx b/products/experiments/frontend/health/HealthFindingDetail.tsxindex fd7073f6c653..7b309cdd0ccf 100644--- a/products/experiments/frontend/health/HealthFindingDetail.tsx+++ b/products/experiments/frontend/health/HealthFindingDetail.tsx@@ -5,7 +5,7 @@ import { HealthCheckRuleSection } from './HealthCheckRuleSection'import { HealthFindingFixes } from './HealthFindingFixes'import { HealthFindingSeverityIcon } from './HealthFindingSeverityIcon'import type { HealthPanelCheck } from './healthPanelChecks'-import { HEALTH_FINDING_SEVERITY_LABELS, type HealthPanelFinding } from './healthPanelFindings'+import type { HealthPanelFinding } from './healthPanelFindings'import { HealthPanelSection } from './HealthPanelSection'import { useHealthFindingReporting } from './useHealthFindingReporting'@@ -31,23 +31,18 @@ export function HealthFindingDetail({severity: finding.severity,reason: finding.reason ?? undefined,})- const status = [HEALTH_FINDING_SEVERITY_LABELS[finding.severity], check ? `Found by "${check.name}"` : null]- .filter(Boolean)- .join(' · ')return (- <div className="flex flex-col gap-4" data-attr="experiment-health-finding-detail">- <div className="flex flex-col gap-1 min-w-0">- <h3 className="m-0 flex items-center gap-2 text-base font-semibold">+ <div className="flex flex-col gap-6" data-attr="experiment-health-finding-detail">+ <h3 className="m-0 flex min-w-0 items-start gap-2 text-xl font-semibold">+ <span className="flex pt-1"><HealthFindingSeverityIcon severity={finding.severity} />- <span>{finding.title}</span>- </h3>- <span className="pl-6 text-xs text-secondary">{status}</span>- </div>+ </span>+ <span>{finding.title}</span>+ </h3><HealthPanelSection title="What we found"><p className="m-0 max-w-prose whitespace-pre-line">{finding.detail}</p></HealthPanelSection>- {check && <HealthCheckReadSection check={check} units={units} exposures={exposures} />}{finding.actions.length > 0 && (<HealthFindingFixesactions={finding.actions}@@ -57,6 +52,7 @@ export function HealthFindingDetail({}}/>)}+ {check && <HealthCheckReadSection check={check} units={units} exposures={exposures} />}{check && <HealthCheckRuleSection check={check} units={units} checkedAt={checkedAt} />}</div>)diff --git a/products/experiments/frontend/health/HealthOverviewDetail.tsx b/products/experiments/frontend/health/HealthOverviewDetail.tsxnew file mode 100644index 000000000000..929b7ac9b4e4--- /dev/null+++ b/products/experiments/frontend/health/HealthOverviewDetail.tsx@@ -0,0 +1,70 @@+import { IconInfo, IconWarning } from '@posthog/icons'++import { pluralize } from 'lib/utils/strings'++import { HEALTH_CHECK_STATUS_DISPLAY } from './healthCheckStatusDisplay'+import { type HealthPanelCheck, countHealthChecks } from './healthPanelChecks'+import { type HealthPanelFinding, healthIssues } from './healthPanelFindings'++export function HealthOverviewDetail({+ checks,+ findings,+}: {+ checks: HealthPanelCheck[]+ findings: HealthPanelFinding[]+}): JSX.Element {+ const issues = healthIssues(findings)+ const issueIcon = (+ <IconWarning+ className={issues.some(({ severity }) => severity === 'critical') ? 'text-danger' : 'text-warning'}+ />+ )+ const noteCount = findings.length - issues.length+ const passedCount = countHealthChecks(checks, 'passed')+ const notApplicableCount = countHealthChecks(checks, 'not_applicable')+ const counts = [+ {+ key: 'issues',+ icon: issueIcon,+ count: issues.length,+ label: pluralize(issues.length, 'issue', undefined, false),+ },+ {+ key: 'notes',+ icon: <IconInfo className="text-secondary" />,+ count: noteCount,+ label: pluralize(noteCount, 'note', undefined, false),+ },+ { key: 'passed', icon: HEALTH_CHECK_STATUS_DISPLAY.passed.icon, count: passedCount, label: 'found no issue' },+ {+ key: 'not_checked',+ icon: HEALTH_CHECK_STATUS_DISPLAY.not_checked.icon,+ count: countHealthChecks(checks, 'not_checked'),+ label: "couldn't check",+ },+ {+ key: 'not_applicable',+ icon: HEALTH_CHECK_STATUS_DISPLAY.not_applicable.icon,+ count: notApplicableCount,+ label: notApplicableCount === 1 ? "doesn't apply" : "don't apply",+ },+ ].filter(({ count }) => count > 0)++ return (+ // pinned: `data-attr` value, so renaming it breaks autocapture insights+ <div className="flex flex-col gap-3" data-attr="experiment-health-summary-detail">+ <h3 className="m-0 text-xl font-semibold">Overview</h3>+ {counts.length > 0 && (+ <ul className="m-0 flex list-none flex-wrap gap-x-6 gap-y-2 p-0">+ {counts.map(({ key, icon, count, label }) => (+ <li key={key} className="flex items-center gap-1.5">+ <span className="flex text-base">{icon}</span>+ <span className="text-lg font-semibold tabular-nums">{count}</span>+ <span className="text-secondary">{label}</span>+ </li>+ ))}+ </ul>+ )}+ </div>+ )+}diff --git a/products/experiments/frontend/health/HealthPanelSection.tsx b/products/experiments/frontend/health/HealthPanelSection.tsxindex 7e7341dfcfc5..462058bd5189 100644--- a/products/experiments/frontend/health/HealthPanelSection.tsx+++ b/products/experiments/frontend/health/HealthPanelSection.tsx@@ -1,6 +1,6 @@export function HealthPanelSection({ title, children }: { title: string; children: React.ReactNode }): JSX.Element {return (- <section className="flex flex-col gap-1">+ <section className="flex flex-col gap-2"><h4 className="m-0 text-xs font-semibold text-secondary">{title}</h4>{children}</section>diff --git a/products/experiments/frontend/health/HealthReadingList.tsx b/products/experiments/frontend/health/HealthReadingList.tsxindex 660da5aaaab2..67e1ec5dbfe0 100644--- a/products/experiments/frontend/health/HealthReadingList.tsx+++ b/products/experiments/frontend/health/HealthReadingList.tsx@@ -6,7 +6,7 @@ import type { HealthReading } from './healthCheckValues'export function HealthReadingList({ readings }: { readings: HealthReading[] }): JSX.Element {return (- <dl className="m-0 grid max-w-xl grid-cols-2 gap-x-4 gap-y-1">+ <dl className="m-0 grid max-w-xl grid-cols-2 gap-x-4 gap-y-1.5">{readings.map((reading) => (<Fragment key={reading.label}><dt className="text-secondary">{reading.label}</dt>diff --git a/products/experiments/frontend/health/experimentHealthFindingEvents.ts b/products/experiments/frontend/health/experimentHealthFindingEvents.tsindex cd8ab93a08fa..8080ff216282 100644--- a/products/experiments/frontend/health/experimentHealthFindingEvents.ts+++ b/products/experiments/frontend/health/experimentHealthFindingEvents.ts@@ -229,7 +229,7 @@ export function captureExperimentHealthCheckExpanded(})}-export function captureExperimentHealthSummaryOpened(+export function captureExperimentHealthOverviewOpened(experiment: Experiment,checks: HealthPanelCheck[],findingCount: number,diff --git a/products/experiments/frontend/health/healthCheckValues.test.ts b/products/experiments/frontend/health/healthCheckValues.test.tsindex 88020992df0f..102b633dc7d5 100644--- a/products/experiments/frontend/health/healthCheckValues.test.ts+++ b/products/experiments/frontend/health/healthCheckValues.test.ts@@ -8,9 +8,7 @@ import {healthCheckShowsDecidingValue,healthExposureSplit,healthRuleReadings,- healthSummaryReadings,} from './healthCheckValues'-import type { HealthPanelCheck } from './healthPanelChecks'const SRM_RULE: HealthCheckRule = {value: 'p_value',@@ -28,13 +26,6 @@ const MULTIPLE_RULE: HealthCheckRule = {minimum: { value: 'multiple_variant_count', threshold: 5 },}-const check = (- key: HealthPanelCheck['key'],- status: HealthPanelCheck['status'],- values: HealthPanelCheck['values'],- rule: HealthCheckRule | null = null-): HealthPanelCheck => ({ key, name: key, description: '', status, reason: null, values, rule }) as HealthPanelCheck-const exposures = (totalExposures: Record<string, number>,expected?: Record<string, number>@@ -187,27 +178,4 @@ describe('healthCheckValues', () => {])('healthExposureSplit: $name', ({ answer, expected }) => {expect(healthExposureSplit(answer)).toEqual(expected)})-- it('healthSummaryReadings: picks each line from the check that read it', () => {- const checks = [- check('zero_exposures', 'passed', { exposed_count: 9602, since_launch_hours: 300 }),- check(- 'srm',- 'not_applicable',- { p_value: 0.0001, compared_count: 9199, multiple_variant_count: 403 },- SRM_RULE- ),- check('multiple_variants_share', 'passed', {- multiple_variant_count: 403,- multiple_variant_percentage: 4.2,- }),- check('metric_calculation_failed', 'passed', { metric_count: 3, completed_metric_count: 3 }),- ]-- expect(healthSummaryReadings(checks, 'users')).toEqual([- { label: 'Exposed users', text: '9,602' },- { label: 'In more than one variant', text: '403 · 4.2%' },- { label: 'Metrics calculated', text: '3 of 3' },- ])- })})diff --git a/products/experiments/frontend/health/healthCheckValues.ts b/products/experiments/frontend/health/healthCheckValues.tsindex 1d0704dcb40e..8530524a5689 100644--- a/products/experiments/frontend/health/healthCheckValues.ts+++ b/products/experiments/frontend/health/healthCheckValues.ts@@ -254,24 +254,3 @@ export function healthExposureSplit(plannedPercentage: expected && plannedTotal > 0 ? (expected[variant] / plannedTotal) * 100 : null,}))}--function findCheck(checks: HealthPanelCheck[], key: HealthPanelCheck['key']): HealthPanelCheck | undefined {- return checks.find((check) => check.key === key)-}--/** What the summary shows of the checks' values, from the checks that read each one. */-export function healthSummaryReadings(checks: HealthPanelCheck[], units: string): HealthReading[] {- const srm = findCheck(checks, 'srm')- const pValue = numberValue(srm?.values, 'p_value')- const splitText =- srm && pValue !== null && (srm.status === 'passed' || srm.status === 'finding')- ? `${srm.status === 'passed' ? 'Matches' : "Doesn't match"}, ${formatPValue(pValue)}`- : null- return [- exposedReading(findCheck(checks, 'zero_exposures')?.values, units),- reading('Split against the plan', splitText),- multipleVariantReading(findCheck(checks, 'multiple_variants_share')?.values),- calculatedMetricsReading(findCheck(checks, 'metric_calculation_failed')?.values),- flagReading(findCheck(checks, 'flag_state')?.values),- ].filter((line): line is HealthReading => line !== null)-}diff --git a/products/experiments/frontend/health/healthPanelChecks.test.ts b/products/experiments/frontend/health/healthPanelChecks.test.tsindex 88b20f3cbef0..8e5901028977 100644--- a/products/experiments/frontend/health/healthPanelChecks.test.ts+++ b/products/experiments/frontend/health/healthPanelChecks.test.ts@@ -4,7 +4,6 @@ import type { ExperimentHealthApi, ExperimentHealthCheckResultApi } from '../genimport {type ExposureChecksState,type HealthChipState,- type HealthPanelCheck,exposureChecksState,healthChipState,healthPanelChecks,@@ -120,53 +119,16 @@ describe('healthPanelChecks', () => {test.each<{name: stringfindings: HealthPanelFinding[] | null- checks: HealthPanelCheck[] | null- exposureChecks: ExposureChecksState- expected: Partial<HealthChipState>+ expected: HealthChipState}>([- {- name: 'no chip without server findings',- findings: null,- checks: null,- exposureChecks: 'ready',- expected: { kind: 'hidden' },- },+ { name: 'no chip without server findings', findings: null, expected: { kind: 'hidden' } },{name: 'issues count no info finding',findings: [finding('critical'), finding('warning'), finding('info')],- checks: [],- exposureChecks: 'ready',expected: { kind: 'issues', count: 2, hasCritical: true },},- {- name: 'an issue shows while the exposure checks run',- findings: [finding('warning')],- checks: [],- exposureChecks: 'pending',- expected: { kind: 'issues', count: 1, hasCritical: false },- },- {- name: 'no verdict while the exposure checks run',- findings: [],- checks: [check('no_metric', 'passed')],- exposureChecks: 'pending',- expected: { kind: 'pending' },- },- {- name: 'the label counts the passed checks and the notes',- findings: [finding('info')],- checks: [check('no_metric', 'passed'), check('flag_state', 'passed'), check('srm', 'not_applicable')],- exposureChecks: 'ready',- expected: { kind: 'checks', label: 'No problems found (2\u00a0checks) · 1\u00a0note' },- },- {- name: 'the label says so when no check applies',- findings: [],- checks: [check('no_metric', 'not_applicable')],- exposureChecks: 'not_launched',- expected: { kind: 'checks', label: 'No checks apply yet' },- },- ])('$name', ({ findings, checks, exposureChecks, expected }) => {- expect(healthChipState(findings, checks, exposureChecks)).toMatchObject(expected)+ { name: 'no chip for notes alone', findings: [finding('info')], expected: { kind: 'hidden' } },+ ])('$name', ({ findings, expected }) => {+ expect(healthChipState(findings)).toEqual(expected)})})diff --git a/products/experiments/frontend/health/healthPanelChecks.ts b/products/experiments/frontend/health/healthPanelChecks.tsindex 851da129bc18..e05a91b04059 100644--- a/products/experiments/frontend/health/healthPanelChecks.ts+++ b/products/experiments/frontend/health/healthPanelChecks.ts@@ -1,5 +1,3 @@-import { pluralize } from 'lib/utils/strings'-import type { ExperimentExposureHealthCheck, ExperimentExposureQueryResponse } from '~/queries/schema/schema-general'import type { ExperimentHealthApi, ExperimentHealthCheckResultApi } from '../generated/api.schemas'@@ -19,11 +17,7 @@ export type HealthChipState =kind: 'issues'count: numberhasCritical: boolean- checks: HealthPanelCheck[]- findings: HealthPanelFinding[]}- | { kind: 'pending' }- | { kind: 'checks'; label: string; checks: HealthPanelCheck[]; findings: HealthPanelFinding[] }// The flag history check only lets the checks of changes since launch look. When it can't read the history, they say// they couldn't check and its note says why, so its own row would tell the reader nothing.@@ -75,45 +69,14 @@ export function countHealthChecks(checks: HealthPanelCheck[], status: HealthPanereturn checks.filter((check) => check.status === status).length}-export function healthChecksVerdict(checks: HealthPanelCheck[], issueCount: number): string {- const passedCount = countHealthChecks(checks, 'passed')- if (issueCount > 0) {- return `${pluralize(issueCount, 'issue')} found`- }- return passedCount > 0- ? `No problems found by ${pluralize(passedCount, 'check')}`- : 'No checks apply to this experiment yet'-}--export function healthChipState(- findings: HealthPanelFinding[] | null,- checks: HealthPanelCheck[] | null,- exposureChecks: ExposureChecksState-): HealthChipState {- if (findings === null || checks === null) {- return { kind: 'hidden' }- }+export function healthChipState(findings: HealthPanelFinding[] | null): HealthChipState {const issues = healthIssues(findings)- if (issues.length > 0) {- return {- kind: 'issues',- count: issues.length,- hasCritical: issues.some((finding) => finding.severity === 'critical'),- checks,- findings,- }- }- // A verdict before the exposure checks answer could turn into an issue a moment later.- if (exposureChecks === 'pending') {- return { kind: 'pending' }- }- // Without an issue, every finding is an info finding.- const passedCount = countHealthChecks(checks, 'passed')- const label = [- passedCount > 0 ? `No problems found (${pluralize(passedCount, 'check')})` : null,- findings.length > 0 ? pluralize(findings.length, 'note') : null,- ]- .filter(Boolean)- .join(' · ')- return { kind: 'checks', label: label || 'No checks apply yet', checks, findings }+ // A note needs no action, so the header marks only an experiment with an issue to fix.+ return issues.length > 0+ ? {+ kind: 'issues',+ count: issues.length,+ hasCritical: issues.some((finding) => finding.severity === 'critical'),+ }+ : { kind: 'hidden' }}diff --git a/products/experiments/frontend/health/healthPanelSelection.test.ts b/products/experiments/frontend/health/healthPanelSelection.test.tsindex 3b1c2cea17eb..2ebd25e0a83b 100644--- a/products/experiments/frontend/health/healthPanelSelection.test.ts+++ b/products/experiments/frontend/health/healthPanelSelection.test.ts@@ -14,11 +14,16 @@ const ISSUE: HealthPanelFinding = {describe('resolveHealthPanelSelection', () => {it.each([- { name: 'opens the first issue without a pick', picked: null, expected: 'finding' },+ { name: 'opens the overview without a pick, even with an issue', picked: null, expected: 'overview' },{- name: 'keeps the summary that the reader picked over an issue',- picked: { kind: 'summary' },- expected: 'summary',+ name: 'keeps the issue that the reader picked',+ picked: { kind: 'finding', key: 'srm:' },+ expected: 'finding',+ },+ {+ name: 'falls back to the overview when the picked issue is gone',+ picked: { kind: 'finding', key: 'zero_exposures:' },+ expected: 'overview',},] as const)('$name', ({ picked, expected }) => {expect(resolveHealthPanelSelection(picked, [ISSUE], []).kind).toEqual(expected)diff --git a/products/experiments/frontend/health/healthPanelSelection.ts b/products/experiments/frontend/health/healthPanelSelection.tsindex ec2b6823f2a1..6abe52172e67 100644--- a/products/experiments/frontend/health/healthPanelSelection.ts+++ b/products/experiments/frontend/health/healthPanelSelection.ts@@ -1,13 +1,13 @@import type { ListedHealthCheck } from './healthPanelChecks'-import { type HealthPanelFinding, healthIssues } from './healthPanelFindings'+import type { HealthPanelFinding } from './healthPanelFindings'export type HealthPanelSelection =- | { kind: 'summary' }+ | { kind: 'overview' }| { kind: 'finding'; key: string }| { kind: 'check'; key: ListedHealthCheck['key'] }export type ResolvedHealthPanelSelection =- | { kind: 'summary' }+ | { kind: 'overview' }| { kind: 'finding'; key: string; finding: HealthPanelFinding }| { kind: 'check'; key: ListedHealthCheck['key']; check: ListedHealthCheck }@@ -15,7 +15,7 @@ export function healthFindingKey(finding: HealthPanelFinding): string {return `${finding.code}:${finding.subcode ?? ''}`}-// A refresh can remove the picked finding or check, so the pick holds only while it is still on the list. The summary+// A refresh can remove the picked finding or check, so the pick holds only while it is still on the list. The overview// is always there.export function resolveHealthPanelSelection(picked: HealthPanelSelection | null,@@ -23,7 +23,7 @@ export function resolveHealthPanelSelection(checks: ListedHealthCheck[]): ResolvedHealthPanelSelection {switch (picked?.kind) {- case 'summary':+ case 'overview':return pickedcase 'finding': {const finding = findings.find((candidate) => healthFindingKey(candidate) === picked.key)@@ -40,9 +40,5 @@ export function resolveHealthPanelSelection(break}}- // A note states a fact and needs no action, so only an issue opens without a click.- const [firstIssue] = healthIssues(findings)- return firstIssue- ? { kind: 'finding', key: healthFindingKey(firstIssue), finding: firstIssue }- : { kind: 'summary' }+ return { kind: 'overview' }}