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(experiments): move the health checks into their own tab (#127853)

Marcel Poelker1a646d3ea256
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index 4399a8f68544..a16859c0d553 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -3401,29 +3401,29 @@ snapshots:
errortracking-volumesparkline--events-before-data-range--light:
hash: v1.k794b7964.c88c4e3b028915efba3fdbbac7107a063662d8210dfb6ba8667e96d719fa3d4f.tzwEQFa4F1f1O9PGqBkcaqSavbFVgAwPAjyh9Uf9NL8
experiments-healthchecksoverview--checks-that-could-not-run--dark:
- hash: v1.k794b7964.812abddceca7cccf98524576a651f1a5e39826c130f93f8b8229fb509cb726ec.fbTQPszA7Of4H8fHgkioDk9ZSf6QzUTa-WDv733Ie5U
+ hash: v1.k794b7964.8146d36bf02449ae4b2cbc068d3a8c9b9a526fe98943acf0b57bd5dcaad5e6d5.fc6r4oDTtjgfC-OHKRDsugjSlC6k5cWSM54vvzQM9mo
experiments-healthchecksoverview--checks-that-could-not-run--light:
- hash: v1.k794b7964.1727dcbe43bb519bf22fa837716404283cc730151b237a45c098b44a0d753c76.2nNVgElqCL8SDJ6i2TZZ3h_1baUpeR_6nkfgNG7AjrQ
+ hash: v1.k794b7964.06e0cff56ebe51ceff259f34b68d3264930fb0c11905b56b7fe9ceaf8f418bf6.7fZpFHvrBEgKqkNydDxXtJ_LKQKV6Fryti6eNfk57PM
experiments-healthchecksoverview--draft--dark:
- hash: v1.k794b7964.2d850eef5214f620c272b8391b847b24bd7a7e54db105b82fb2092edca5a749b.hkbIChET-cnHtxRGPXq7mINCKqre6micZp4vGHkZPqg
+ hash: v1.k794b7964.8ce0d1b68bbf088f3f69dc2f88f2f3bb8ac9059ea99a2c3f4f0e6409f5546ee5.zIywLX5gjLEKZ2xB2qzK3WPrKvQZpFjwcKoWuoKZELU
experiments-healthchecksoverview--draft--light:
- hash: v1.k794b7964.6602e11819404ed4d40aa502a6acecd02e50e277bf6433a7094806d42aae273a.4zUBdKR311LuUiFR-oJrHG2wSkKtGqHSTmTu1TggsD8
+ hash: v1.k794b7964.59103b098225cdf194d6e196b7ef86c6039e4f507f96ed2d8f98d336d56fbbbe.ftqfIR3wi-bslWbDUy9rG2Pc1Lo9j_xfNagx88xm5Ps
experiments-healthchecksoverview--draft-with-events-not-received--dark:
- hash: v1.k794b7964.dd26de28a16b7d2b41c1a766c72b2cc15024ef94eedd1298d44ee9ac4f407a84.RPGW8Ele3QwdlSX_3rEN6tVAHSnKGqEd5c1Rlyh-pPc
+ hash: v1.k794b7964.9c70afa920669d0b9bcced0e8cfc3323352add548e6754b3be6e26135ebe28ee.5-qXSWJuFs5bNVjJTb1kNSz7EpmxGj0cfVkKSShMKTU
experiments-healthchecksoverview--draft-with-events-not-received--light:
- hash: v1.k794b7964.9ffbba359b8dca6f948edccdde02acf1539a4e2af552b9005de4377bbf876c1c.VlXBwUZKPYbSBWabKTIoqjp66EheAgMdqTDbaWOexP8
+ hash: v1.k794b7964.a2dcf1155d438600b9b8b1b43916c33496e7fd32b65527fbd5c4ba1ac50b9b10.URRKvYDQ_6mxCNckg_4Vm94P6FR9aSHm5jYTyM9WIXI
experiments-healthchecksoverview--running-with-an-issue--dark:
- hash: v1.k794b7964.c513495899160638ead3ad13632d4ca59a62c8ea0fb2c86fa1ea17719d46a2fa.8ApNUhlTxYF7nrUqO1zsTZte04NzMXf7hmjJz3P4rPE
+ hash: v1.k794b7964.67ae51acb1a5a680cdf7e008911ce8c4c0828711a76727d21ed3889b07b26917.pK9afrH7eguEJ5gSocUl68zIoqovXYKRWfbxPvEgtSI
experiments-healthchecksoverview--running-with-an-issue--light:
- hash: v1.k794b7964.3cbd4355330c14f1afadb886cd182879c5b436b5143fe8f136771027bd56cc7f.YApFmE4xWr1dZ_tNUv89PeWQW5QEDxuJwxaSW7siajc
+ hash: v1.k794b7964.ac37db2eb5df0a36a0aeb9603c56b5a6d31f5d45afee36dca97cd9144235aecc.HA2SaQlI_HoSfw_kbDTh9RtAg2MeqQbuhoDgUWREwOs
experiments-healthchecksoverview--running-with-metric-windows-not-complete--dark:
- hash: v1.k794b7964.6eeec0309943fa9a7c2aced8868a68f47121b1a8373cc17f7b6b97cfcecc9859.IrL3JyoUu6PSyiksHlET0I8NbG1kk28CYOeQu162PDs
+ hash: v1.k794b7964.c028d2802d8c6040c3b96acb60be867dda5dfa7a20c061f11c0806f8d13a3ffc.Xcx8Ntc7rjwkn8nCIk5F6mH0yLEykqFsa569tUnM8cA
experiments-healthchecksoverview--running-with-metric-windows-not-complete--light:
- hash: v1.k794b7964.aff07efeabeb82703966b262feb3e0e672f5aa6bb3c6adb742b0280d84921e2e.3bb625satJvU42HKwWn_CENwuFl18P8IqD-7aN6Qk54
+ hash: v1.k794b7964.3d6323d20aafa349eaab62f5e0fd4408129f694ad65dcb51fe04373ee087cdf5.x5ZDA6dnw2p2pMO0DI7qeY80hY4-IuoROj9tlrGVMQ4
experiments-healthchecksoverview--running-with-significance-on-a-small-sample--dark:
- hash: v1.k794b7964.409d7eccff93e0d58ad5f9272a09937b807b66863ffa41bce1946aeb716f5ab3.UgfqDxyCdNSrMh_WE_Cf9KXyjPelEnkBYw3FzAWgkeY
+ hash: v1.k794b7964.2a56cfad0fe2b8742792e7cc20dcd687883839ab474620f847b7c235ea440bfb.PfXKVn-zxcl2L9-HEffR5Ft5euEA6J8S5l9O-MzIyko
experiments-healthchecksoverview--running-with-significance-on-a-small-sample--light:
- hash: v1.k794b7964.22d9ffdacb87c01038bdea719d48ac9007740ae874c600cd07a6b1ee9c733c79.NOZW2_XUZpp2wjCx6S5-onjs3VltBKvbwyiyRMCSKgY
+ hash: v1.k794b7964.748f4506e88aed65c9c075130598283823aa4e4e878d3282c6a5e5b9237fb40f.Bff__yx5A0zeNw3QFeNx-tqHiWL--GIIlEMYr0te510
experiments-howtoreadtooltip--intervals-bayesian--dark:
hash: v1.k794b7964.a06d267cee9cb54bafc732335b35d461d3c1a59250c6daa8becace0fcb8492d2.vR5tecOozn6B51xE8LrByAFVsi03J4w-iUu-j2hQUTU
experiments-howtoreadtooltip--intervals-bayesian--light:
@@ -11579,9 +11579,9 @@ snapshots:
scenes-app-experiments--experiment-frequentist-two-variants--light:
hash: v1.k794b7964.4ddea1c7537af9d50c57b4b9a76d4bcba39f743a23b4715683c0ce59d4c24f57.0ueR8XMLqRby_u6I0EyNIiUwXkbjmWMH3vBdoFNYmII
scenes-app-experiments--experiment-health-debug-tab--dark:
- hash: v1.k794b7964.4110aac4ac713b4ba9b55eb08ea4a122e2b3e63907edc940bf1ee00e3b4466a4.hwxC9eQVxdcbPqkZjFLdNl-HwkZi_cav1yJ0RJfLuAk
+ hash: v1.k794b7964.2da45294101f9c2890536496ae40d1f042deadc0266580c3cba8313f908b258e.Yjeu1JhMX0ISDHC8ZjR4gQeOzCHvdQk-HGpeHbdUSuM
scenes-app-experiments--experiment-health-debug-tab--light:
- hash: v1.k794b7964.f25e235992bc6f65e679bc2288df78d2c2c476681844c81692ddf513143bdfc6.--c7yplu92ohebzYTVp__eRhIzPUpr7bmyY39p4oajo
+ hash: v1.k794b7964.8953664353de37280ca46e1fa60826308061b8c248aa571f393cc9fdd9bcd56e.BKEvDi2gCcya7wCGrTvJi_JMsWjPbsnRAXxelm9d97E
scenes-app-experiments--experiment-recordings-dropped-metric--dark:
hash: v1.k794b7964.9ce950830524de179a4d761af104781fdc05347d59f18de814e72bc40a486158.T1SiGxL_fGBQT61rjwuJe9MPz1NPcjeZBRv6rKiSzrE
scenes-app-experiments--experiment-recordings-dropped-metric--light:
@@ -11711,9 +11711,9 @@ snapshots:
scenes-app-experiments--experiment-with-funnel-metric--light:
hash: v1.k794b7964.fd105a9918bab77db9fb47b351ffa32065556aae7f46736d002f5edbf4b7eb2a.kz6qe5r99nmq8xrOvZhI2qeQLpYwhaRXTTQZEyWb9oU
scenes-app-experiments--experiment-with-health-findings--dark:
- hash: v1.k794b7964.0e6c443c539e742e42e4d46604810c76b934acefbb12e610dd59403a9852406d.EL4WPQY3idMVDczVAea7lHhCOYuI1ATfdmoFZ691SEo
+ hash: v1.k794b7964.92c3bf3e2eb88529cf4630fb318afe93277fdc13c8f0c5825e8588db05224fe6.mQm4nEQ-tqCcfw2ciOAEQBbNHEdCMGTVFa47w4BHIek
scenes-app-experiments--experiment-with-health-findings--light:
- hash: v1.k794b7964.8c72c764757a385da276373c4df108ea8f309820467cd77e624a11db5b50e405.ScKZnCot1howsO9pqK1Em_QrS8u_AQNFM2xDWJ7u18k
+ hash: v1.k794b7964.0cc19046a9929fa2eb2e067273e939c878c51b23b76756ca835c9b32e032706d.Z7vR7X1czQGEFD52EaUn99B5HbcNznGjoM9v3rdgpAg
scenes-app-experiments--experiment-with-long-flag-key--dark:
hash: v1.k794b7964.72ab9fcbc06f35556a7d96e0fe3bd56e8a2796ed5653d6b279ec05c8a9cce9de.1HcvRm0AN_gzYBTpwvzGMG55FWmg2E7lQZD_w3f_xJc
scenes-app-experiments--experiment-with-long-flag-key--light:
diff --git a/frontend/src/scenes/experiments/ExperimentView/ExperimentView.tsx b/frontend/src/scenes/experiments/ExperimentView/ExperimentView.tsx
index b5a256ff07e1..d2370b5636b2 100644
--- a/frontend/src/scenes/experiments/ExperimentView/ExperimentView.tsx
+++ b/frontend/src/scenes/experiments/ExperimentView/ExperimentView.tsx
@@ -1,6 +1,6 @@
import { useActions, useValues } from 'kea'
-import { LemonBanner, LemonTab, LemonTabs } from '@posthog/lemon-ui'
+import { LemonBadge, LemonBanner, LemonTab, LemonTabs } from '@posthog/lemon-ui'
import { ActivityLog } from 'lib/components/ActivityLog/ActivityLog'
import { PendingChangeRequestBanner } from 'scenes/approvals/PendingChangeRequestBanner'
@@ -11,7 +11,8 @@ import { ActivityScope } from '~/types'
import { ExperimentMetaBar } from 'products/experiments/frontend/components/ExperimentMetaBar'
import { ExperimentHealthDebug } from 'products/experiments/frontend/health/debug/ExperimentHealthDebug'
-import { ExperimentHealthPanel } from 'products/experiments/frontend/health/ExperimentHealthPanel'
+import { ExperimentHealthTab } from 'products/experiments/frontend/health/ExperimentHealthTab'
+import { healthIssues } from 'products/experiments/frontend/health/healthPanelFindings'
import { useHealthFindingReporting } from 'products/experiments/frontend/health/useHealthFindingReporting'
import { LegacyExperimentView } from 'products/experiments/frontend/legacy/LegacyExperimentView'
import { ExperimentMetricModal } from 'products/experiments/frontend/modals/ExperimentMetricModal/ExperimentMetricModal'
@@ -48,16 +49,16 @@ const MetricsTab = (): JSX.Element => {
const { experiment, hasMetrics, isExperimentLaunched, healthFindings, browserNoMetricsWarning } =
useValues(experimentLogic)
- // With health findings, the health panel above the tabs shows the "No metrics defined" and bias warnings.
- const showsHealthPanel = healthFindings !== null
- const showNoMetricsWarning = !showsHealthPanel && browserNoMetricsWarning
- const hasNoMetricFinding = showsHealthPanel
+ // With health findings, the health tab shows the "No metrics defined" and bias warnings.
+ const showsHealthTab = healthFindings !== null
+ const showNoMetricsWarning = !showsHealthTab && browserNoMetricsWarning
+ const hasNoMetricFinding = showsHealthTab
? healthFindings.some(({ code }) => code === 'no_metric')
: showNoMetricsWarning
- // The add metric buttons below act on the finding also when the health panel shows it.
+ // The add metric buttons below act on the finding also when the health tab shows it.
const { reportActedOn: reportNoMetricActedOn } = useHealthFindingReporting(
hasNoMetricFinding ? { code: 'no_metric' } : null,
- !showsHealthPanel
+ !showsHealthTab
)
return (
@@ -66,7 +67,7 @@ const MetricsTab = (): JSX.Element => {
<Hypothesis />
<div>
<Exposures />
- {!showsHealthPanel && <MultiVariantBiasWarning />}
+ {!showsHealthTab && <MultiVariantBiasWarning />}
</div>
</div>
@@ -140,6 +141,7 @@ export function ExperimentView(): JSX.Element {
addSharedMetricsToExperiment,
removeSharedMetricFromExperiment,
removeMetric,
+ reportHealthChecksOpened,
} = useActions(experimentLogic)
const { activeTabKey, availableTabs } = useValues(experimentSceneLogic)
@@ -153,8 +155,10 @@ export function ExperimentView(): JSX.Element {
return <LegacyExperimentView />
}
- // Ordered as: results (Metrics), configuration (Settings, Code, Variants),
- // feature tabs (Recordings, User feedback), audit trail (History), staff debugging (Health debug).
+ const healthIssueCount = healthIssues(healthFindings).length
+
+ // Ordered as: results (Metrics), configuration (Settings, Code, Variants), feature tabs (Recordings,
+ // User feedback), audit trail (History), checks (Health, then the staff-only Health debug).
// Which of these actually render is resolved by experimentSceneLogic's availableTabs, so the tab set,
// the URL, and the tracked tab stay in agreement.
const tabs: LemonTab<ExperimentTab>[] = (
@@ -170,6 +174,26 @@ export function ExperimentView(): JSX.Element {
label: 'History',
content: <ActivityLog scope={ActivityScope.EXPERIMENT} id={experimentId} />,
},
+ {
+ key: 'health',
+ label: (
+ <span className="flex items-center gap-1.5">
+ <span>Health</span>
+ {healthIssueCount > 0 && (
+ <LemonBadge.Number
+ count={healthIssueCount}
+ status={
+ healthFindings?.some(({ severity }) => severity === 'critical')
+ ? 'danger'
+ : 'warning'
+ }
+ size="small"
+ />
+ )}
+ </span>
+ ),
+ content: <ExperimentHealthTab />,
+ },
{ key: 'health-debug', label: 'Health debug', content: <ExperimentHealthDebug /> },
] satisfies LemonTab<ExperimentTab>[]
).filter((tab) => availableTabs.includes(tab.key))
@@ -197,12 +221,16 @@ export function ExperimentView(): JSX.Element {
/>
)}
<ExperimentMetaBar />
- <ExperimentHealthPanel />
<ExperimentHeader />
<LemonTabs
// Fall back to the default tab if the active one is conditionally hidden
activeKey={tabs.some((tab) => tab.key === activeTabKey) ? activeTabKey : DEFAULT_EXPERIMENT_TAB}
- onChange={(key) => setActiveTabKey(key)}
+ onChange={(key) => {
+ setActiveTabKey(key)
+ if (key === 'health') {
+ reportHealthChecksOpened('tab')
+ }
+ }}
// Override sceneInset's -mt-4 pull-up so the tabs keep 32px from whatever sits above them
className="mt-4"
sceneInset
diff --git a/frontend/src/scenes/experiments/ExperimentView/Exposures.tsx b/frontend/src/scenes/experiments/ExperimentView/Exposures.tsx
index e3c36cb5a044..9852cf79baac 100644
--- a/frontend/src/scenes/experiments/ExperimentView/Exposures.tsx
+++ b/frontend/src/scenes/experiments/ExperimentView/Exposures.tsx
@@ -180,8 +180,8 @@ export function Exposures(): JSX.Element {
// The answer holds a series for every configured variant, with zero counts, so only the total tells.
const hasZeroExposures = !isExperimentDraft && !exposuresLoading && exposures != null && totalExposures === 0
- // With the health panel, its row reports the finding as shown. The card reports the same finding, so that opening
- // the card's evidence counts against the panel's "shown" event and not a second one.
+ // With the health findings, the health chip reports the finding as shown. The card reports the same finding, so that
+ // opening the card's evidence counts against the chip's "shown" event and not a second one.
const srmFinding = healthUi === 'panel' ? serverSampleRatioFinding(exposures) : undefined
const { reportOpened: reportSrmOpened } = useHealthFindingReporting(
hasSRM && !isExperimentDraft && !exposuresLoading
diff --git a/frontend/src/scenes/experiments/ExperimentView/healthFindingReporting.test.tsx b/frontend/src/scenes/experiments/ExperimentView/healthFindingReporting.test.tsx
index e80e11f55a8f..0acc01f3c7aa 100644
--- a/frontend/src/scenes/experiments/ExperimentView/healthFindingReporting.test.tsx
+++ b/frontend/src/scenes/experiments/ExperimentView/healthFindingReporting.test.tsx
@@ -14,9 +14,11 @@ import { initKeaTests } from '~/test/init'
import { Experiment, ExperimentStatus } from '~/types'
import { NEW_EXPERIMENT } from 'products/experiments/frontend/constants'
-import { ExperimentHealthPanel } from 'products/experiments/frontend/health/ExperimentHealthPanel'
+import { ExperimentHealthChip } from 'products/experiments/frontend/health/ExperimentHealthChip'
+import { ExperimentHealthTab } from 'products/experiments/frontend/health/ExperimentHealthTab'
import { experimentLogic } from '../experimentLogic'
+import { experimentSceneLogic } from '../experimentSceneLogic'
import { ExperimentWarningBanner } from './ExperimentWarningBanners'
import { Exposures } from './Exposures'
import { MultiVariantBiasWarning } from './MultiVariantBiasWarning'
@@ -96,7 +98,10 @@ describe('health finding reporting', () => {
}
// The same experiment for a person with the health findings flag: the server sends the flag-state finding.
- const renderHealthPanel = (exposures: Record<string, unknown>): void => {
+ const renderHealth = (
+ exposures: Record<string, unknown>,
+ Surface: () => JSX.Element | null = ExperimentHealthTab
+ ): void => {
logic.actions.setExperiment({
...NEW_EXPERIMENT,
id: EXPERIMENT_ID,
@@ -124,7 +129,9 @@ describe('health finding reporting', () => {
render(
<Provider>
<BindLogic logic={experimentLogic} props={{ experimentId: EXPERIMENT_ID }}>
- <ExperimentHealthPanel />
+ <BindLogic logic={experimentSceneLogic} props={{ experimentId: EXPERIMENT_ID }}>
+ <Surface />
+ </BindLogic>
</BindLogic>
</Provider>
)
@@ -192,8 +199,11 @@ describe('health finding reporting', () => {
expect(findingEvents()).toEqual([[`experiment health finding ${step}`, code, kind]])
})
- it('reports each finding of the health panel as shown, with the codes of the warnings it replaces', () => {
- renderHealthPanel(UNEVEN_EXPOSURES)
+ it.each([
+ { surface: 'header chip', Surface: ExperimentHealthChip },
+ { surface: 'health tab', Surface: ExperimentHealthTab },
+ ])('reports each issue as shown from the $surface, with the codes of the warnings it replaces', ({ Surface }) => {
+ renderHealth(UNEVEN_EXPOSURES, Surface)
const shown = captureSpy.mock.calls
.filter(([event]) => event === 'experiment health finding shown')
@@ -214,9 +224,9 @@ describe('health finding reporting', () => {
kind: 'use_first_seen_variant',
},
])(
- 'reports $code as $step with $kind when a person uses "$control" in the health panel',
+ 'reports $code as $step with $kind when a person uses "$control" in the health tab',
async ({ control, step, code, kind }) => {
- renderHealthPanel(UNEVEN_EXPOSURES)
+ renderHealth(UNEVEN_EXPOSURES)
captureSpy.mockClear()
await userEvent.click(screen.getByText(control))
@@ -225,13 +235,14 @@ describe('health finding reporting', () => {
}
)
- it('reports a finding of the health panel as opened when a person opens its detail', async () => {
- renderHealthPanel(NO_EXPOSURES)
+ it('shows the detail of an issue on the health tab without reporting it as opened until a person reopens it', async () => {
+ renderHealth(NO_EXPOSURES)
+ expect(screen.getByText(/The linked feature flag is disabled/)).toBeInTheDocument()
captureSpy.mockClear()
const [flagStateWhy] = screen.getAllByText('Why?')
await userEvent.click(flagStateWhy)
- expect(screen.getByText(/The linked feature flag is disabled/)).toBeInTheDocument()
+ expect(findingEvents()).toEqual([])
await userEvent.click(flagStateWhy)
expect(findingEvents()).toEqual([['experiment health finding opened', 'flag_off_while_running', 'why']])
diff --git a/frontend/src/scenes/experiments/experimentLogic.tsx b/frontend/src/scenes/experiments/experimentLogic.tsx
index 8e993ecceb10..250e14f98486 100644
--- a/frontend/src/scenes/experiments/experimentLogic.tsx
+++ b/frontend/src/scenes/experiments/experimentLogic.tsx
@@ -760,7 +760,7 @@ export interface experimentLogicActions {
forceRefresh: boolean
}
reportHealthChecksOpened: (openedFrom: ExperimentHealthChecksOpenedFrom) => {
- openedFrom: 'meta_bar'
+ openedFrom: ExperimentHealthChecksOpenedFrom
}
reportHealthFindingActedOn: (
finding: ExperimentHealthFinding,
diff --git a/frontend/src/scenes/experiments/experimentSceneLogic.tsx b/frontend/src/scenes/experiments/experimentSceneLogic.tsx
index 567b2c995aa2..bf09e928215e 100644
--- a/frontend/src/scenes/experiments/experimentSceneLogic.tsx
+++ b/frontend/src/scenes/experiments/experimentSceneLogic.tsx
@@ -59,6 +59,7 @@ export const EXPERIMENT_TABS = [
'recordings',
'feedback',
'history',
+ 'health',
'health-debug',
] as const
export type ExperimentTab = (typeof EXPERIMENT_TABS)[number]
@@ -69,7 +70,7 @@ export const DEFAULT_EXPERIMENT_TAB: ExperimentTab = 'metrics'
// and LegacyExperimentView — a tab the views render but this omits gets clamped away on load.
export const getAvailableExperimentTabs = (
experiment: Experiment,
- { canSeeHealthDebug = false }: { canSeeHealthDebug?: boolean } = {}
+ { canSeeHealth = false, canSeeHealthDebug = false }: { canSeeHealth?: boolean; canSeeHealthDebug?: boolean } = {}
): ExperimentTab[] => {
// Legacy experiments render a reduced, read-only view with only these two tabs.
if (isLegacyExperiment(experiment)) {
@@ -83,6 +84,8 @@ export const getAvailableExperimentTabs = (
return !isDraft
case 'feedback':
return !!experiment.feature_flag
+ case 'health':
+ return canSeeHealth
case 'health-debug':
return canSeeHealthDebug
default:
@@ -143,6 +146,7 @@ export interface experimentSceneLogicValues {
activeTabKey: ExperimentTab
availableTabs: ExperimentTab[]
breadcrumbs: Breadcrumb[]
+ canSeeHealth: boolean
canSeeHealthDebug: boolean
experiment: Experiment
experimentId: ExperimentIdType
@@ -171,6 +175,7 @@ export interface experimentSceneLogicActions {
activeTabKey:
| 'code'
| 'feedback'
+ | 'health'
| 'health-debug'
| 'history'
| 'metrics'
@@ -237,12 +242,13 @@ export interface experimentSceneLogicMeta {
} | null
) => ((state: any, props?: ExperimentLogicProps | undefined) => boolean) | undefined
isExperimentLaunched: (arg: boolean | undefined) => boolean
+ canSeeHealth: (user: UserType | null, featureFlags: FeatureFlagsSet) => boolean
canSeeHealthDebug: (
superpowersEnabled: boolean | undefined,
user: UserType | null,
featureFlags: FeatureFlagsSet
) => boolean
- availableTabs: (experiment: Experiment, canSeeHealthDebug: boolean) => ExperimentTab[]
+ availableTabs: (experiment: Experiment, canSeeHealth: boolean, canSeeHealthDebug: boolean) => ExperimentTab[]
experimentLoaded: (experiment: Experiment) => boolean
breadcrumbs: (experiment: Experiment, experimentId: ExperimentIdType) => Breadcrumb[]
sidePanelContext: (experimentId: ExperimentIdType) => SidePanelSceneContext | null
@@ -378,6 +384,12 @@ export const experimentSceneLogic = kea<experimentSceneLogicType>([
],
(isExperimentLaunched: boolean | undefined): boolean => isExperimentLaunched ?? false,
],
+ canSeeHealth: [
+ (s) => [s.user, s.featureFlags],
+ // The same readers as experimentLogic's `showsHealthFindings`, so the tab shows wherever the findings do.
+ (user: UserType | null, featureFlags: FeatureFlagsSet): boolean =>
+ !!featureFlags[FEATURE_FLAGS.EXPERIMENT_HEALTH_FINDINGS] || !!user?.is_impersonated,
+ ],
canSeeHealthDebug: [
(s) => [s.superpowersEnabled, s.user, s.featureFlags],
(superpowersEnabled: boolean | undefined, user: UserType | null, featureFlags: FeatureFlagsSet): boolean =>
@@ -388,9 +400,9 @@ export const experimentSceneLogic = kea<experimentSceneLogicType>([
}),
],
availableTabs: [
- (s) => [s.experiment, s.canSeeHealthDebug],
- (experiment: Experiment, canSeeHealthDebug: boolean): ExperimentTab[] =>
- getAvailableExperimentTabs(experiment, { canSeeHealthDebug }),
+ (s) => [s.experiment, s.canSeeHealth, s.canSeeHealthDebug],
+ (experiment: Experiment, canSeeHealth: boolean, canSeeHealthDebug: boolean): ExperimentTab[] =>
+ getAvailableExperimentTabs(experiment, { canSeeHealth, canSeeHealthDebug }),
],
experimentLoaded: [
(s) => [s.experiment],
diff --git a/frontend/src/scenes/experiments/stories/ExperimentHealthTab.stories.tsx b/frontend/src/scenes/experiments/stories/ExperimentHealthTab.stories.tsx
new file mode 100644
index 000000000000..94eee433b3f2
--- /dev/null
+++ b/frontend/src/scenes/experiments/stories/ExperimentHealthTab.stories.tsx
@@ -0,0 +1,162 @@
+import { Meta, StoryObj } from '@storybook/react'
+
+import { FEATURE_FLAGS } from 'lib/constants'
+import { makeDelay } from 'lib/utils/async'
+import { App } from 'scenes/App'
+import { urls } from 'scenes/urls'
+
+import { mswDecorator } from '~/mocks/browser'
+import EXPERIMENT_WITH_MEAN_METRIC from '~/mocks/fixtures/api/experiments/experiment_with_mean_metric.json'
+import EXPOSURE_QUERY_RESULT from '~/mocks/fixtures/api/experiments/exposure_query_result.json'
+import MEAN_METRIC_RESULT from '~/mocks/fixtures/api/experiments/mean_metric_result.json'
+import { NodeKind } from '~/queries/schema/schema-general'
+
+import { recalculationMocks, resultsByMetricType } from './recalculationMocks'
+
+type Check = { key: string; name: string; status: string; reason: string | null }
+
+const passed = (key: string, name: string): Check => ({ key, name, status: 'passed', reason: null })
+
+const EXPERIMENT_CHECKS: Check[] = [
+ passed('flag_state', "Flag state that doesn't match the experiment"),
+ passed('flag_history', 'Unreadable flag history'),
+ passed('split_changed_mid_run', 'Variant split changes since launch'),
+ passed('bucketing_changed_mid_run', 'Variant assignment changes since launch'),
+ passed('release_conditions_changed_mid_run', 'Release condition changes since launch'),
+ passed('flag_variants_mismatch', 'Flag variants not set up'),
+ passed('forced_variant_release_condition', 'Release conditions that force a variant'),
+ {
+ key: 'new_flag_no_traffic',
+ name: 'Flag calls not received yet',
+ status: 'not_applicable',
+ reason: 'Runs before launch',
+ },
+ passed('no_metric', 'Metrics not set up'),
+ passed('metric_event_not_ingested', 'Metric events not received yet'),
+ passed('metric_cannot_compile', 'Invalid metric definitions'),
+ passed('metric_calculation_failed', 'Failed metric calculations'),
+ passed('metric_all_zero', 'Metrics at zero in every variant'),
+ passed('exposure_criteria_cannot_match', "Exposure criteria that can't match"),
+ passed('exposure_filters', 'Dynamic cohorts in the exposure criteria'),
+ passed('early_significance', 'Significance on a small sample'),
+ passed('metrics_not_matured', 'Metric windows not complete yet'),
+]
+
+const EXPOSURE_CHECKS: Check[] = [
+ passed('zero_exposures', 'Exposures not received since launch'),
+ passed('test_account_filter_removes_exposures', 'Test account filters that leave out most users'),
+ passed('srm', 'Split of users across variants'),
+ {
+ key: 'bias_risk_multiple_excluded',
+ name: 'Bias from an uneven split',
+ status: 'not_applicable',
+ reason: 'The split is even',
+ },
+ passed('multiple_variants_share', 'Users exposed to multiple variants'),
+]
+
+const withStatus = (checks: Check[], key: string, status: string): Check[] =>
+ checks.map((check) => (check.key === key ? { ...check, status } : check))
+
+const HEALTHY_EXPOSURES = {
+ ...EXPOSURE_QUERY_RESULT,
+ total_exposures: { control: 1012, 'test-1': 993, 'test-2': 995, $multiple: 18 },
+ sample_ratio_mismatch: { expected: { control: 1020, 'test-1': 990, 'test-2': 990 }, p_value: 0.62 },
+ health_findings: [],
+ health_checks: EXPOSURE_CHECKS,
+}
+
+const EXPOSURES_WITH_SRM = {
+ ...EXPOSURE_QUERY_RESULT,
+ sample_ratio_mismatch: { expected: { control: 1020, 'test-1': 990, 'test-2': 990 }, p_value: 0.00004 },
+ health_findings: [
+ {
+ code: 'srm',
+ subcode: null,
+ reason: null,
+ severity: 'warning',
+ title: 'Users are not split across variants as configured',
+ detail: "The distribution of users across variants doesn't match your configured rollout percentages (p < 0.001). This may indicate issues with randomization or data collection.",
+ evidence: { p_value: 0.00004 },
+ actions: [],
+ diagnostic_ref: 'A2',
+ },
+ ],
+ 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 })
+)
+
+function healthMocks(health: object, exposures: object): Parameters<typeof mswDecorator>[0] {
+ return {
+ get: {
+ ...RECALCULATION.get,
+ [`/api/projects/:team_id/experiments/${EXPERIMENT_WITH_MEAN_METRIC.id}/`]: EXPERIMENT_WITH_MEAN_METRIC,
+ [`/api/projects/:team_id/experiments/${EXPERIMENT_WITH_MEAN_METRIC.id}/health/`]: health,
+ [`/api/projects/:team_id/experiment_holdouts`]: [],
+ [`/api/projects/:team_id/experiment_saved_metrics/`]: [],
+ [`/api/projects/:team_id/feature_flags/${EXPERIMENT_WITH_MEAN_METRIC.feature_flag.id}/`]: {},
+ [`/api/projects/:team_id/feature_flags/${EXPERIMENT_WITH_MEAN_METRIC.feature_flag.id}/status/`]: {},
+ [`/api/environments/:team_id/default_release_conditions/`]: [],
+ },
+ post: {
+ ...RECALCULATION.post,
+ '/api/environments/:team_id/query/:kind': async ({ request }) => {
+ const body = (await request.json()) as Record<string, any>
+ return body.query.kind === NodeKind.ExperimentExposureQuery ? [200, exposures] : [404]
+ },
+ },
+ }
+}
+
+const meta: Meta = {
+ component: App,
+ title: 'Scenes-App/Experiments/Health tab',
+ parameters: {
+ layout: 'fullscreen',
+ viewMode: 'story',
+ mockDate: '2025-01-27',
+ pageUrl: `${urls.experiment(EXPERIMENT_WITH_MEAN_METRIC.id)}?tab=health`,
+ featureFlags: [FEATURE_FLAGS.EXPERIMENT_HEALTH_FINDINGS],
+ testOptions: { snapshotBrowsers: [] },
+ },
+}
+export default meta
+
+type Story = StoryObj<{}>
+
+export const AllChecksPassed: Story = {
+ decorators: [
+ mswDecorator(
+ healthMocks(
+ { findings: [METRIC_NOTE], checks: withStatus(EXPERIMENT_CHECKS, 'metrics_not_matured', 'finding') },
+ HEALTHY_EXPOSURES
+ )
+ ),
+ ],
+ play: async () => {
+ await makeDelay(1500)()
+ },
+}
+
+export const WithAnIssue: Story = {
+ decorators: [mswDecorator(healthMocks({ findings: [], checks: EXPERIMENT_CHECKS }, EXPOSURES_WITH_SRM))],
+ play: async () => {
+ await makeDelay(1500)()
+ },
+}
diff --git a/frontend/src/scenes/experiments/stories/ExperimentWithHealthFindings.stories.tsx b/frontend/src/scenes/experiments/stories/ExperimentWithHealthFindings.stories.tsx
index cb3ed26bb789..942876e0ecc5 100644
--- a/frontend/src/scenes/experiments/stories/ExperimentWithHealthFindings.stories.tsx
+++ b/frontend/src/scenes/experiments/stories/ExperimentWithHealthFindings.stories.tsx
@@ -1,6 +1,5 @@
import { Meta, StoryObj } from '@storybook/react'
import { within } from '@testing-library/dom'
-import userEvent from '@testing-library/user-event'
import { FEATURE_FLAGS } from 'lib/constants'
import { makeDelay } from 'lib/utils/async'
@@ -120,13 +119,11 @@ export default meta
type Story = StoryObj<{}>
-// One finding open and two closed, so both row states are in one picture.
+// The metrics tab with issues: the chip and the health tab's count show them, and no warning banner renders.
export const ExperimentWithHealthFindings: Story = {
play: async ({ canvasElement }) => {
const canvas = within(canvasElement)
- await makeDelay(500)()
- const [firstWhy] = await canvas.findAllByText('Why?', {}, { timeout: 5000 })
- await userEvent.click(firstWhy)
+ await canvas.findByText('3 issues', {}, { timeout: 15000 })
await makeDelay(500)()
},
}
diff --git a/products/experiments/frontend/constants.ts b/products/experiments/frontend/constants.ts
index 67e7bb65b9b8..feeaaba94b0e 100644
--- a/products/experiments/frontend/constants.ts
+++ b/products/experiments/frontend/constants.ts
@@ -3,8 +3,6 @@ import type { Experiment } from '~/types'
export const EXPERIMENT_VARIANT_MULTIPLE = '$multiple'
-export const EXPERIMENT_HEALTH_PANEL_ELEMENT_ID = 'experiment-health-panel'
-
export const CONFIDENCE_LEVEL_OPTIONS = [
{ value: 0.9, label: '90%' },
{ value: 0.95, label: '95%' },
diff --git a/products/experiments/frontend/health/ExperimentHealthChip.tsx b/products/experiments/frontend/health/ExperimentHealthChip.tsx
index 209164a19a6a..2c1489588e05 100644
--- a/products/experiments/frontend/health/ExperimentHealthChip.tsx
+++ b/products/experiments/frontend/health/ExperimentHealthChip.tsx
@@ -1,21 +1,30 @@
import { useActions, useValues } from 'kea'
-import { useState } from 'react'
+import { useEffect } from 'react'
import { IconWarning } from '@posthog/icons'
-import { LemonButton, LemonDropdown, Spinner } from '@posthog/lemon-ui'
+import { LemonButton, Spinner } from '@posthog/lemon-ui'
import { pluralize } from 'lib/utils/strings'
import { experimentLogic } from 'scenes/experiments/experimentLogic'
+import { experimentSceneLogic } from 'scenes/experiments/experimentSceneLogic'
-import { HealthChecksOverview } from './HealthChecksOverview'
import { healthChipState } from './healthPanelChecks'
+import { healthIssues } from './healthPanelFindings'
export function ExperimentHealthChip(): JSX.Element | null {
- const { healthFindings, healthChecks, healthExposureChecks, isExperimentDraft } = useValues(experimentLogic)
- const { reportHealthChecksOpened } = useActions(experimentLogic)
- const [isOverviewOpen, setIsOverviewOpen] = useState(false)
+ const { healthFindings, healthChecks, healthExposureChecks, experimentLoadCount } = useValues(experimentLogic)
+ const { reportHealthChecksOpened, reportHealthFindingShown } = useActions(experimentLogic)
+ const { setActiveTabKey } = useActions(experimentSceneLogic)
const state = healthChipState(healthFindings, healthChecks, healthExposureChecks)
+ // 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.
+ useEffect(() => {
+ for (const { code, subcode, severity, reason } of healthIssues(healthFindings)) {
+ reportHealthFindingShown({ code, subcode: subcode ?? undefined, severity, reason: reason ?? undefined })
+ }
+ }, [healthFindings, experimentLoadCount, reportHealthFindingShown])
+
if (state.kind === 'hidden') {
return null
}
@@ -27,49 +36,30 @@ export function ExperimentHealthChip(): JSX.Element | null {
</span>
)
}
- // The same overview opens with and without issues, so the reader finds the checks behind either label.
- return (
- <LemonDropdown
- overlay={
- <HealthChecksOverview
- checks={state.checks}
- findings={state.findings}
- isDraft={isExperimentDraft}
- exposureChecksMissing={healthExposureChecks === 'missing'}
- // Most actions open a modal, and a modal renders below a popover, so the overview closes first.
- onFindingActedOn={() => setIsOverviewOpen(false)}
- />
- }
- visible={isOverviewOpen}
- closeOnClickInside={false}
- placement="bottom-start"
- onVisibilityChange={(visible) => {
- setIsOverviewOpen(visible)
- if (visible) {
- reportHealthChecksOpened('meta_bar')
- }
- }}
+ const openHealthTab = (): void => {
+ setActiveTabKey('health')
+ reportHealthChecksOpened('meta_bar')
+ }
+ return state.kind === 'issues' ? (
+ <LemonButton
+ type="secondary"
+ size="xsmall"
+ icon={<IconWarning className={state.hasCritical ? 'text-danger' : 'text-warning'} />}
+ tooltip="Show the health checks"
+ onClick={openHealthTab}
+ data-attr="experiment-health-chip"
+ >
+ {pluralize(state.count, 'issue')}
+ </LemonButton>
+ ) : (
+ <LemonButton
+ type="tertiary"
+ size="xsmall"
+ tooltip="Show the health checks"
+ onClick={openHealthTab}
+ data-attr="experiment-health-checks-button"
>
- {state.kind === 'issues' ? (
- <LemonButton
- type="secondary"
- size="xsmall"
- icon={<IconWarning className={state.hasCritical ? 'text-danger' : 'text-warning'} />}
- tooltip="Show the health checks"
- data-attr="experiment-health-chip"
- >
- {pluralize(state.count, 'issue')}
- </LemonButton>
- ) : (
- <LemonButton
- type="tertiary"
- size="xsmall"
- tooltip="Health checks"
- data-attr="experiment-health-checks-button"
- >
- <span className="font-normal">{state.label}</span>
- </LemonButton>
- )}
- </LemonDropdown>
+ <span className="font-normal">{state.label}</span>
+ </LemonButton>
)
}
diff --git a/products/experiments/frontend/health/ExperimentHealthPanel.tsx b/products/experiments/frontend/health/ExperimentHealthPanel.tsx
deleted file mode 100644
index 50bea1a97cdf..000000000000
--- a/products/experiments/frontend/health/ExperimentHealthPanel.tsx
+++ /dev/null
@@ -1,40 +0,0 @@
-import { useValues } from 'kea'
-
-import { LemonCard, LemonTag } from '@posthog/lemon-ui'
-
-import { experimentLogic } from 'scenes/experiments/experimentLogic'
-
-import { EXPERIMENT_HEALTH_PANEL_ELEMENT_ID } from '../constants'
-import { HealthFindingRow } from './HealthFindingRow'
-import { healthIssues } from './healthPanelFindings'
-
-export function ExperimentHealthPanel(): JSX.Element | null {
- const { healthFindings } = useValues(experimentLogic)
-
- // The chip next to the experiment's status lists every check, so the panel shows the findings, and only with an issue.
- if (healthFindings === null || healthIssues(healthFindings).length === 0) {
- return null
- }
-
- return (
- <section
- id={EXPERIMENT_HEALTH_PANEL_ELEMENT_ID}
- aria-labelledby={`${EXPERIMENT_HEALTH_PANEL_ELEMENT_ID}-title`}
- data-attr="experiment-health-panel"
- >
- <LemonCard hoverEffect={false} className="p-0">
- <div className="flex items-center gap-2 px-3 py-2 border-b">
- <h3 id={`${EXPERIMENT_HEALTH_PANEL_ELEMENT_ID}-title`} className="m-0 text-sm font-semibold">
- Health checks
- </h3>
- <LemonTag type="completion">Beta</LemonTag>
- </div>
- <div className="divide-y">
- {healthFindings.map((finding) => (
- <HealthFindingRow key={`${finding.code}:${finding.subcode ?? ''}`} finding={finding} />
- ))}
- </div>
- </LemonCard>
- </section>
- )
-}
diff --git a/products/experiments/frontend/health/ExperimentHealthTab.tsx b/products/experiments/frontend/health/ExperimentHealthTab.tsx
new file mode 100644
index 000000000000..d2dd19cb0887
--- /dev/null
+++ b/products/experiments/frontend/health/ExperimentHealthTab.tsx
@@ -0,0 +1,43 @@
+import { useValues } from 'kea'
+
+import { LemonBanner, LemonCard, Spinner } from '@posthog/lemon-ui'
+
+import { experimentLogic } from 'scenes/experiments/experimentLogic'
+
+import { HealthChecksOverview } from './HealthChecksOverview'
+
+export function ExperimentHealthTab(): JSX.Element {
+ const { healthFindings, healthChecks, healthExposureChecks, isExperimentDraft, experimentHealthLoading } =
+ useValues(experimentLogic)
+
+ if (healthFindings === null || healthChecks === null) {
+ return experimentHealthLoading ? (
+ <div className="flex items-center gap-2 py-8 text-secondary" data-attr="experiment-health-tab-loading">
+ <Spinner />
+ <span>Running the health checks</span>
+ </div>
+ ) : (
+ <LemonBanner type="error">Couldn't load the health checks. Refresh the page to try again.</LemonBanner>
+ )
+ }
+
+ return (
+ // A reading width, so a finding's buttons stay next to its title.
+ <div className="flex flex-col gap-2 max-w-3xl" data-attr="experiment-health-tab">
+ <LemonCard hoverEffect={false} className="p-0">
+ <HealthChecksOverview
+ checks={healthChecks}
+ findings={healthFindings}
+ isDraft={isExperimentDraft}
+ exposureChecksMissing={healthExposureChecks === 'missing'}
+ />
+ </LemonCard>
+ {healthExposureChecks === 'pending' && (
+ <span className="flex items-center gap-1 text-secondary">
+ <Spinner className="text-sm" />
+ <span>Checking the exposures</span>
+ </span>
+ )}
+ </div>
+ )
+}
diff --git a/products/experiments/frontend/health/HealthCheckList.tsx b/products/experiments/frontend/health/HealthCheckList.tsx
index de2046a05fcb..7a39045df677 100644
--- a/products/experiments/frontend/health/HealthCheckList.tsx
+++ b/products/experiments/frontend/health/HealthCheckList.tsx
@@ -8,7 +8,7 @@ type ListedStatus = ListedHealthCheck['status']
const STATUS_DISPLAY: Record<ListedStatus, { icon: JSX.Element; label: string }> = {
not_checked: { icon: <IconQuestion className="text-secondary" />, label: "Couldn't check" },
- passed: { icon: <IconCheck className="text-success" />, label: 'Looked for, not found' },
+ passed: { icon: <IconCheck className="text-success" />, label: 'No issue found' },
not_applicable: { icon: <IconMinus className="text-tertiary" />, label: "Doesn't apply" },
}
@@ -47,7 +47,7 @@ export function HealthCheckList({
exposureChecksMissing: boolean
}): JSX.Element {
return (
- <div className="flex flex-col gap-2 px-3 py-2" data-attr="experiment-health-check-list">
+ <div className="flex flex-col gap-4 px-3 py-2" data-attr="experiment-health-check-list">
{groupByOutcome(checks, exposureChecksMissing).map((group) => (
<div key={`${group.status}:${group.label}`} className="flex flex-col gap-1">
<span className="text-xs font-semibold text-secondary">{group.label}</span>
diff --git a/products/experiments/frontend/health/HealthChecksOverview.stories.tsx b/products/experiments/frontend/health/HealthChecksOverview.stories.tsx
index d13450162c4b..59c7cded8156 100644
--- a/products/experiments/frontend/health/HealthChecksOverview.stories.tsx
+++ b/products/experiments/frontend/health/HealthChecksOverview.stories.tsx
@@ -31,6 +31,13 @@ const meta: Meta<typeof HealthChecksOverview> = {
testOptions: { snapshotBrowsers: ['chromium'] },
},
args: { onFindingActedOn: () => {} },
+ decorators: [
+ (Story) => (
+ <div className="w-96">
+ <Story />
+ </div>
+ ),
+ ],
}
export default meta
diff --git a/products/experiments/frontend/health/HealthChecksOverview.tsx b/products/experiments/frontend/health/HealthChecksOverview.tsx
index e44f0948577f..9d31f22c0007 100644
--- a/products/experiments/frontend/health/HealthChecksOverview.tsx
+++ b/products/experiments/frontend/health/HealthChecksOverview.tsx
@@ -18,12 +18,12 @@ export function HealthChecksOverview({
findings: HealthPanelFinding[]
isDraft: boolean
exposureChecksMissing: boolean
- onFindingActedOn: () => void
+ onFindingActedOn?: () => void
}): JSX.Element {
const listedChecks = listedHealthChecks(checks)
return (
- <div className="flex flex-col w-96 max-w-full" data-attr="experiment-health-overview">
+ <div className="flex flex-col w-full" data-attr="experiment-health-overview">
<div className="flex flex-col gap-1 px-3 py-2">
<div className="flex items-center gap-2">
<span className="text-sm font-semibold">Health checks</span>
@@ -32,14 +32,15 @@ export function HealthChecksOverview({
<HealthChecksSummary checks={checks} issueCount={healthIssues(findings).length} isDraft={isDraft} />
</div>
{findings.length > 0 && (
- // A note mounts, and so reports as shown, only when the reader opens this overview. The panel reports the
- // issues on its own.
+ // 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.
<div className="divide-y border-t">
{findings.map((finding) => (
<HealthFindingRow
key={`${finding.code}:${finding.subcode ?? ''}`}
finding={finding}
onActedOn={onFindingActedOn}
+ isDetailOpenAtFirst={finding.severity !== 'info'}
/>
))}
</div>
diff --git a/products/experiments/frontend/health/HealthFindingRow.tsx b/products/experiments/frontend/health/HealthFindingRow.tsx
index d3907268d1b3..021a7738e737 100644
--- a/products/experiments/frontend/health/HealthFindingRow.tsx
+++ b/products/experiments/frontend/health/HealthFindingRow.tsx
@@ -19,11 +19,14 @@ const SEVERITY_LABELS: Record<HealthPanelFinding['severity'], string> = {
export function HealthFindingRow({
finding,
onActedOn,
+ isDetailOpenAtFirst = false,
}: {
finding: HealthPanelFinding
onActedOn?: () => void
+ /** Shows the detail without a click. Only a click reports the finding as opened, so this sends no event. */
+ isDetailOpenAtFirst?: boolean
}): JSX.Element {
- const [isDetailOpen, setIsDetailOpen] = useState(false)
+ const [isDetailOpen, setIsDetailOpen] = useState(isDetailOpenAtFirst)
const detailId = useId()
const { reportOpened, reportActedOn } = useHealthFindingReporting({
code: finding.code,
diff --git a/products/experiments/frontend/health/experimentHealthFindingEvents.ts b/products/experiments/frontend/health/experimentHealthFindingEvents.ts
index 8e2d5e92b2cc..d588d83e7dce 100644
--- a/products/experiments/frontend/health/experimentHealthFindingEvents.ts
+++ b/products/experiments/frontend/health/experimentHealthFindingEvents.ts
@@ -81,11 +81,11 @@ export const FLAG_STATE_FINDING_CODES: ReadonlySet<ExperimentHealthFindingCode>
)
// pinned: `opened_from` property values of `experiment health checks opened`.
-export type ExperimentHealthChecksOpenedFrom = 'meta_bar'
+export type ExperimentHealthChecksOpenedFrom = 'meta_bar' | 'tab'
// pinned: `health_ui` property values. Insights compare the server's findings with the separate warnings on them.
-// 'panel' means the page shows the server's findings: in the health panel when one is an issue, otherwise in the
-// health chip next to the experiment's status.
+// 'panel' means the page shows the server's findings: in the health tab, with a count of the issues in the chip
+// next to the experiment's status.
export type ExperimentHealthUi = 'panel' | 'warnings'
export function experimentHealthUi(experiment: Experiment, showsServerHealth: boolean): ExperimentHealthUi {