: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): show scans that left no result below the player (#87389)
Kim Svatos Dugancfc076d79f67
diff --git a/products/replay_vision/frontend/components/ObservationsDock.tsx b/products/replay_vision/frontend/components/ObservationsDock.tsxindex bf19af478911..7a002e56de65 100644--- a/products/replay_vision/frontend/components/ObservationsDock.tsx+++ b/products/replay_vision/frontend/components/ObservationsDock.tsx@@ -17,7 +17,7 @@ import type { ReplayScannerApi } from '../generated/api.schemas'import { observationsDockLogic } from '../logics/observationsDockLogic'import { visionQuotaLogic } from '../logics/visionQuotaLogic'import { getReplayVisionEditDisabledReason } from '../utils/accessControl'-import { isSummaryObservation } from '../utils/observation'+import { dockObservations, isUnsuccessfulScan } from '../utils/observation'import { quotaUx } from '../utils/quotaProjection'import { VisionDocsLink, visionDocsUrl } from './DocsLink'import { ObservationDockCard } from './ObservationCard'@@ -191,9 +191,11 @@ function ObservationsDockContent({ sessionId }: { sessionId: string }): JSX.Elem}const { desiredSize, isResizeInProgress } = useValues(resizerLogic(resizerProps))- // Scanner observations live in the sidebar's Observations tab; the dock only surfaces summaries- const summaries = observations.filter(isSummaryObservation)- const hasContent = summaries.length > 0 || observationsLoading+ const shown = dockObservations(observations)+ // Collapsed, the dock is one bar with a caret, so a scan that left no result would sit behind it+ // unseen. The count says there is something to open for; the card inside says which scan and why.+ const unsuccessfulCount = shown.filter(isUnsuccessfulScan).length+ const hasContent = shown.length > 0 || observationsLoadingconst expandedHeight = Math.max(MIN_EXPANDED_HEIGHT,Math.min(MAX_EXPANDED_HEIGHT, desiredSize ?? DEFAULT_EXPANDED_HEIGHT)@@ -213,27 +215,33 @@ function ObservationsDockContent({ sessionId }: { sessionId: string }): JSX.Elem<SummarizeButton sessionId={sessionId} /><SummarizeExplainer />{hasContent && (- <LemonButton- className="ml-auto"- size="small"- icon={<IconChevronDown className={dockOpen ? 'rotate-180' : ''} />}- onClick={() => setDockOpen(!dockOpen)}- tooltip={dockOpen ? 'Collapse' : 'Expand'}- aria-label={dockOpen ? 'Collapse summary' : 'Expand summary'}- data-attr="vision-dock-toggle"- // This click also sets the auto-expand preference, so which way it went is the- // signal for whether people keep summaries open by default.- data-ph-capture-attribute-dock-action={dockOpen ? 'collapse' : 'expand'}- />+ <div className="ml-auto flex items-center gap-2 min-w-0">+ {!dockOpen && unsuccessfulCount > 0 && (+ <span className="text-muted text-xs truncate" data-attr="vision-dock-no-result-count">+ No result from {unsuccessfulCount} {unsuccessfulCount === 1 ? 'scan' : 'scans'}+ </span>+ )}+ <LemonButton+ size="small"+ icon={<IconChevronDown className={dockOpen ? 'rotate-180' : ''} />}+ onClick={() => setDockOpen(!dockOpen)}+ tooltip={dockOpen ? 'Collapse' : 'Expand'}+ aria-label={dockOpen ? 'Collapse summary' : 'Expand summary'}+ data-attr="vision-dock-toggle"+ // This click also sets the auto-expand preference, so which way it went is+ // the signal for whether people keep summaries open by default.+ data-ph-capture-attribute-dock-action={dockOpen ? 'collapse' : 'expand'}+ />+ </div>)}</div>{dockOpen && (<div className="flex-1 overflow-y-auto px-3 pb-3 space-y-2">- {observationsLoading && summaries.length === 0 ? (+ {observationsLoading && shown.length === 0 ? (<div className="flex items-center gap-2 text-muted py-4"><Spinner /> Loading summaries…</div>- ) : summaries.length === 0 ? (+ ) : shown.length === 0 ? (<div className="text-muted text-sm py-4">No summary yet. Summarize this recording to generate one.{' '}<VisionDocsLink page="observations" dataAttr="vision-empty-docs-link-dock">@@ -241,7 +249,7 @@ function ObservationsDockContent({ sessionId }: { sessionId: string }): JSX.Elem</VisionDocsLink></div>) : (- summaries.map((observation) => (+ shown.map((observation) => (<ObservationDockCardkey={observation.id}observation={observation}diff --git a/products/replay_vision/frontend/logics/observationsDockLogic.ts b/products/replay_vision/frontend/logics/observationsDockLogic.tsindex 6881735b26f3..ab89e9e0af97 100644--- a/products/replay_vision/frontend/logics/observationsDockLogic.ts+++ b/products/replay_vision/frontend/logics/observationsDockLogic.ts@@ -2,6 +2,7 @@ import { MakeLogicType, actions, afterMount, connect, kea, key, listeners, path,import { ApiError } from 'lib/api-error'import { lemonToast } from 'lib/lemon-ui/LemonToast'+import type { ToastButton } from 'lib/lemon-ui/LemonToast/LemonToast'import { metricCount } from 'lib/operationalMetrics'import { teamLogic } from 'scenes/teamLogic'@@ -333,7 +334,13 @@ export const observationsDockLogic = kea<observationsDockLogicType>([// is in hand before naming it, and leave a way to re-read when it stays hidden.actions.summarizeFailure()actions.setDockOpen(true)- const tryAgain = { label: 'Try again', action: () => actions.loadObservations() }+ // Both retries re-read the same rows, but they follow different failures: a row the+ // reload could not see, and a reload that did not complete. Keep them apart.+ const tryAgain = (dataAttr: string): ToastButton => ({+ label: 'Try again',+ action: () => actions.loadObservations(),+ dataAttr,+ })try {const reloaded = await visionObservationsList(String(teamId), {session_id: props.sessionId,@@ -347,13 +354,15 @@ export const observationsDockLogic = kea<observationsDockLogicType>([} else {lemonToast.warning('This recording was already summarized, but the result is not available here.',- { button: tryAgain }+ { button: tryAgain('vision-summary-hidden-retry') })}} catch {metricCount('replay_vision_frontend_observations_load_failures')actions.loadObservationsFailure()- lemonToast.warning("Couldn't load this recording's summary.", { button: tryAgain })+ lemonToast.warning("Couldn't load this recording's summary.", {+ button: tryAgain('vision-summary-reload-retry'),+ })}return}diff --git a/products/replay_vision/frontend/utils/observation.test.ts b/products/replay_vision/frontend/utils/observation.test.tsindex 6103c5a73fa2..3173759b6caa 100644--- a/products/replay_vision/frontend/utils/observation.test.ts+++ b/products/replay_vision/frontend/utils/observation.test.ts@@ -1,5 +1,10 @@import type { ReplayObservationApi } from '../generated/api.schemas'-import { ObservationSeekbarMark, observationClipboardText, observationSeekbarMarks } from './observation'+import {+ ObservationSeekbarMark,+ dockObservations,+ observationClipboardText,+ observationSeekbarMarks,+} from './observation'const summarizerEntry = { scannerName: 'Session summarizer', headline: null, snippet: 'Rage clicked pay' }const longSentence = 'x'.repeat(200)@@ -150,4 +155,31 @@ describe('observation utils', () => {expect(observationSeekbarMarks(observations)).toEqual(expected)})})++ describe('dockObservations', () => {+ const obs = (+ id: string,+ scannerType: string,+ status: ReplayObservationApi['status']+ ): ReplayObservationApi => ({ ...makeObservation(scannerType, null, status), id })++ // The dock is the only vision surface under the player, and a scan that settled without a+ // result is exactly what a person needs it for: nothing else there says why none arrived.+ // Succeeded scanner runs stay in the sidebar, so the dock does not restate what it already has.+ it.each<[string, ReplayObservationApi[], string[]]>([+ ['a summary is shown', [obs('s1', 'summarizer', 'succeeded')], ['s1']],+ ['a failed summary is shown once, not twice', [obs('s1', 'summarizer', 'failed')], ['s1']],+ ['a failed scanner is shown', [obs('m1', 'monitor', 'failed')], ['m1']],+ ['an ineligible scanner is shown', [obs('m1', 'monitor', 'ineligible')], ['m1']],+ ['a succeeded scanner stays in the sidebar', [obs('m1', 'monitor', 'succeeded')], []],+ ['a running scanner stays in the sidebar', [obs('m1', 'monitor', 'running')], []],+ [+ 'summaries come before scans that left no result',+ [obs('m1', 'monitor', 'failed'), obs('s1', 'summarizer', 'succeeded')],+ ['s1', 'm1'],+ ],+ ])('%s', (_, observations, expectedIds) => {+ expect(dockObservations(observations).map((o) => o.id)).toEqual(expectedIds)+ })+ })})diff --git a/products/replay_vision/frontend/utils/observation.ts b/products/replay_vision/frontend/utils/observation.tsindex 0b96f4b0b582..d8ba9df1d78c 100644--- a/products/replay_vision/frontend/utils/observation.ts+++ b/products/replay_vision/frontend/utils/observation.ts@@ -30,11 +30,32 @@ export function readReasoning(obs: ReplayObservationApi): string | null {return typeof raw === 'string' && raw ? raw : null}-/** The dock shows summaries only; observations from the team's own scanners live in the sidebar tab. */+/** Summarizer output, which is the dock's primary content. */export function isSummaryObservation(obs: ReplayObservationApi): boolean {return obs.scanner_snapshot?.scanner_type === 'summarizer'}+/** A scan that settled without a result: the scanner failed, or the recording did not qualify. */+export function isUnsuccessfulScan(obs: ReplayObservationApi): boolean {+ return obs.status === 'failed' || obs.status === 'ineligible'+}++/**+ * What the dock shows below the player: every summary, plus any other scanner that left no result.+ *+ * A succeeded scanner observation stays in the sidebar tab, which is where the team reads its own+ * scanners. One that failed or was ineligible is different: nothing below the player would otherwise+ * say why no result arrived, so the run is only discoverable by opening the sidebar and looking.+ */+export function dockObservations(observations: ReplayObservationApi[]): ReplayObservationApi[] {+ // A summarizer that failed is already carried by the first filter, so the second skips summaries+ // rather than listing them twice.+ return [+ ...observations.filter(isSummaryObservation),+ ...observations.filter((obs) => !isSummaryObservation(obs) && isUnsuccessfulScan(obs)),+ ]+}+/** Summarizer output: the one-line headline. */export function readTitle(obs: ReplayObservationApi): string | null {const raw = readModelOutput(obs)?.title