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(replay-vision): show the jev arm's feed as key-moment tiles (#112649)

Kim Svatos Dugan10b13e4d72fc
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index 466236cd56d5..6bc5e43d6013 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -12767,9 +12767,9 @@ snapshots:
scenes-app-replay-vision--home-watch-feed-grid--light:
hash: v1.k794b7964.eef70399f888f57b020a2ec2df31807c2ab0fab72d763576aa997d792a869677.Q2y0D347yvVcCTX-e9lPPuFzqH1fcfpoXQqwc087OWk
scenes-app-replay-vision--home-watch-feed-jev-arm--dark:
- hash: v1.k794b7964.14c105726bec9b14859f5c22e60a198ffcd45ebb6964396ff29e58a7d28e8a9b._tnsXoKaklpg5mu-_pYlJ7jP4ZgvBVQ8Br26aMTTVno
+ hash: v1.k794b7964.66071cad7d045cfc6f6917441c24334edab904c18359c35d69b320e85505daea.kdUmkJTegMT0OcirvHM_rhAxMU5JWGFyVZTynSAUVEY
scenes-app-replay-vision--home-watch-feed-jev-arm--light:
- hash: v1.k794b7964.8fbaeb68c75802f8f94d64de988648eb7bb5bc5da5a0b65556682153bcd951be.Vxqw0lp7Muoy-ftkGrEUVvcHyRKLg_tJ5GzaWzu1kQ4
+ hash: v1.k794b7964.dbea43ea662698fdbf68b456001f8e2cbea0b4334942a8fd5e0f7a80c991291b.Q9Wm7aZ-gY8ynsJsSnUF1PnogQHQIXGfPbWrGfG_kEc
scenes-app-replay-vision--home-watch-feed-only-newest--dark:
hash: v1.k794b7964.4bdb8bb02fdf4e1402f3187ef680ef0bf1081f23689307facdbbe83906c6077f.LfMy-ghDtnRl-yhFxu1Xc7L8o2ZVkHtnzxtov82AuZY
scenes-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.ts
index 581b17ad610f..acb4c9a01487 100644
--- a/products/replay_vision/frontend/replay_scanners/components/WatchFeedCard.test.ts
+++ b/products/replay_vision/frontend/replay_scanners/components/WatchFeedCard.test.ts
@@ -2,6 +2,7 @@ import type { ReplayObservationApi, WatchFeedReasonApi } from '../../generated/a
import {
jevCardContext,
jevCardSentence,
+ jevTileText,
observationKeyMomentMs,
watchCardHeadline,
watchReasonCopy,
@@ -222,6 +223,54 @@ describe('WatchFeedCard helpers', () => {
})
})
+ 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.',
+ },
+ },
+ {
+ name: 'falls back to the summary for the detail when the scan wrote no 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.' },
+ },
+ {
+ name: 'gives a filler summarizer tile no detail',
+ 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 },
+ },
+ {
+ name: 'leads other scan types with the card sentence and reveals the unused narration',
+ 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.' },
+ },
+ ])('$name', ({ scannerType, output, reason, expected }) => {
+ expect(jevTileText(observation(scannerType, output), reason)).toEqual(expected)
+ })
+ })
+
describe('watchCardHeadline', () => {
it.each<{
name: string
diff --git a/products/replay_vision/frontend/replay_scanners/components/WatchFeedCard.tsx b/products/replay_vision/frontend/replay_scanners/components/WatchFeedCard.tsx
index b5ecfe1f6f7e..9b90b09ceecd 100644
--- a/products/replay_vision/frontend/replay_scanners/components/WatchFeedCard.tsx
+++ b/products/replay_vision/frontend/replay_scanners/components/WatchFeedCard.tsx
@@ -510,98 +510,81 @@ function JevCardScannerChip({
)
}
-/** The jev arm's card body: one sentence plus one meta line. The scanner's question, verdict, and
- * remaining prose sit behind the chip's tooltip and the observation page, so the feed stays scannable. */
-function JevCardBody({ item, data }: { item: WatchFeedItemApi; data: WatchFeedCardData }): JSX.Element {
+/**
+ * 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.
+ */
+export function jevTileText(
+ observation: ReplayObservationApi,
+ reason: WatchFeedReasonApi
+): { title: string; detail: string | null } {
+ const filler = FILLER_REASON_KINDS.has(reason.kind)
+ 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 }
+ }
+ return { title: jevCardSentence(observation, reason), detail: jevCardContext(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.
+ */
+export function JevWatchFeedTile({ item, position }: WatchFeedCardProps): JSX.Element {
const { observation, reason } = item
- // A filler row carries no finding, so it must not read like one.
+ const data = useWatchFeedCardData(item, position, 'grid')
+ const { title, detail } = jevTileText(observation, reason)
const filler = FILLER_REASON_KINDS.has(reason.kind)
- const context = jevCardContext(observation, reason)
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">
+ {!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>
+ {!observation.viewed && (
+ <UnviewedObservationTag className="absolute top-2 left-2 z-10 pointer-events-none" />
+ )}
+ {data.keyMomentMs !== null && (
+ <span className="absolute bottom-2 right-2 z-10 rounded bg-black/70 px-1.5 text-xs tabular-nums text-white">
+ {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-card-body"
+ data-attr="vision-watch-feed-tile-open"
>
- <h3 className={`text-sm m-0 line-clamp-2 ${filler ? 'font-medium text-secondary' : 'font-semibold'}`}>
+ <h3
+ className={`m-0 text-sm line-clamp-2 ${filler ? 'font-medium text-secondary' : 'font-semibold'}`}
+ title={title}
+ >
{!observation.viewed && <span className="sr-only">New: </span>}
- {jevCardSentence(observation, reason)}
+ {title}
</h3>
</Link>
- {context && <p className="text-muted text-xs m-0 line-clamp-1">{context}</p>}
<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} />
<WatchCardPerson observation={observation} person={data.person} />
</div>
- </>
- )
-}
-
-/** The jev arm's list card. Same shell and affordances as WatchFeedCard, with the body cut to
- * JevCardBody's three lines and the poster sized down so the card hugs its content. */
-export function JevWatchFeedCard({ item, position }: WatchFeedCardProps): JSX.Element {
- const { observation } = item
- const data = useWatchFeedCardData(item, position, 'list')
- return (
- <div
- className="@container relative border rounded bg-bg-light p-3 flex gap-3 hover:border-accent"
- data-attr="vision-watch-feed-card"
- >
- {!observation.viewed && <span className="absolute inset-y-0 left-0 w-1 rounded-l bg-accent" aria-hidden />}
- <div className="relative hidden @md:block w-44 shrink-0 self-start">
- <WatchClipPoster
- observation={observation}
- keyMomentMs={data.keyMomentMs}
- onWatch={data.watchClipInModal}
- />
- {!observation.viewed && (
- <UnviewedObservationTag className="absolute top-1 left-1 z-10 pointer-events-none" />
- )}
- </div>
- <div className="flex-1 min-w-0 flex flex-col justify-center gap-1.5">
- <JevCardBody item={item} data={data} />
- <LemonButton
- type="secondary"
- size="xsmall"
- icon={<IconPlay />}
- onClick={data.watchClipInModal}
- className="@md:hidden self-start relative z-10"
- data-attr="vision-watch-clip"
- >
- Watch clip
- </LemonButton>
- </div>
- </div>
- )
-}
-
-/** The jev arm's grid card: the same shell as WatchFeedGridCard with the body cut to two lines. */
-export function JevWatchFeedGridCard({ item, position }: WatchFeedCardProps): JSX.Element {
- const { observation } = item
- const data = useWatchFeedCardData(item, position, 'grid')
- return (
- <LemonCard
- className="relative flex flex-col rounded-lg p-0 overflow-hidden hover:border-accent"
- data-attr="vision-watch-feed-grid-card"
- >
- {!observation.viewed && <span className="absolute inset-x-0 top-0 h-1 z-20 bg-accent" aria-hidden />}
- <div className="relative">
- <WatchClipPoster
- observation={observation}
- keyMomentMs={data.keyMomentMs}
- onWatch={data.watchClipInModal}
- className="rounded-none border-0"
- />
- {!observation.viewed && (
- <UnviewedObservationTag className="absolute top-2 left-2 z-10 pointer-events-none" />
- )}
- </div>
- <div className="flex flex-col gap-2 p-3 min-w-0 flex-1">
- <JevCardBody item={item} data={data} />
- </div>
- </LemonCard>
+ </article>
)
}
diff --git a/products/replay_vision/frontend/replay_scanners/components/WatchFeedTab.tsx b/products/replay_vision/frontend/replay_scanners/components/WatchFeedTab.tsx
index 3246c5f8ca23..1253bde43d78 100644
--- a/products/replay_vision/frontend/replay_scanners/components/WatchFeedTab.tsx
+++ b/products/replay_vision/frontend/replay_scanners/components/WatchFeedTab.tsx
@@ -11,13 +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,
- JevWatchFeedCard,
- JevWatchFeedGridCard,
- WatchFeedCard,
- WatchFeedGridCard,
-} from './WatchFeedCard'
+import { FILLER_REASON_KINDS, JevWatchFeedTile, WatchFeedCard, WatchFeedGridCard } from './WatchFeedCard'
import { WatchFeedEmptyState } from './WatchFeedEmptyState'
const TYPE_OPTIONS: { value: ScannerType; label: string }[] = SCANNER_TYPE_OPTIONS.map(({ value, label }) => ({
@@ -77,6 +71,7 @@ export function WatchFeedTab(): JSX.Element {
hasFeedFilters,
emptyReason,
view,
+ displayView,
feedRanker,
} = useValues(watchFeedLogic)
const {
@@ -102,9 +97,8 @@ 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 the simplified card, so the experiment compares rankings and layouts as one arm.
- const ListCard = feedRanker === 'jev' ? JevWatchFeedCard : WatchFeedCard
- const GridCard = feedRanker === 'jev' ? JevWatchFeedGridCard : WatchFeedGridCard
+ // The jev arm gets its own tile, so the experiment compares rankings and layouts as one arm.
+ const GridCard = feedRanker === 'jev' ? JevWatchFeedTile : WatchFeedGridCard
return (
<div className="@container flex flex-col gap-4">
@@ -168,30 +162,32 @@ export function WatchFeedTab(): JSX.Element {
Clear filters
</LemonButton>
)}
- <LemonSegmentedButton<WatchFeedView>
- size="xsmall"
- value={view}
- onChange={setView}
- options={[
- {
- value: 'grid',
- icon: <IconGridMasonry />,
- tooltip: 'Thumbnails',
- 'data-attr': 'vision-watch-feed-view-grid',
- },
- {
- value: 'list',
- icon: <IconList />,
- tooltip: 'List',
- 'data-attr': 'vision-watch-feed-view-list',
- },
- ]}
- />
+ {feedRanker !== 'jev' && (
+ <LemonSegmentedButton<WatchFeedView>
+ size="xsmall"
+ value={view}
+ onChange={setView}
+ options={[
+ {
+ value: 'grid',
+ icon: <IconGridMasonry />,
+ tooltip: 'Thumbnails',
+ 'data-attr': 'vision-watch-feed-view-grid',
+ },
+ {
+ value: 'list',
+ icon: <IconList />,
+ tooltip: 'List',
+ 'data-attr': 'vision-watch-feed-view-list',
+ },
+ ]}
+ />
+ )}
</div>
</div>
{feedItemsLoading && feedItems === null ? (
- <FeedSkeleton view={view} />
+ <FeedSkeleton view={displayView} />
) : (
<div className="flex flex-col gap-3">
{/* kea-loaders keeps the last value on failure, so a later filter or date change can fail
@@ -217,7 +213,7 @@ export function WatchFeedTab(): JSX.Element {
</p>
)}
{items.length > 0 ? (
- view === 'grid' ? (
+ displayView === 'grid' ? (
<div className={GRID_CLASS_NAME}>
{items.map((item, index) => (
<GridCard key={item.observation.id} item={item} position={index} />
@@ -225,7 +221,7 @@ export function WatchFeedTab(): JSX.Element {
</div>
) : (
items.map((item, index) => (
- <ListCard key={item.observation.id} item={item} position={index} />
+ <WatchFeedCard 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.ts
index 0d672d6cfbbc..7956dace179f 100644
--- a/products/replay_vision/frontend/replay_scanners/watchFeedLogic.test.ts
+++ b/products/replay_vision/frontend/replay_scanners/watchFeedLogic.test.ts
@@ -52,8 +52,11 @@ 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 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.
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)
diff --git a/products/replay_vision/frontend/replay_scanners/watchFeedLogic.ts b/products/replay_vision/frontend/replay_scanners/watchFeedLogic.ts
index f7b1df79c2c1..9cef3a450c68 100644
--- a/products/replay_vision/frontend/replay_scanners/watchFeedLogic.ts
+++ b/products/replay_vision/frontend/replay_scanners/watchFeedLogic.ts
@@ -32,6 +32,7 @@ export interface watchFeedLogicValues {
scannersLoading: boolean // visionScannersListLogic
dateFrom: string
dateTo: string | null
+ displayView: WatchFeedView
emptyReason: WatchFeedEmptyReason | null
feedFailed: boolean
feedItems: WatchFeedItemApi[] | null
@@ -117,6 +118,7 @@ export interface watchFeedLogicActions {
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface watchFeedLogicMeta {
__keaTypeGenInternalSelectorTypes: {
+ displayView: (view: WatchFeedView, feedRanker: RankerEnumApi) => WatchFeedView
emptyReason: (
scanners: ReplayScannerApi[],
scannersLoading: boolean,
@@ -358,7 +360,7 @@ export const watchFeedLogic = kea<watchFeedLogicType>([
scanner_count: new Set(items.map((item) => item.observation.scanner_id)).size,
reason_kind_counts: countByReasonKind,
ranker: values.feedRanker,
- view: values.view,
+ view: values.displayView,
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.
@@ -379,6 +381,11 @@ 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.
+ displayView: [
+ (s) => [s.view, s.feedRanker],
+ (view: WatchFeedView, feedRanker: WatchFeedRanker): WatchFeedView => (feedRanker === 'jev' ? 'grid' : view),
+ ],
/** 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],