: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(replay-vision): explain why the what to watch feed is empty (#108853)
Kim Svatos Dugan737358b11c88
diff --git a/frontend/snapshots.yml b/frontend/snapshots.ymlindex a2af4e10f195..9d82bd9d263a 100644--- a/frontend/snapshots.yml+++ b/frontend/snapshots.yml@@ -11311,9 +11311,9 @@ snapshots:scenes-app-replay-vision--home-watch-feed--light:hash: v1.k794b7964.d891003a18f40fdfd7a5c7acb16fd69a7432917c0758c9d751ce9848e0e817a6.MU9DRlLvjCioaMuOgSbAL0Tfrcx9SNFVPVWgKfQ8pKcscenes-app-replay-vision--home-watch-feed-empty--dark:- hash: v1.k794b7964.c8b63e7c03105a6a22c7dfecc5fa98afb410af14180977eeb9907c2e57f43e29.9d0B-LDyKHrQ75wpveOo913SMTZvi2fe4RTJOrFtDM0+ hash: v1.k794b7964.926bab41fb78cabf70493f52b629520842bcdb6fd7e0a838babb178ad948c67f.6Q9grGAgt0DLOh0YWKUgIOuHlFvn0gDCeHHOrqdav7gscenes-app-replay-vision--home-watch-feed-empty--light:- hash: v1.k794b7964.33393d260f0654e59dbc209d6052c2b0730dfc6e8f59925406cd3a9349569980.63xRgoQrVu1PM7n1sBaVx6QV7Otc_rKCusdfHhsGuBU+ hash: v1.k794b7964.71ae84e0d38203d5860ee8feb2a633a339e79de59b03b514807c7493517486fb.3NLgnN7g1YbjscaN_XzQhxSoqltm99utfh3_1E_29J8scenes-app-replay-vision--home-watch-feed-only-newest--dark:hash: v1.k794b7964.f64a7c7bb16de8d589664ccb6e0bce38eba82a63d1375d348c3a44628445a98f.LWCEsvlNc28TTOiiwI7-GrLQm165fAPCjY3oBQWKVVsscenes-app-replay-vision--home-watch-feed-only-newest--light:@@ -11542,6 +11542,30 @@ snapshots:hash: v1.k794b7964.57289f977a42e43a6b70a0718959bc995a7a45245b20fda636e880beec7cc2e8.2CONzn8joR8LZgN9VOcNokIFUUJmtzE-TJTbprVGmt8scenes-app-replay-vision-test-account-filter-settings-dialog--default--light:hash: v1.k794b7964.8276936411550e5ab99aa3d216a442c6328a55434a4bcf273cbef46a39d940b4.asrT7Nd6P9HVchxOoJPfMOOttbQVP6XFXptRAtnXC3k+ scenes-app-replay-vision-watchfeedemptystate--all-capped--dark:+ hash: v1.k794b7964.2044f64f59724a250003d8be462529ad61a07e05f5a7104879a7b00980c17b1e.2ec-AsxkwzKRLGbe4NJhCFYTVZhBBS-G4PowHISQAK0+ scenes-app-replay-vision-watchfeedemptystate--all-capped--light:+ hash: v1.k794b7964.827951eedc4b27a19c51943be56de5e66332fe2af13d258a5020c5f9e02d90ef.fnVEjjQoWjIJ-A4NO1HbAOmf1QkPjatVvl56ecWn5-o+ scenes-app-replay-vision-watchfeedemptystate--all-disabled--dark:+ hash: v1.k794b7964.95f5488d9be93532b070280e334d24ebc7ea4216b3fd91e317c60ba3a4c6bb37.wX3TVVh7pA_u9ZeTvQFT7quClJdoO-mzd_EKzQqTXJw+ scenes-app-replay-vision-watchfeedemptystate--all-disabled--light:+ hash: v1.k794b7964.87641562db015731f2de39e04591e3efd4e136db74a726b4e7a8835f6b608be6._VX6C8s2D6xBgXcwhyxW47DDLTNUg90321xZZc0enxE+ scenes-app-replay-vision-watchfeedemptystate--filtered--dark:+ hash: v1.k794b7964.417933f4f0dbd89798575f302a173ac5780705a8533c42e7196c8922a5b9d0ec.zAKPjkDiU74sZwyCufk7XKxwAmu-of86YMX-TTIcUSE+ scenes-app-replay-vision-watchfeedemptystate--filtered--light:+ hash: v1.k794b7964.b4dbcfa2372545ec4218a5974345864dc01908f4682afe32b05e7cc968747a71.jSaF9RqYy5QMC4Jj0ilFjfNhRm0TEPaCeXIfPg33eSc+ scenes-app-replay-vision-watchfeedemptystate--no-scanners--dark:+ hash: v1.k794b7964.f2bd16f47816e1a9d2fd314270daa72223c37a8946af17765b3f3c43df966cfe.3wSlppAgHktz_NPXbdFqdb0d4SxmdQ4_lBtKTji20e0+ scenes-app-replay-vision-watchfeedemptystate--no-scanners--light:+ hash: v1.k794b7964.5de8b483a01bf5f9ed595e900d6b6f26180f901bcfb9c8bb2729fbf46f847264.nqlSLSEafSpbB7kI11PSDxLlU-YmYfwC5oDLC1QLVbw+ scenes-app-replay-vision-watchfeedemptystate--quiet-window--dark:+ hash: v1.k794b7964.50cd583401f3e45ec47f476cc0d9fb3208294202af2aa1cb0856fb7c1fd3fb83.EKR4ZZU6vyZ6xxUv4dX_f5telnfevtft2rV7R8wv_mY+ scenes-app-replay-vision-watchfeedemptystate--quiet-window--light:+ hash: v1.k794b7964.e0ed64d8967f7b29fdc9503d95da3f8ce8936a49c15a861c276355f27282e2a9.8J-XaVdJjUsBXNVxy_GjYq-5lQn3RpH3QAEce7x34lU+ scenes-app-replay-vision-watchfeedemptystate--quota-exhausted--dark:+ hash: v1.k794b7964.156b681d8c3026279523eae78298898334fecd340a168a93c2b1f27e8b87c477.2RIkQGbqyk33Exg6GczARiEZpZowlwCUPXbukhOSki0+ scenes-app-replay-vision-watchfeedemptystate--quota-exhausted--light:+ hash: v1.k794b7964.955908541d73f6f32bd758cdd758724f10e201e3fea481b91294b284a489fe96.3buIiPKIIBer22g58o_OW3nkOAcV0uHmNfUFXn8ldnIscenes-app-saved-insights--empty-state--dark:hash: v1.k794b7964.8186a1849accab762928456f98db977a9b097cf28199d7e1eb6c1e841500852c.SXNRf2LgiH3DkvhwUukZcGqDXngv1kGiEhGYUAhlKC8scenes-app-saved-insights--empty-state--light:diff --git a/products/replay_vision/frontend/replay_scanners/components/WatchFeedEmptyState.stories.tsx b/products/replay_vision/frontend/replay_scanners/components/WatchFeedEmptyState.stories.tsxnew file mode 100644index 000000000000..72778dc4c8c7--- /dev/null+++ b/products/replay_vision/frontend/replay_scanners/components/WatchFeedEmptyState.stories.tsx@@ -0,0 +1,30 @@+import type { Meta, StoryObj } from '@storybook/react'++import { WatchFeedEmptyState } from './WatchFeedEmptyState'++// One story per reason: the copy is the feature here, so a screenshot is the only way to check that+// each one reads as a different answer with a different next step.+const meta: Meta<typeof WatchFeedEmptyState> = {+ title: 'Scenes-App/Replay Vision/WatchFeedEmptyState',+ component: WatchFeedEmptyState,+ decorators: [+ // The width has to come from the parent. LemonBanner is a CSS container, so its contents do+ // not set its width, and the snapshot runner sizes the story root to hug its child — which+ // collapses a bannered story to a strip. This is also the width the feed renders at.+ (Story) => (+ <div className="w-200">+ <Story />+ </div>+ ),+ ],+}+export default meta++type Story = StoryObj<typeof WatchFeedEmptyState>++export const NoScanners: Story = { args: { reason: 'no-scanners' } }+export const AllDisabled: Story = { args: { reason: 'all-disabled' } }+export const QuotaExhausted: Story = { args: { reason: 'quota-exhausted' } }+export const AllCapped: Story = { args: { reason: 'all-capped' } }+export const Filtered: Story = { args: { reason: 'filtered' } }+export const QuietWindow: Story = { args: { reason: 'quiet-window' } }diff --git a/products/replay_vision/frontend/replay_scanners/components/WatchFeedEmptyState.tsx b/products/replay_vision/frontend/replay_scanners/components/WatchFeedEmptyState.tsxnew file mode 100644index 000000000000..4f5b79a1a4e6--- /dev/null+++ b/products/replay_vision/frontend/replay_scanners/components/WatchFeedEmptyState.tsx@@ -0,0 +1,107 @@+import { useActions, useValues } from 'kea'+import { router } from 'kea-router'++import { LemonBanner, LemonButton } from '@posthog/lemon-ui'++import { urls } from 'scenes/urls'++import { visionScannersListLogic } from '../../logics/visionScannersListLogic'+import type { WatchFeedEmptyReason } from '../watchFeedEmptyState'+import { watchFeedLogic } from '../watchFeedLogic'+import { WatchFeedIntro } from './WatchFeedIntro'++function DashedNote({ children }: { children: React.ReactNode }): JSX.Element {+ return (+ <div className="flex flex-col items-center gap-2 text-sm text-secondary border border-dashed rounded p-6 text-center">+ {children}+ </div>+ )+}++/**+ * The one screen the What to watch tab shows when it has no clips. Each reason gets the next step+ * that would actually fill the feed, so a reader is never told to wait on scanners that cannot run.+ */+export function WatchFeedEmptyState({ reason }: { reason: WatchFeedEmptyReason }): JSX.Element {+ const { clearFeedFilters } = useActions(watchFeedLogic)+ const { scanners } = useValues(visionScannersListLogic)+ const { push } = useActions(router)++ if (reason === 'no-scanners') {+ return <WatchFeedIntro />+ }++ if (reason === 'all-disabled') {+ return (+ <LemonBanner+ type="warning"+ action={{+ children: 'See all scanners',+ onClick: () => push(urls.replayVision(), { tab: 'scanners' }),+ 'data-attr': 'vision-watch-feed-see-scanners',+ }}+ >+ <p className="font-semibold m-0">None of your scanners are running</p>+ <p className="m-0">+ {/* Only worth counting once there are several. The list loads on its own, so a count+ taken before it answers would read as "All 0 of your scanners". */}+ {scanners.length > 1+ ? `All ${scanners.length} of your scanners are off, so nothing new can reach this feed.`+ : 'Every scanner on this project is off, so nothing new can reach this feed.'}{' '}+ Turn one on and its clips appear after the next matching recording.+ </p>+ </LemonBanner>+ )+ }++ if (reason === 'quota-exhausted') {+ return (+ <LemonBanner+ type="warning"+ action={{+ children: 'See usage',+ onClick: () => push(urls.replayVision(), { tab: 'usage' }),+ 'data-attr': 'vision-watch-feed-see-usage',+ }}+ >+ <p className="font-semibold m-0">Your Replay Vision credits are used up for this period</p>+ <p className="m-0">+ Scans are skipped until the period resets, so no new clips reach this feed. Raise the limit to start+ them again.+ </p>+ </LemonBanner>+ )+ }++ if (reason === 'all-capped') {+ return (+ <LemonBanner+ type="warning"+ action={{+ children: 'See usage',+ onClick: () => push(urls.replayVision(), { tab: 'usage' }),+ 'data-attr': 'vision-watch-feed-see-usage',+ }}+ >+ <p className="font-semibold m-0">Every running scanner has reached its own credit limit</p>+ <p className="m-0">+ They stop scanning until the period resets. Raise a scanner's limit to start it again. The sessions+ they skipped are not scanned later.+ </p>+ </LemonBanner>+ )+ }++ if (reason === 'filtered') {+ return (+ <DashedNote>+ <span>No clips match these filters in this window.</span>+ <LemonButton type="secondary" size="small" onClick={() => clearFeedFilters()}>+ Clear filters+ </LemonButton>+ </DashedNote>+ )+ }++ return <DashedNote>Nothing stood out in this window. Try a longer date range to see more.</DashedNote>+}diff --git a/products/replay_vision/frontend/replay_scanners/components/WatchFeedIntro.tsx b/products/replay_vision/frontend/replay_scanners/components/WatchFeedIntro.tsxnew file mode 100644index 000000000000..975154bfb9fb--- /dev/null+++ b/products/replay_vision/frontend/replay_scanners/components/WatchFeedIntro.tsx@@ -0,0 +1,92 @@+import { IconPlayFilled } from '@posthog/icons'+import { LemonTag } from '@posthog/lemon-ui'++import { VisionDocsLink } from '../../components/DocsLink'+import { CreateScannerButton } from './CreateScannerButton'++interface ExampleClip {+ scannerName: string+ scannerType: string+ headline: string+ reason: string+}++/**+ * Invented, not sampled. A reader with no scanners has no observations to preview, so these stand in+ * for the shape of a card rather than for anything their project has recorded.+ */+const EXAMPLE_CLIPS: ExampleClip[] = [+ {+ scannerName: 'Checkout friction',+ scannerType: 'Monitor',+ headline: 'Repeated clicks on a payment button that stayed disabled',+ reason: 'The scanner answered yes for this session.',+ },+ {+ scannerName: 'Onboarding drop-off',+ scannerType: 'Summarizer',+ headline: 'Went back and forth between plans, then closed the tab',+ reason: 'The scanner raised a UX friction signal from this session.',+ },+ {+ scannerName: 'Search quality',+ scannerType: 'Scorer',+ headline: 'Three searches in a row, none of them opened',+ reason: "Scored far from this scanner's recent average.",+ },+]++/**+ * What the What to watch tab shows a reader who has no scanners: what the feed is for, an example of+ * the card it fills with, and the way to start one.+ */+export function WatchFeedIntro(): JSX.Element {+ return (+ <div className="flex flex-col gap-4">+ <div className="flex flex-col items-center gap-2 text-center">+ <h3 className="text-xl font-semibold m-0">See your most notable observations here</h3>+ <p className="text-secondary m-0 max-w-lg">+ Scanners watch each new session recording and cite the moment they found. We surface the most+ notable ones here.+ </p>+ <div className="flex flex-wrap items-center justify-center gap-2 mt-1">+ <CreateScannerButton+ acceptedLabel="Create your first scanner"+ dataAttr="vision-watch-feed-create-scanner"+ size="medium"+ />+ <VisionDocsLink page="creating-scanners" dataAttr="vision-watch-feed-docs-link">+ Learn how scanners work+ </VisionDocsLink>+ </div>+ </div>++ <div className="relative flex flex-col gap-2">+ <p className="text-xs text-secondary m-0">Examples, not your data</p>+ {EXAMPLE_CLIPS.map((clip) => (+ <div key={clip.scannerName} className="flex gap-4 items-start border rounded bg-bg-light p-4">+ <div className="flex-none w-40 h-24 rounded bg-surface-secondary flex items-center justify-center text-secondary">+ <IconPlayFilled className="text-xl" />+ </div>+ <div className="min-w-0 flex flex-col gap-1">+ <div className="flex flex-wrap gap-1">+ <LemonTag type="highlight">Example</LemonTag>+ <LemonTag type="muted">{clip.scannerName}</LemonTag>+ <LemonTag type="muted">{clip.scannerType}</LemonTag>+ </div>+ <h4 className="text-sm font-semibold m-0">{clip.headline}</h4>+ <p className="text-xs text-secondary m-0">{clip.reason}</p>+ </div>+ </div>+ ))}+ {/* The examples stand in for a feed the reader does not have, so the column fades into+ the page instead of ending on a hard edge, which would read as a real feed cut+ short. The stop is the scene background token, so the fade lands in both themes. */}+ <div+ aria-hidden+ className="absolute inset-0 pointer-events-none bg-gradient-to-b from-transparent from-30% to-[var(--color-bg-primary)]"+ />+ </div>+ </div>+ )+}diff --git a/products/replay_vision/frontend/replay_scanners/components/WatchFeedTab.tsx b/products/replay_vision/frontend/replay_scanners/components/WatchFeedTab.tsxindex 91dc854f1bac..0497fd4c9998 100644--- a/products/replay_vision/frontend/replay_scanners/components/WatchFeedTab.tsx+++ b/products/replay_vision/frontend/replay_scanners/components/WatchFeedTab.tsx@@ -12,6 +12,7 @@ import { visionScannersListLogic } from '../../logics/visionScannersListLogic'import { SCANNER_TYPE_OPTIONS, ScannerType } from '../types'import { watchFeedLogic } from '../watchFeedLogic'import { FILLER_REASON_KINDS, WatchFeedCard } from './WatchFeedCard'+import { WatchFeedEmptyState } from './WatchFeedEmptyState'const TYPE_OPTIONS: { value: ScannerType; label: string }[] = SCANNER_TYPE_OPTIONS.map(({ value, label }) => ({value,@@ -43,6 +44,7 @@ export function WatchFeedTab(): JSX.Element {tagOptions,search,hasFeedFilters,+ emptyReason,} = useValues(watchFeedLogic)const {setDateRange,@@ -163,23 +165,14 @@ export function WatchFeedTab(): JSX.Element {items.map((item, index) => (<WatchFeedCard key={item.observation.id} item={item} position={index} />))- ) : !feedFailed ? (- <div className="flex flex-col items-center gap-2 text-sm text-secondary border border-dashed rounded p-6 text-center">- {hasFeedFilters ? (- <>- <span>No clips match these filters in this window.</span>- <LemonButton type="secondary" size="small" onClick={() => clearFeedFilters()}>- Clear filters- </LemonButton>- </>- ) : (- <span>- Nothing worth watching in this window yet. Observations appear here as your scanners- run.- </span>- )}- </div>- ) : null}+ ) : feedFailed ? null : emptyReason ? (+ <WatchFeedEmptyState reason={emptyReason} />+ ) : (+ // Still resolving why the feed is empty. The scanner list defaults to empty while+ // it loads, so naming a reason now would show the no-scanners screen to a reader+ // who has scanners.+ <LemonSkeleton className="h-32 rounded" />+ )}</div>)}</div>diff --git a/products/replay_vision/frontend/replay_scanners/watchFeedEmptyState.test.ts b/products/replay_vision/frontend/replay_scanners/watchFeedEmptyState.test.tsnew file mode 100644index 000000000000..9b7a718fd767--- /dev/null+++ b/products/replay_vision/frontend/replay_scanners/watchFeedEmptyState.test.ts@@ -0,0 +1,59 @@+import type { ReplayScannerApi, VisionQuotaApi } from '../generated/api.schemas'+import { type WatchFeedEmptyReason, resolveWatchFeedEmptyReason } from './watchFeedEmptyState'++const scanner = (overrides: Partial<ReplayScannerApi> = {}): ReplayScannerApi =>+ ({ id: 'scanner-1', enabled: true, limit_reached: false, ...overrides }) as unknown as ReplayScannerApi++const quota = (exhausted: boolean): VisionQuotaApi => ({ exhausted }) as unknown as VisionQuotaApi++describe('resolveWatchFeedEmptyReason', () => {+ // The precedence between these is the behavior under test: a reader told to clear their filters+ // while every scanner is off would clear them and still face an empty feed.+ it.each<[string, ReplayScannerApi[], VisionQuotaApi | null, boolean, WatchFeedEmptyReason]>([+ ['no scanners at all', [], quota(false), false, 'no-scanners'],+ [+ 'an exhausted budget, even with every scanner off',+ [scanner({ enabled: false })],+ quota(true),+ false,+ 'quota-exhausted',+ ],+ [+ 'every scanner off',+ [scanner({ enabled: false }), scanner({ id: 'b', enabled: false })],+ quota(false),+ false,+ 'all-disabled',+ ],+ // Guards the empty-array trap: `[].every()` answers true, so the disabled check has to come first.+ ['every scanner off rather than capped', [scanner({ enabled: false })], quota(false), false, 'all-disabled'],+ [+ 'every running scanner capped',+ [scanner({ limit_reached: true }), scanner({ id: 'b', limit_reached: true })],+ quota(false),+ false,+ 'all-capped',+ ],+ [+ 'a block rather than the filters holding it back',+ [scanner({ enabled: false })],+ quota(false),+ true,+ 'all-disabled',+ ],+ ['the filters, once nothing else blocks the feed', [scanner()], quota(false), true, 'filtered'],+ ['a quiet window while the fleet is healthy', [scanner()], quota(false), false, 'quiet-window'],+ // A capped scanner the reader already turned off says nothing about the ones still running.+ [+ 'a quiet window despite a disabled capped scanner',+ [scanner({ enabled: false, limit_reached: true }), scanner({ id: 'b' })],+ quota(false),+ false,+ 'quiet-window',+ ],+ // Falls through rather than claiming a block it cannot see.+ ['a quiet window when the quota snapshot never answered', [scanner()], null, false, 'quiet-window'],+ ])('blames %s', (_name, scanners, quotaValue, hasFeedFilters, expected) => {+ expect(resolveWatchFeedEmptyReason({ scanners, quota: quotaValue, hasFeedFilters })).toBe(expected)+ })+})diff --git a/products/replay_vision/frontend/replay_scanners/watchFeedEmptyState.ts b/products/replay_vision/frontend/replay_scanners/watchFeedEmptyState.tsnew file mode 100644index 000000000000..19e09e02199a--- /dev/null+++ b/products/replay_vision/frontend/replay_scanners/watchFeedEmptyState.ts@@ -0,0 +1,51 @@+import type { ReplayScannerApi, VisionQuotaApi } from '../generated/api.schemas'++/**+ * Why the What to watch feed came back with nothing. Each value is a different answer for the+ * reader, so they get different copy and a different next step.+ */+export type WatchFeedEmptyReason =+ | 'no-scanners'+ | 'quota-exhausted'+ | 'all-disabled'+ | 'all-capped'+ | 'filtered'+ | 'quiet-window'++export interface WatchFeedEmptyInput {+ scanners: ReplayScannerApi[]+ /** Null when the snapshot has not answered, which reads here as "no block seen". */+ quota: VisionQuotaApi | null+ hasFeedFilters: boolean+}++/**+ * Resolves the one reason to show. A block the reader cannot lift from this tab is checked before+ * their own filters, because clearing those would leave the feed just as empty.+ */+export function resolveWatchFeedEmptyReason({+ scanners,+ quota,+ hasFeedFilters,+}: WatchFeedEmptyInput): WatchFeedEmptyReason {+ if (scanners.length === 0) {+ // The scene gate answers this one first, so the feed sees it only when the setup probe+ // failed open. The tab still has to offer the way in.+ return 'no-scanners'+ }+ // An exhausted budget skips the sweeps whatever the scanners say, so it is checked before them.+ if (quota?.exhausted) {+ return 'quota-exhausted'+ }+ const enabledScanners = scanners.filter((scanner) => scanner.enabled)+ if (enabledScanners.length === 0) {+ return 'all-disabled'+ }+ if (enabledScanners.every((scanner) => scanner.limit_reached)) {+ return 'all-capped'+ }+ if (hasFeedFilters) {+ return 'filtered'+ }+ return 'quiet-window'+}diff --git a/products/replay_vision/frontend/replay_scanners/watchFeedLogic.test.ts b/products/replay_vision/frontend/replay_scanners/watchFeedLogic.test.tsindex 2209bf8eb5c6..c6af576ee5c1 100644--- a/products/replay_vision/frontend/replay_scanners/watchFeedLogic.test.ts+++ b/products/replay_vision/frontend/replay_scanners/watchFeedLogic.test.ts@@ -127,6 +127,25 @@ describe('watchFeedLogic', () => {.toFinishAllListeners()})+ it('names the empty reason only once the fleet and budget have answered', async () => {+ feedSpy.mockImplementation(() => [200, { results: [] }])+ useMocks({+ get: {+ '/api/projects/:team/vision/scanners/': () => [+ 200,+ { results: [{ id: 'scanner-a', enabled: false, limit_reached: false }], next: null },+ ],+ '/api/projects/:team/vision/quota/': () => [200, { exhausted: false }],+ },+ })+ logic.mount()+ // A reader with scanners must never be shown the no-scanners screen while the list is in flight.+ expect(logic.values.emptyReason).toBeNull()++ await expectLogic(logic).toDispatchActions(['loadFeedSuccess']).toFinishAllListeners()+ expect(logic.values.emptyReason).toBe('all-disabled')+ })+it('flags a failed load and clears the flag on retry', async () => {feedSpy.mockImplementation(() => [500, { detail: 'nope' }])logic.mount()diff --git a/products/replay_vision/frontend/replay_scanners/watchFeedLogic.ts b/products/replay_vision/frontend/replay_scanners/watchFeedLogic.tsindex 72a052bd7af2..e95ca42195c2 100644--- a/products/replay_vision/frontend/replay_scanners/watchFeedLogic.ts+++ b/products/replay_vision/frontend/replay_scanners/watchFeedLogic.ts@@ -13,16 +13,25 @@ import { urls } from 'scenes/urls'import { tagsModel } from '~/models/tagsModel'import { visionScannersWatchFeedRetrieve } from '../generated/api'+import type { ReplayScannerApi, VisionQuotaApi } from '../generated/api.schemas'import type { VisionScannersWatchFeedRetrieveParams, WatchFeedItemApi } from '../generated/api.schemas'import type { ScannerTypeEnumApi } from '../generated/api.schemas'+import { visionQuotaLogic } from '../logics/visionQuotaLogic'+import { visionScannersListLogic } from '../logics/visionScannersListLogic'import { csvParam, parseCsvParam } from '../utils/urlParams'import { ScannerType } from './types'+import { type WatchFeedEmptyReason, resolveWatchFeedEmptyReason } from './watchFeedEmptyState'// Generated by kea-typegen. Update if you're an agent, ignore if you're human.export interface watchFeedLogicValues {allTags: string[] // tagsModel+ quota: VisionQuotaApi | null // visionQuotaLogic+ quotaLoading: boolean // visionQuotaLogic+ scanners: ReplayScannerApi[] // visionScannersListLogic+ scannersLoading: boolean // visionScannersListLogicdateFrom: stringdateTo: string | null+ emptyReason: WatchFeedEmptyReason | nullfeedFailed: booleanfeedItems: WatchFeedItemApi[] | nullfeedItemsLoading: boolean@@ -99,6 +108,13 @@ export interface watchFeedLogicActions {// Generated by kea-typegen. Update if you're an agent, ignore if you're human.export interface watchFeedLogicMeta {__keaTypeGenInternalSelectorTypes: {+ emptyReason: (+ scanners: ReplayScannerApi[],+ scannersLoading: boolean,+ quota: VisionQuotaApi | null,+ quotaLoading: boolean,+ hasFeedFilters: boolean+ ) => WatchFeedEmptyReason | nullhasFeedFilters: (scannerIdsFilter: string[],tagsFilter: string[],@@ -140,7 +156,16 @@ export const watchFeedLogic = kea<watchFeedLogicType>([path(['products', 'replay_vision', 'frontend', 'replay_scanners', 'watchFeedLogic']),connect(() => ({- values: [tagsModel, ['tags as allTags']],+ values: [+ tagsModel,+ ['tags as allTags'],+ // An empty feed cannot be explained from the feed alone: the reason lives in the fleet's+ // state and the org's budget.+ visionScannersListLogic,+ ['scanners', 'scannersLoading'],+ visionQuotaLogic,+ ['quota', 'quotaLoading'],+ ],actions: [tagsModel, ['loadTags']],})),@@ -297,6 +322,9 @@ export const watchFeedLogic = kea<watchFeedLogicType>([scanner_count: new Set(items.map((item) => item.observation.scanner_id)).size,reason_kind_counts: countByReasonKind,signal_share: items.length > 0 ? (countByReasonKind.signal_emitted ?? 0) / items.length : 0,+ // Which dead end the reader hit, so the empty screens can be counted and ranked+ // against each other instead of only showing up as a clip count of zero.+ ...(items.length === 0 ? { empty_reason: values.emptyReason ?? 'unresolved' } : {}),})},// A card writes `?t=<seconds>` so the player opens at the cited moment; clear it on close so a@@ -313,6 +341,20 @@ export const watchFeedLogic = kea<watchFeedLogicType>([})),selectors({+ /** Null until both probes answer, so an empty screen is never drawn from unresolved data. */+ emptyReason: [+ (s) => [s.scanners, s.scannersLoading, s.quota, s.quotaLoading, s.hasFeedFilters],+ (+ scanners: ReplayScannerApi[],+ scannersLoading: boolean,+ quota: VisionQuotaApi | null,+ quotaLoading: boolean,+ hasFeedFilters: boolean+ ): WatchFeedEmptyReason | null =>+ scannersLoading || quotaLoading+ ? null+ : resolveWatchFeedEmptyReason({ scanners, quota, hasFeedFilters }),+ ],hasFeedFilters: [(s) => [s.scannerIdsFilter, s.tagsFilter, s.scannerTypeFilter, s.search],(scannerIds: string[], tags: string[], scannerType: ScannerType | null, search: string): boolean =>