: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): show the jev arm's feed as search-result rows (#113541)
Kim Svatos Dugan71675f10d4e2
diff --git a/frontend/snapshots.yml b/frontend/snapshots.ymlindex 584bdee65062..69240dd9bce1 100644--- a/frontend/snapshots.yml+++ b/frontend/snapshots.yml@@ -12923,9 +12923,9 @@ snapshots:scenes-app-replay-vision--home-watch-feed-grid--light:hash: v1.k794b7964.eef70399f888f57b020a2ec2df31807c2ab0fab72d763576aa997d792a869677.Q2y0D347yvVcCTX-e9lPPuFzqH1fcfpoXQqwc087OWkscenes-app-replay-vision--home-watch-feed-jev-arm--dark:- hash: v1.k794b7964.66071cad7d045cfc6f6917441c24334edab904c18359c35d69b320e85505daea.kdUmkJTegMT0OcirvHM_rhAxMU5JWGFyVZTynSAUVEY+ hash: v1.k794b7964.68e5ee597c3499f4df7de4dfe3db661e339fa8d2e30ef1c569959d86bd430305.v0bBkJTYcpwECQvdW_vQaJWpcwoVQpVn2Kqav6mrVuYscenes-app-replay-vision--home-watch-feed-jev-arm--light:- hash: v1.k794b7964.dbea43ea662698fdbf68b456001f8e2cbea0b4334942a8fd5e0f7a80c991291b.Q9Wm7aZ-gY8ynsJsSnUF1PnogQHQIXGfPbWrGfG_kEc+ hash: v1.k794b7964.7ac581d7622f7ca2428054e97936ff0e336496cff0ba686d77db329f1a9041ff.qahPVGOLQ8poz4tAePFts3hdloy-GUEIw7z7JVnMQ7Yscenes-app-replay-vision--home-watch-feed-only-newest--dark:hash: v1.k794b7964.4bdb8bb02fdf4e1402f3187ef680ef0bf1081f23689307facdbbe83906c6077f.LfMy-ghDtnRl-yhFxu1Xc7L8o2ZVkHtnzxtov82AuZYscenes-app-replay-vision--home-watch-feed-only-newest--light:diff --git a/products/replay_vision/frontend/replay_scanners/components/WatchFeedCard.test.ts b/products/replay_vision/frontend/replay_scanners/components/WatchFeedCard.test.tsindex acb4c9a01487..52233802f33d 100644--- a/products/replay_vision/frontend/replay_scanners/components/WatchFeedCard.test.ts+++ b/products/replay_vision/frontend/replay_scanners/components/WatchFeedCard.test.ts@@ -1,8 +1,7 @@import type { ReplayObservationApi, WatchFeedReasonApi } from '../../generated/api.schemas'import {- jevCardContext,jevCardSentence,- jevTileText,+ jevRowTitle,observationKeyMomentMs,watchCardHeadline,watchReasonCopy,@@ -193,81 +192,33 @@ describe('WatchFeedCard helpers', () => {})})- describe('jevCardContext', () => {- it('gives the whole derived narration when the notability sentence leads', () => {- const context = jevCardContext(- observation('monitor', { reasoning: 'Retried the form twice. The submit then failed.' }),- {- kind: 'jev_watchable',- jev_probability: 0.9,- notability_reason: 'The card form rejected a valid card three times.',- } as WatchFeedReasonApi- )- expect(context).toBe('Retried the form twice. The submit then failed.')- })-- it('never repeats the lead sentence when the derived headline leads', () => {- const context = jevCardContext(- observation('monitor', { reasoning: 'Retried the form twice. The submit then failed.' }),- { kind: 'jev_watchable', jev_probability: 0.9 } as WatchFeedReasonApi- )- expect(context).toBe('The submit then failed.')- })-- it('gives a filler row no context, so it stays small', () => {- const context = jevCardContext(- observation('monitor', { reasoning: 'Retried the form twice. The submit then failed.' }),- { kind: 'unviewed_recent' } as WatchFeedReasonApi- )- expect(context).toBeNull()- })- })-- describe('jevTileText', () => {- it.each<{- name: string- scannerType: string- output: Record<string, unknown>- reason: WatchFeedReasonApi- expected: ReturnType<typeof jevTileText>- }>([- {- name: "leads with a summarizer's authored title and moves the scan's sentence to the detail",- scannerType: 'summarizer',- output: { title: 'Checkout card rejected', summary: 'Tried the card three times. Left.' },- reason: {- kind: 'jev_watchable',- jev_probability: 0.9,- notability_reason: 'The card form rejected a valid card three times.',- } as WatchFeedReasonApi,- expected: {- title: 'Checkout card rejected',- detail: 'The card form rejected a valid card three times.',- },- },+ describe('jevRowTitle', () => {+ const notable = {+ kind: 'jev_watchable',+ jev_probability: 0.9,+ notability_reason: 'The card form rejected a valid card three times.',+ } as WatchFeedReasonApi+ it.each<{ name: string; scannerType: string; output: Record<string, unknown>; expected: string }>([{- name: 'falls back to the summary for the detail when the scan wrote no sentence',+ name: "leads with a summarizer's authored title over the scan's sentence",scannerType: 'summarizer',output: { title: 'Checkout card rejected', summary: 'Tried the card three times. Left.' },- reason: { kind: 'jev_watchable', jev_probability: 0.9 } as WatchFeedReasonApi,- expected: { title: 'Checkout card rejected', detail: 'Tried the card three times. Left.' },+ expected: 'Checkout card rejected',},{- name: 'gives a filler summarizer tile no detail',+ name: 'falls back to the card sentence for an untitled summarizer',scannerType: 'summarizer',- output: { title: 'Checkout card rejected', summary: 'Tried the card three times. Left.' },- reason: { kind: 'unviewed_recent' } as WatchFeedReasonApi,- expected: { title: 'Checkout card rejected', detail: null },+ output: { title: '', summary: 'Tried the card three times. Left.' },+ expected: 'The card form rejected a valid card three times.',},{- name: 'leads other scan types with the card sentence and reveals the unused narration',+ name: 'leads other scan types with the card sentence',scannerType: 'monitor',output: { reasoning: 'Retried the form twice. The submit then failed.' },- reason: { kind: 'jev_watchable', jev_probability: 0.9 } as WatchFeedReasonApi,- expected: { title: 'Retried the form twice.', detail: 'The submit then failed.' },+ expected: 'The card form rejected a valid card three times.',},- ])('$name', ({ scannerType, output, reason, expected }) => {- expect(jevTileText(observation(scannerType, output), reason)).toEqual(expected)+ ])('$name', ({ scannerType, output, expected }) => {+ expect(jevRowTitle(observation(scannerType, output), notable)).toBe(expected)})})diff --git a/products/replay_vision/frontend/replay_scanners/components/WatchFeedCard.tsx b/products/replay_vision/frontend/replay_scanners/components/WatchFeedCard.tsxindex 9b90b09ceecd..eb5ce8a0d13f 100644--- a/products/replay_vision/frontend/replay_scanners/components/WatchFeedCard.tsx+++ b/products/replay_vision/frontend/replay_scanners/components/WatchFeedCard.tsx@@ -12,12 +12,12 @@ import { urls } from 'scenes/urls'import { CitedText, ObservationResultSummary, readResult } from '../../components/ObservationCard'import { ObservationThumbnail } from '../../components/ObservationThumbnail'-import { ScannerTypeBadge } from '../../components/ScannerTypeBadge'+import { ScannerTypeBadge, scannerTypeIcon } from '../../components/ScannerTypeBadge'import { UnviewedObservationTag } from '../../components/UnviewedObservationTag'import type { ReplayObservationApi, WatchFeedItemApi, WatchFeedReasonApi } from '../../generated/api.schemas'import { OBSERVATION_ORIGIN_PARAM, WATCH_FEED_ORIGIN } from '../../utils/breadcrumbs'import { citedTextToPlainText } from '../../utils/citations'-import { ScannerType } from '../types'+import { SCANNER_TYPE_TAG_TYPE, ScannerType } from '../types'import { type WatchFeedView, watchFeedLogic } from '../watchFeedLogic'const roundScore = (value: number): number => Math.round(value * 100) / 100@@ -459,27 +459,17 @@ export function jevCardSentence(observation: ReplayObservationApi, reason: Watch}/**- * One muted line of context under the sentence: the scan's prose the sentence did not use. A card- * leading with the notability sentence gets the whole derived narration; a card already leading- * with the derived headline gets the prose after it. A filler row gets none, so it stays small.+ * The scanner behind a jev row: a circle in its type's color, then its name. Clicking it narrows the+ * feed to that scanner. The tooltip carries the scanner's question and verdict.*/-export function jevCardContext(observation: ReplayObservationApi, reason: WatchFeedReasonApi): string | null {- if (FILLER_REASON_KINDS.has(reason.kind)) {- return null- }- const headline = watchCardHeadline(observation)- if (reason.notability_reason) {- return [headline?.title, headline?.body?.text].filter(Boolean).join(' ') || null- }- return headline?.body?.text ?? null-}--function JevCardScannerChip({+function JevScannerLink({observation,scannerName,+ scannerType,}: {observation: ReplayObservationApiscannerName: string+ scannerType: ScannerType | undefined}): JSX.Element {const { setScannerIdsFilter } = useActions(watchFeedLogic)const verdict = readResult(observation)?.verdict@@ -494,64 +484,60 @@ function JevCardScannerChip({{typeof verdict === 'string' && verdict ? ` Answered ${verdict}.` : ''}</span>)}- <span className="italic">Click to show only this scanner's clips</span>+ <span className="italic">Click to show only this scanner's sessions</span></div>}>- <LemonTag- className="max-w-60 cursor-pointer"- forceClickable+ <button+ type="button"onClick={() => setScannerIdsFilter([observation.scanner_id])}+ className="relative z-10 flex max-w-full min-w-0 cursor-pointer items-center gap-2 self-start text-sm text-secondary hover:text-default"data-attr="vision-watch-feed-scanner-chip">- <span className="truncate">{scannerName}</span>- </LemonTag>+ {scannerType && (+ <LemonTag+ type={SCANNER_TYPE_TAG_TYPE[scannerType]}+ className="size-6 shrink-0 justify-center !rounded-full !p-0"+ >+ {scannerTypeIcon(scannerType)}+ </LemonTag>+ )}+ <span className="truncate font-medium">{scannerName}</span>+ </button></Tooltip>)}/**- * The title under a jev tile and the detail its poster reveals on hover. A summarizer's authored title- * is already short, so it leads and the scan's sentence moves into the detail. Other scans lead with- * jevCardSentence and reveal the narration it did not use. A filler tile reveals nothing, so it never- * reads like a finding.+ * The title of a jev row. A summarizer's authored title is already short, so it leads. Other scans+ * lead with jevCardSentence.*/-export function jevTileText(- observation: ReplayObservationApi,- reason: WatchFeedReasonApi-): { title: string; detail: string | null } {- const filler = FILLER_REASON_KINDS.has(reason.kind)+export function jevRowTitle(observation: ReplayObservationApi, reason: WatchFeedReasonApi): string {const result = readResult(observation)const scannerType =(observation.scanner_snapshot?.scanner_type as ScannerType | undefined) ??(result?.scanner_type as ScannerType | undefined)- const authoredTitle =- scannerType === 'summarizer' && typeof result?.title === 'string' && result.title ? result.title : null- if (authoredTitle) {- const summary = typeof result?.summary === 'string' ? result.summary : null- return { title: authoredTitle, detail: filler ? null : reason.notability_reason || summary || null }+ if (scannerType === 'summarizer' && typeof result?.title === 'string' && result.title) {+ return result.title}- return { title: jevCardSentence(observation, reason), detail: jevCardContext(observation, reason) }+ return jevCardSentence(observation, reason)}/**- * The jev arm's tile: a large key-moment poster, a short title, and one meta line. The whole tile- * opens the observation page, which starts the player at the key moment.+ * The jev arm's row, laid out like a video search result: a large key-moment poster, then a title,+ * the scanner, and the person and time. The whole row opens the observation page, which starts the+ * player at the key moment.*/-export function JevWatchFeedTile({ item, position }: WatchFeedCardProps): JSX.Element {+export function JevWatchFeedRow({ item, position }: WatchFeedCardProps): JSX.Element {const { observation, reason } = item- const data = useWatchFeedCardData(item, position, 'grid')- const { title, detail } = jevTileText(observation, reason)+ const data = useWatchFeedCardData(item, position, 'list')+ const title = jevRowTitle(observation, reason)const filler = FILLER_REASON_KINDS.has(reason.kind)return (- <article className="group relative flex flex-col gap-2 min-w-0" data-attr="vision-watch-feed-tile">- <div className="relative overflow-hidden rounded-lg border group-hover:border-accent group-focus-within:border-accent">+ <article className="group relative flex min-w-0 gap-4" data-attr="vision-watch-feed-row">+ <div className="relative w-36 shrink-0 self-start overflow-hidden rounded-lg border group-hover:border-accent group-focus-within:border-accent @xl:w-80">{!observation.viewed && <span className="absolute inset-x-0 top-0 z-20 h-1 bg-accent" aria-hidden />}- <ObservationThumbnail observation={observation} className="rounded-none border-0">- <span className="absolute bottom-2 left-2 flex size-7 items-center justify-center rounded-full bg-black/70 text-white">- <IconPlayFilled className="text-sm" aria-hidden />- </span>- </ObservationThumbnail>+ <ObservationThumbnail observation={observation} className="rounded-none border-0" />{!observation.viewed && (<UnviewedObservationTag className="absolute top-2 left-2 z-10 pointer-events-none" />)}@@ -560,28 +546,27 @@ export function JevWatchFeedTile({ item, position }: WatchFeedCardProps): JSX.El{colonDelimitedDuration(Math.floor(data.keyMomentMs / 1000), null)}</span>)}- {detail && (- <p className="pointer-events-none absolute inset-x-0 bottom-0 z-10 m-0 bg-gradient-to-t from-black/85 to-transparent px-3 pt-8 pb-10 text-xs text-white line-clamp-5 opacity-0 transition-opacity group-hover:opacity-100 group-focus-within:opacity-100">- {detail}- </p>- )}</div>- <Link- to={data.observationUrl}- onClick={data.captureObservationOpened}- className="text-default after:absolute after:inset-0 after:content-['']"- data-attr="vision-watch-feed-tile-open"- >- <h3- className={`m-0 text-sm line-clamp-2 ${filler ? 'font-medium text-secondary' : 'font-semibold'}`}- title={title}+ <div className="flex min-w-0 flex-1 flex-col gap-2 pt-0.5">+ <Link+ to={data.observationUrl}+ onClick={data.captureObservationOpened}+ className="text-default after:absolute after:inset-0 after:content-['']"+ data-attr="vision-watch-feed-row-open">- {!observation.viewed && <span className="sr-only">New: </span>}- {title}- </h3>- </Link>- <div className="relative z-10 flex flex-wrap items-center gap-x-2 gap-y-1 min-w-0">- <JevCardScannerChip observation={observation} scannerName={data.scannerName} />+ <h3+ className={`m-0 text-base line-clamp-2 group-hover:text-accent ${filler ? 'font-medium text-secondary' : 'font-semibold'}`}+ title={title}+ >+ {!observation.viewed && <span className="sr-only">New: </span>}+ {title}+ </h3>+ </Link>+ <JevScannerLink+ observation={observation}+ scannerName={data.scannerName}+ scannerType={data.scannerType}+ /><WatchCardPerson observation={observation} person={data.person} /></div></article>diff --git a/products/replay_vision/frontend/replay_scanners/components/WatchFeedTab.tsx b/products/replay_vision/frontend/replay_scanners/components/WatchFeedTab.tsxindex 1253bde43d78..60a067ebc9af 100644--- a/products/replay_vision/frontend/replay_scanners/components/WatchFeedTab.tsx+++ b/products/replay_vision/frontend/replay_scanners/components/WatchFeedTab.tsx@@ -11,7 +11,7 @@ import { FilterPill } from '../../components/FilterPill'import { visionScannersListLogic } from '../../logics/visionScannersListLogic'import { SCANNER_TYPE_OPTIONS, ScannerType } from '../types'import { type WatchFeedView, watchFeedLogic } from '../watchFeedLogic'-import { FILLER_REASON_KINDS, JevWatchFeedTile, WatchFeedCard, WatchFeedGridCard } from './WatchFeedCard'+import { FILLER_REASON_KINDS, JevWatchFeedRow, WatchFeedCard, WatchFeedGridCard } from './WatchFeedCard'import { WatchFeedEmptyState } from './WatchFeedEmptyState'const TYPE_OPTIONS: { value: ScannerType; label: string }[] = SCANNER_TYPE_OPTIONS.map(({ value, label }) => ({@@ -97,15 +97,19 @@ export function WatchFeedTab(): JSX.Element {// Every card carrying a no-evidence reason means the window produced no findings. A feed that mixes a// finding with padding needs no explaining, so this stays off unless the whole feed is padding.const onlyFiller = items.length > 0 && items.every((item) => FILLER_REASON_KINDS.has(item.reason.kind))- // The jev arm gets its own tile, so the experiment compares rankings and layouts as one arm.- const GridCard = feedRanker === 'jev' ? JevWatchFeedTile : WatchFeedGridCard+ // The jev arm gets its own row, so the experiment compares rankings and layouts as one arm.+ const ListCard = feedRanker === 'jev' ? JevWatchFeedRow : WatchFeedCardreturn (<div className="@container flex flex-col gap-4"><div className="flex flex-wrap items-end justify-between gap-2"><div className="flex flex-col gap-1"><h2 className="text-xl font-semibold m-0">- {items.length > 0 ? pluralize(items.length, 'clip') : 'What to watch'}+ {items.length === 0+ ? 'What to watch'+ : feedRanker === 'jev'+ ? `Top ${pluralize(items.length, 'session')}`+ : pluralize(items.length, 'clip')}</h2><p className="text-muted text-sm m-0">{narrowedToScanners > 0@@ -216,12 +220,12 @@ export function WatchFeedTab(): JSX.Element {displayView === 'grid' ? (<div className={GRID_CLASS_NAME}>{items.map((item, index) => (- <GridCard key={item.observation.id} item={item} position={index} />+ <WatchFeedGridCard key={item.observation.id} item={item} position={index} />))}</div>) : (items.map((item, index) => (- <WatchFeedCard key={item.observation.id} item={item} position={index} />+ <ListCard key={item.observation.id} item={item} position={index} />)))) : feedFailed ? null : emptyReason ? (diff --git a/products/replay_vision/frontend/replay_scanners/watchFeedLogic.test.ts b/products/replay_vision/frontend/replay_scanners/watchFeedLogic.test.tsindex 7956dace179f..78724cc32063 100644--- a/products/replay_vision/frontend/replay_scanners/watchFeedLogic.test.ts+++ b/products/replay_vision/frontend/replay_scanners/watchFeedLogic.test.ts@@ -52,11 +52,8 @@ describe('watchFeedLogic', () => {.toFinishAllListeners()const lastUrl = new URL(feedSpy.mock.calls.at(-1)[0].request.url)expect(lastUrl.searchParams.get('scanner_type')).toBe('monitor')- // The response names the ranker, which picks the card layout. The jev arm's tiles only come as a- // grid, so a saved list choice is ignored.+ // The response names the ranker, which picks the card layout.expect(logic.values.feedRanker).toBe('jev')- expect(logic.values.view).toBe('list')- expect(logic.values.displayView).toBe('grid')await expectLogic(logic, () => {logic.actions.setDateRange('-30d', null)@@ -142,8 +139,11 @@ describe('watchFeedLogic', () => {await expectLogic(logic, () => {logic.actions.clearFeedFilters()})- .toMatchValues({ view: 'grid' })+ .toMatchValues({ view: 'grid', displayView: 'grid' }).toFinishAllListeners()+ // The jev arm's rows only come as a list, so it ignores the saved grid choice.+ logic.actions.setFeedRanker('jev')+ expect(logic.values.displayView).toBe('list')})it('names the empty reason only once the fleet and budget have answered', async () => {diff --git a/products/replay_vision/frontend/replay_scanners/watchFeedLogic.ts b/products/replay_vision/frontend/replay_scanners/watchFeedLogic.tsindex 9cef3a450c68..9a98ca8a6135 100644--- a/products/replay_vision/frontend/replay_scanners/watchFeedLogic.ts+++ b/products/replay_vision/frontend/replay_scanners/watchFeedLogic.ts@@ -381,10 +381,10 @@ export const watchFeedLogic = kea<watchFeedLogicType>([})),selectors({- // The jev arm's tiles only come as a grid, so its view toggle is hidden and the saved choice is ignored.+ // The jev arm's rows only come as a list, so its view toggle is hidden and the saved choice is ignored.displayView: [(s) => [s.view, s.feedRanker],- (view: WatchFeedView, feedRanker: WatchFeedRanker): WatchFeedView => (feedRanker === 'jev' ? 'grid' : view),+ (view: WatchFeedView, feedRanker: WatchFeedRanker): WatchFeedView => (feedRanker === 'jev' ? 'list' : view),],/** Null until both probes answer, so an empty screen is never drawn from unresolved data. */emptyReason: [