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): expand summarizer overview (#74881)

Arno Hillenb51a7af987b1
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index 2523fb551d87..b4a5f40b0985 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -6902,6 +6902,10 @@ snapshots:
hash: v1.k794b7964.ea15abb4e5defc4511ffbcadca20f2d5568c2d272c112bd08588728fce9325a7.FAVbx6yFt4se4F6rADOjwkqV8yP4ooVPshzDQwh62UY
scenes-app-replay-vision--scanners-list--light:
hash: v1.k794b7964.99f5f4499dca089b44d7bce7dee60424c7bdeefb860a8882d5ca8cbf06abce69.MHJZLg5-Q8USBaHeY-N_hqBMtEfuRArXAsAgnwEk4gs
+ scenes-app-replay-vision--summarizer-overview--dark:
+ hash: v1.k794b7964.c801b1da1f1c38a3e6560c462008a090ecb86373896e7974c4996c07b9bcef0d.G0L7uSVxm7HgUbRrYPlfWLNTq4K1uLVER89MMY9yQj0
+ scenes-app-replay-vision--summarizer-overview--light:
+ hash: v1.k794b7964.6c3926b9189f1b772238b9fcdcb356c659f069faea561727fc50bf9aae40c620.umdwMDJ9PO4HQvOsDy5ry_XAuke9swpQAjZVowYt8tQ
scenes-app-saved-insights--empty-state--dark:
hash: v1.k794b7964.43545664c9133c8afd354be6a6ed8f808c35b381101325d9605114632fcdc0c9.l8w9uEOEmrH6Xl1kNd9ueRtg_51cJUSjWLdjWDM0Fko
scenes-app-saved-insights--empty-state--light:
diff --git a/products/replay_vision/backend/api/observation_stats.py b/products/replay_vision/backend/api/observation_stats.py
index 5f6c57c09a79..24a17107eab6 100644
--- a/products/replay_vision/backend/api/observation_stats.py
+++ b/products/replay_vision/backend/api/observation_stats.py
@@ -262,18 +262,19 @@ def _rank_counts(counts: dict[str, int], key: str = "tag") -> list[dict[str, Any
def _summarizer_stats(queryset: QuerySet[ReplayObservation]) -> dict[str, Any]:
succeeded = queryset.filter(status=ObservationStatus.SUCCEEDED).order_by()
- inner_sql, inner_params = succeeded.values("scanner_result").query.sql_with_params()
+ inner_sql, inner_params = succeeded.values("id", "scanner_result").query.sql_with_params()
+ # Stored facet arrays may repeat a term, so rank by distinct observations rather than array elements.
with connection.cursor() as cursor:
cursor.execute(
f"""
WITH succeeded AS ({inner_sql})
- SELECT 'friction' AS bucket, term, COUNT(*) AS c
+ SELECT 'friction' AS bucket, term, COUNT(DISTINCT s.id) AS c
FROM succeeded s, jsonb_array_elements_text(
COALESCE(s.scanner_result -> 'model_output' -> 'friction_points', '[]'::jsonb)
) AS term
GROUP BY term
UNION ALL
- SELECT 'keyword' AS bucket, term, COUNT(*) AS c
+ SELECT 'keyword' AS bucket, term, COUNT(DISTINCT s.id) AS c
FROM succeeded s, jsonb_array_elements_text(
COALESCE(s.scanner_result -> 'model_output' -> 'keywords', '[]'::jsonb)
) AS term
@@ -282,6 +283,9 @@ def _summarizer_stats(queryset: QuerySet[ReplayObservation]) -> dict[str, Any]:
SELECT 'total' AS bucket, NULL AS term, COUNT(*) AS c FROM succeeded s
WHERE COALESCE(jsonb_array_length(s.scanner_result -> 'model_output' -> 'friction_points'), 0) > 0
OR COALESCE(jsonb_array_length(s.scanner_result -> 'model_output' -> 'keywords'), 0) > 0
+ UNION ALL
+ SELECT 'friction_total' AS bucket, NULL AS term, COUNT(*) AS c FROM succeeded s
+ WHERE COALESCE(jsonb_array_length(s.scanner_result -> 'model_output' -> 'friction_points'), 0) > 0
""",
inner_params,
)
@@ -290,9 +294,12 @@ def _summarizer_stats(queryset: QuerySet[ReplayObservation]) -> dict[str, Any]:
friction_counts: dict[str, int] = {}
keyword_counts: dict[str, int] = {}
total_with_facets = 0
+ total_with_friction = 0
for bucket, term, count in rows:
if bucket == "total":
total_with_facets = count
+ elif bucket == "friction_total":
+ total_with_friction = count
elif term is not None:
target = friction_counts if bucket == "friction" else keyword_counts
target[term] = target.get(term, 0) + count
@@ -301,6 +308,7 @@ def _summarizer_stats(queryset: QuerySet[ReplayObservation]) -> dict[str, Any]:
"friction_ranked": _rank_counts(friction_counts, key="term"),
"keyword_ranked": _rank_counts(keyword_counts, key="term"),
"total_with_facets": total_with_facets,
+ "total_with_friction": total_with_friction,
}
diff --git a/products/replay_vision/backend/api/observations.py b/products/replay_vision/backend/api/observations.py
index a0103524034f..cdf03938a223 100644
--- a/products/replay_vision/backend/api/observations.py
+++ b/products/replay_vision/backend/api/observations.py
@@ -286,6 +286,9 @@ class SummarizerStatsSerializer(serializers.Serializer):
total_with_facets = serializers.IntegerField(
help_text="Succeeded observations that emitted at least one friction point or keyword."
)
+ total_with_friction = serializers.IntegerField(
+ help_text="Succeeded observations that reported at least one friction point."
+ )
class ScorerSummarySerializer(serializers.Serializer):
diff --git a/products/replay_vision/backend/temporal/scanners/summarizer.py b/products/replay_vision/backend/temporal/scanners/summarizer.py
index ac1a7be9ddce..3bf0d08068ec 100644
--- a/products/replay_vision/backend/temporal/scanners/summarizer.py
+++ b/products/replay_vision/backend/temporal/scanners/summarizer.py
@@ -71,8 +71,9 @@ class SummarizerFacetsResponse(BaseModel, frozen=True):
@field_validator("keywords", "friction_points", mode="after")
@classmethod
def _lowercase(cls, value: list[str]) -> list[str]:
- # Lowercase so embedding similarity isn't fragmented by mixed casing.
- return [v.lower() for v in value]
+ # Lowercase so embedding similarity isn't fragmented by mixed casing. Dedupe so a phrase the
+ # model repeats is stored once (the UI keys facet tags by term).
+ return list(dict.fromkeys(v.lower() for v in value))
class SummarizerOutput(BaseScannerOutput, frozen=True):
diff --git a/products/replay_vision/backend/tests/test_api.py b/products/replay_vision/backend/tests/test_api.py
index 2ea49151cb2d..141d97af40d9 100644
--- a/products/replay_vision/backend/tests/test_api.py
+++ b/products/replay_vision/backend/tests/test_api.py
@@ -1319,8 +1319,11 @@ class TestReplayObservationViewSet(_VisionAPITestCase):
)
for idx, (friction, keywords) in enumerate(
[
- (["checkout stalls"], ["checkout"]),
+ # Stored rows can repeat a term within one summary; rankings must count it once.
+ (["checkout stalls", "checkout stalls"], ["checkout", "checkout"]),
(["checkout stalls", "filter reset"], ["checkout", "filters"]),
+ # Keywords without friction: the friction rate's numerator and denominator must differ here.
+ ([], ["browsing"]),
([], []),
]
):
@@ -1346,14 +1349,15 @@ class TestReplayObservationViewSet(_VisionAPITestCase):
resp = self.client.get(f"{self.observations_url(str(summarizer.id))}stats/")
self.assertEqual(resp.status_code, 200)
body = resp.json()
- self.assertEqual(body["summarizer"]["total_with_facets"], 2)
+ self.assertEqual(body["summarizer"]["total_with_facets"], 3)
+ self.assertEqual(body["summarizer"]["total_with_friction"], 2)
self.assertEqual(
body["summarizer"]["friction_ranked"],
[{"term": "checkout stalls", "count": 2}, {"term": "filter reset", "count": 1}],
)
self.assertEqual(
body["summarizer"]["keyword_ranked"],
- [{"term": "checkout", "count": 2}, {"term": "filters", "count": 1}],
+ [{"term": "checkout", "count": 2}, {"term": "browsing", "count": 1}, {"term": "filters", "count": 1}],
)
self.assertIsNone(body["classifier"])
diff --git a/products/replay_vision/backend/tests/test_scanners.py b/products/replay_vision/backend/tests/test_scanners.py
index 8958f3a2af4e..8502ca56e02c 100644
--- a/products/replay_vision/backend/tests/test_scanners.py
+++ b/products/replay_vision/backend/tests/test_scanners.py
@@ -629,7 +629,7 @@ class TestSummarizerScannerSteps:
assert out.title == "t"
assert out.has_any_facet() is False
- def test_facets_response_lowercases_keywords_and_friction_points(self) -> None:
+ def test_facets_response_lowercases_and_dedupes_keywords_and_friction_points(self) -> None:
scanner = scanner_from_db(
_build_replay_scanner(scanner_type=ScannerType.SUMMARIZER, scanner_config={"prompt": "p"})
)
@@ -637,8 +637,8 @@ class TestSummarizerScannerSteps:
facets = SummarizerFacetsResponse(
intent="Authenticate",
outcome="Reached reset page",
- friction_points=["Invalid Password Error", "Buffering Page"],
- keywords=["Login", "Failed Attempt", "Reset"],
+ friction_points=["Invalid Password Error", "Buffering Page", "invalid password error"],
+ keywords=["Login", "Failed Attempt", "Reset", "login"],
)
out, _ = scanner.assemble({"summary": summary, "facets": facets})
assert isinstance(out, SummarizerOutput)
diff --git a/products/replay_vision/frontend/generated/api.schemas.ts b/products/replay_vision/frontend/generated/api.schemas.ts
index b66a411bec10..712e166de6c7 100644
--- a/products/replay_vision/frontend/generated/api.schemas.ts
+++ b/products/replay_vision/frontend/generated/api.schemas.ts
@@ -1207,6 +1207,8 @@ export interface SummarizerStatsApi {
keyword_ranked: FacetCountApi[]
/** Succeeded observations that emitted at least one friction point or keyword. */
total_with_facets: number
+ /** Succeeded observations that reported at least one friction point. */
+ total_with_friction: number
}
export interface ObservationStatsApi {
diff --git a/products/replay_vision/frontend/replay_scanners/ReplayScannersScene.stories.tsx b/products/replay_vision/frontend/replay_scanners/ReplayScannersScene.stories.tsx
index ee0a5ddd67a7..785ab4a383ab 100644
--- a/products/replay_vision/frontend/replay_scanners/ReplayScannersScene.stories.tsx
+++ b/products/replay_vision/frontend/replay_scanners/ReplayScannersScene.stories.tsx
@@ -6,7 +6,7 @@ import { urls } from 'scenes/urls'
import { mswDecorator } from '~/mocks/browser'
-import type { ReplayScannerApi, UserBasicApi, VisionQuotaApi } from '../generated/api.schemas'
+import type { ObservationStatsApi, ReplayScannerApi, UserBasicApi, VisionQuotaApi } from '../generated/api.schemas'
const alice: UserBasicApi = {
id: 1,
@@ -102,6 +102,66 @@ const quota: VisionQuotaApi = {
period_end: '2026-06-01T00:00:00Z',
}
+const summarizerScanner = scanners.results[2]
+
+const summarizerStats: ObservationStatsApi = {
+ status_counts: { total: 148, succeeded: 142, failed: 4, ineligible: 2, in_flight: 0, success_rate: 0.97 },
+ coverage: { recent_sessions: 142, total_sessions: 1840, recent_days: 14 },
+ labels: { up_total: 0, down_total: 0, by_day: [], by_rating_day: [], version_markers: [] },
+ available_tags: [],
+ monitor: null,
+ classifier: null,
+ scorer: null,
+ summarizer: {
+ friction_ranked: [
+ { term: 'checkout stalls after applying a coupon', count: 21 },
+ { term: 'search returns no results for valid skus', count: 14 },
+ { term: 'filter selection resets on back navigation', count: 9 },
+ { term: 'payment form rejects valid card numbers', count: 6 },
+ { term: 'session times out mid-signup', count: 3 },
+ ],
+ keyword_ranked: [
+ { term: 'checkout', count: 68 },
+ { term: 'coupon', count: 41 },
+ { term: 'abandoned', count: 33 },
+ { term: 'search', count: 27 },
+ { term: 'signup', count: 12 },
+ ],
+ total_with_facets: 138,
+ total_with_friction: 53,
+ },
+} as ObservationStatsApi
+
+// A daily observation volume so the chart has something to draw above the panels.
+const trendDays = [
+ '2026-04-29',
+ '2026-04-30',
+ '2026-05-01',
+ '2026-05-02',
+ '2026-05-03',
+ '2026-05-04',
+ '2026-05-05',
+ '2026-05-06',
+ '2026-05-07',
+ '2026-05-08',
+ '2026-05-09',
+ '2026-05-10',
+ '2026-05-11',
+ '2026-05-12',
+]
+const observationsTrend = {
+ results: [
+ {
+ action: { id: '$recording_observed', type: 'events', order: 0, name: '$recording_observed' },
+ label: 'Observations',
+ count: 142,
+ data: [8, 11, 9, 14, 10, 12, 7, 13, 9, 11, 10, 8, 12, 8],
+ labels: trendDays,
+ days: trendDays,
+ },
+ ],
+}
+
const meta: Meta = {
component: App,
title: 'Scenes-App/Replay Vision',
@@ -124,3 +184,27 @@ const meta: Meta = {
export default meta
export const ScannersList: StoryObj = {}
+
+// Nothing else renders the summarizer's friction/keyword panels, so this story is what catches regressions there.
+export const SummarizerOverview: StoryObj = {
+ parameters: {
+ pageUrl: urls.replayVision(summarizerScanner.id),
+ },
+ decorators: [
+ mswDecorator({
+ get: {
+ '/api/projects/:team_id/vision/scanners/:id/': summarizerScanner,
+ '/api/projects/:team_id/vision/scanners/:id/observations/': {
+ count: 0,
+ next: null,
+ previous: null,
+ results: [],
+ },
+ '/api/projects/:team_id/vision/scanners/:id/observations/stats/': summarizerStats,
+ },
+ post: {
+ '/api/environments/:team_id/query/:query_kind/': observationsTrend,
+ },
+ }),
+ ],
+}
diff --git a/products/replay_vision/frontend/replay_scanners/components/ScannerOverview.tsx b/products/replay_vision/frontend/replay_scanners/components/ScannerOverview.tsx
index 994f90565c4f..b06f347cd286 100644
--- a/products/replay_vision/frontend/replay_scanners/components/ScannerOverview.tsx
+++ b/products/replay_vision/frontend/replay_scanners/components/ScannerOverview.tsx
@@ -53,6 +53,53 @@ function PanelEmpty({ loading, message }: { loading: boolean; message: string })
return <div className="text-muted text-sm">{message}</div>
}
+// Cap the rows so a panel can't outgrow the one beside it.
+const RANKED_ROWS = 5
+
+// The bar is the row background rather than a column, so long friction phrases wrap instead of truncating.
+function RankedTermList({
+ ranked,
+ loading,
+ emptyMessage,
+ renderAction,
+}: {
+ ranked: [string, number][]
+ loading: boolean
+ emptyMessage: string
+ renderAction?: (term: string) => JSX.Element
+}): JSX.Element {
+ if (ranked.length === 0) {
+ return <PanelEmpty loading={loading} message={emptyMessage} />
+ }
+ const top = ranked.slice(0, RANKED_ROWS)
+ const maxCount = top[0][1]
+ // When no term repeats, every bar is full width and falsely reads as "these all dominate", so drop the bars.
+ const showBars = maxCount > 1
+ return (
+ <div className="space-y-1">
+ {top.map(([term, count]) => (
+ <div key={term} className="relative rounded overflow-hidden">
+ {showBars && (
+ <div
+ className="absolute inset-y-0 left-0 bg-accent-highlight-secondary"
+ // Width is data-derived, so it can't live in a class.
+ // eslint-disable-next-line react/forbid-dom-props
+ style={{ width: `${Math.round((count / maxCount) * 100)}%` }}
+ />
+ )}
+ <div className="relative flex items-baseline justify-between gap-2 px-2 py-1">
+ <span className="text-xs">{term}</span>
+ <div className="flex items-center gap-1 shrink-0">
+ <span className="text-xs font-medium tabular-nums">{count.toLocaleString()}</span>
+ {renderAction?.(term)}
+ </div>
+ </div>
+ </div>
+ ))}
+ </div>
+ )
+}
+
function ImpactOverview({ scannerId }: { scannerId: string }): JSX.Element | null {
const { scanner, overviewImpact, overviewImpactLoading } = useValues(scannerOverviewLogic({ scannerId }))
// Cohort creation is a scanner-level action, independent of the overview's filter set.
@@ -177,50 +224,29 @@ function ClassifierOverview({ scannerId }: { scannerId: string }): JSX.Element |
? 'No freeform tags match the current filter.'
: 'No freeform tags emitted yet.'
- const renderRanked = (ranked: [string, number][], emptyMessage: string): JSX.Element => {
- if (ranked.length === 0) {
- return <PanelEmpty loading={overviewStatsApiLoading} message={emptyMessage} />
- }
- // Cap at the 5 most common so the panels stay compact.
- const top = ranked.slice(0, 5)
- const maxCount = top[0][1]
- return (
- <div className="space-y-1.5">
- {top.map(([tag, count]) => (
- <div key={tag} className="flex items-center gap-2">
- {/* Fixed-width label column so every bar shares the same left edge and their lengths stay comparable. */}
- <div className="w-40 shrink-0 flex">
- <LemonTag type="option" title={tag} className="max-w-full truncate">
- {tag}
- </LemonTag>
- </div>
- <LemonProgress percent={Math.round((count / maxCount) * 100)} className="flex-1" />
- <span className="text-xs text-muted tabular-nums text-right whitespace-nowrap shrink-0 w-12">
- {count.toLocaleString()}
- </span>
- <LemonButton
- size="xsmall"
- icon={<IconPeople />}
- tooltip={`Save users tagged "${tag}" in the last 30 days as a cohort`}
- onClick={() => saveAffectedCohort(tag)}
- loading={affectedCohortLoading && savingCohortTag === tag}
- disabledReason={
- affectedCohortLoading && savingCohortTag !== tag
- ? 'Another cohort is being created'
- : undefined
- }
- data-attr="vision-save-tag-cohort"
- />
- </div>
- ))}
- </div>
- )
- }
+ const cohortAction = (tag: string): JSX.Element => (
+ <LemonButton
+ size="xsmall"
+ icon={<IconPeople />}
+ tooltip={`Save users tagged "${tag}" in the last 30 days as a cohort`}
+ onClick={() => saveAffectedCohort(tag)}
+ loading={affectedCohortLoading && savingCohortTag === tag}
+ disabledReason={
+ affectedCohortLoading && savingCohortTag !== tag ? 'Another cohort is being created' : undefined
+ }
+ data-attr="vision-save-tag-cohort"
+ />
+ )
return (
<div className="grid grid-cols-1 lg:grid-cols-2 gap-4">
<OverviewPanel title="Top fixed tags" subtitle="from configured vocabulary" fill>
- {renderRanked(fixedRanked, fixedEmpty)}
+ <RankedTermList
+ ranked={fixedRanked}
+ loading={overviewStatsApiLoading}
+ emptyMessage={fixedEmpty}
+ renderAction={cohortAction}
+ />
</OverviewPanel>
<OverviewPanel
@@ -230,10 +256,15 @@ function ClassifierOverview({ scannerId }: { scannerId: string }): JSX.Element |
fill
>
{freeformAllowed ? (
- renderRanked(freeformRanked, freeformEmpty)
+ <RankedTermList
+ ranked={freeformRanked}
+ loading={overviewStatsApiLoading}
+ emptyMessage={freeformEmpty}
+ renderAction={cohortAction}
+ />
) : (
<div className="text-muted text-sm">
- Freeform tags are disabled for this scanner — the model can only pick from your configured
+ Freeform tags are disabled for this scanner, so the model can only pick from your configured
vocabulary. Enable "Allow freeform tags" in the scanner config to let it propose new ones.
</div>
)}
@@ -289,7 +320,7 @@ function SummarizerOverview({ scannerId }: { scannerId: string }): JSX.Element |
if (!scanner || scanner.scanner_type !== 'summarizer') {
return null
}
- const { frictionRanked, keywordRanked, totalWithFacets } = summarizerFacetStats
+ const { frictionRanked, keywordRanked, totalSucceeded, totalWithFriction } = summarizerFacetStats
const frictionEmpty = hasActiveOverviewFilters
? 'No friction points match the current filter.'
: 'No friction points reported yet. They appear as summaries accumulate.'
@@ -297,81 +328,26 @@ function SummarizerOverview({ scannerId }: { scannerId: string }): JSX.Element |
? 'No keywords match the current filter.'
: 'No keywords reported yet. They appear as summaries accumulate.'
- // The fill is the row background so long phrases wrap instead of truncating.
- const renderRankedPhrases = (ranked: [string, number][], emptyMessage: string): JSX.Element => {
- if (ranked.length === 0) {
- return <PanelEmpty loading={overviewStatsApiLoading} message={emptyMessage} />
- }
- const top = ranked.slice(0, 5)
- const maxCount = top[0][1]
- // Free-form phrases rarely repeat verbatim; without repeats a ranking is meaningless.
- if (maxCount <= 1) {
- return (
- <ul className="space-y-1 text-xs text-secondary list-disc pl-4">
- {top.map(([term]) => (
- <li key={term}>{term}</li>
- ))}
- </ul>
- )
- }
- return (
- <div className="space-y-1">
- {top.map(([term, count]) => (
- <div key={term} className="relative rounded overflow-hidden">
- <div
- className="absolute inset-y-0 left-0"
- // eslint-disable-next-line react/forbid-dom-props
- style={{
- width: `${Math.round((count / maxCount) * 100)}%`,
- backgroundColor: 'color-mix(in srgb, var(--color-accent) 15%, transparent)',
- }}
- />
- <div className="relative flex items-baseline justify-between gap-2 px-2 py-1">
- <span className="text-xs text-secondary">{term}</span>
- <span className="text-xs font-medium tabular-nums shrink-0">{count.toLocaleString()}</span>
- </div>
- </div>
- ))}
- </div>
- )
- }
-
- const renderRankedTags = (ranked: [string, number][], emptyMessage: string): JSX.Element => {
- if (ranked.length === 0) {
- return <PanelEmpty loading={overviewStatsApiLoading} message={emptyMessage} />
- }
- const top = ranked.slice(0, 5)
- const maxCount = top[0][1]
- return (
- <div className="space-y-1.5">
- {top.map(([term, count]) => (
- <div key={term} className="flex items-center gap-2">
- <div className="w-40 shrink-0 flex">
- <LemonTag type="option" title={term} className="max-w-full truncate">
- {term}
- </LemonTag>
- </div>
- <LemonProgress percent={Math.round((count / maxCount) * 100)} className="flex-1" />
- <span className="text-xs text-muted tabular-nums text-right whitespace-nowrap shrink-0 w-12">
- {count.toLocaleString()}
- </span>
- </div>
- ))}
- </div>
- )
- }
-
- const subtitle =
- totalWithFacets > 0
- ? `from ${totalWithFacets.toLocaleString()} summar${totalWithFacets === 1 ? 'y' : 'ies'}`
+ const summaries = (count: number): string => `${count.toLocaleString()} summar${count === 1 ? 'y' : 'ies'}`
+ // Both subtitles use the same succeeded-summary denominator so the two panels stay comparable.
+ const frictionSubtitle =
+ totalSucceeded > 0
+ ? `${totalWithFriction.toLocaleString()} of ${summaries(totalSucceeded)} (${Math.round(
+ (totalWithFriction / totalSucceeded) * 100
+ )}%)`
: undefined
+ const keywordSubtitle = totalSucceeded > 0 ? `from ${summaries(totalSucceeded)}` : undefined
return (
<div className="grid grid-cols-1 lg:grid-cols-2 gap-4">
- <OverviewPanel title="Top friction points" subtitle={subtitle} fill>
- {renderRankedPhrases(frictionRanked, frictionEmpty)}
+ <OverviewPanel title="Top friction points" subtitle={frictionSubtitle} fill>
+ <RankedTermList
+ ranked={frictionRanked}
+ loading={overviewStatsApiLoading}
+ emptyMessage={frictionEmpty}
+ />
</OverviewPanel>
- <OverviewPanel title="Common keywords" subtitle={subtitle} fill>
- {renderRankedTags(keywordRanked, keywordEmpty)}
+ <OverviewPanel title="Common keywords" subtitle={keywordSubtitle} fill>
+ <RankedTermList ranked={keywordRanked} loading={overviewStatsApiLoading} emptyMessage={keywordEmpty} />
</OverviewPanel>
</div>
)
@@ -393,10 +369,6 @@ export function ScannerOverview({ scannerId }: { scannerId: string }): JSX.Eleme
) : scannerType === 'summarizer' ? (
<SummarizerOverview scannerId={scannerId} />
) : null
- const showChart = scannerType !== 'summarizer'
- if (!showChart && !typeOverview) {
- return null
- }
// Scorer puts its line chart and score-distribution histogram side by side to reclaim vertical space.
let body: JSX.Element
@@ -415,14 +387,14 @@ export function ScannerOverview({ scannerId }: { scannerId: string }): JSX.Eleme
// Impact only exists for monitors; other types keep their overview at full width.
body = (
<div className="space-y-4">
- {showChart && <ScannerInsightsChart scannerId={scannerId} scannerType={scannerType} />}
+ <ScannerInsightsChart scannerId={scannerId} scannerType={scannerType} />
{typeOverview}
</div>
)
} else {
body = (
<div className="space-y-4">
- {showChart && <ScannerInsightsChart scannerId={scannerId} scannerType={scannerType} />}
+ <ScannerInsightsChart scannerId={scannerId} scannerType={scannerType} />
<div className="grid grid-cols-1 lg:grid-cols-2 gap-4">
{typeOverview && <div className="min-w-0">{typeOverview}</div>}
<div className="min-w-0">
diff --git a/products/replay_vision/frontend/replay_scanners/scannerStats.test.ts b/products/replay_vision/frontend/replay_scanners/scannerStats.test.ts
new file mode 100644
index 000000000000..1ef109b276a3
--- /dev/null
+++ b/products/replay_vision/frontend/replay_scanners/scannerStats.test.ts
@@ -0,0 +1,33 @@
+import type { ObservationStatsApi } from '../generated/api.schemas'
+import { deriveSummarizerFacetStats } from './scannerStats'
+
+// Partial on purpose: only the fields deriveSummarizerFacetStats reads.
+const stats = {
+ status_counts: { total: 10, succeeded: 8, failed: 1, ineligible: 1, in_flight: 0, success_rate: 0.8 },
+ summarizer: {
+ friction_ranked: [{ term: 'checkout stalls', count: 3 }],
+ keyword_ranked: [{ term: 'checkout', count: 5 }],
+ total_with_facets: 4,
+ total_with_friction: 3,
+ },
+} as ObservationStatsApi
+
+describe('deriveSummarizerFacetStats', () => {
+ it('uses every succeeded summary as the friction rate denominator, not just facet emitters', () => {
+ expect(deriveSummarizerFacetStats(stats)).toEqual({
+ frictionRanked: [['checkout stalls', 3]],
+ keywordRanked: [['checkout', 5]],
+ totalSucceeded: 8,
+ totalWithFriction: 3,
+ })
+ })
+
+ it('returns empty stats while the API response has not loaded', () => {
+ expect(deriveSummarizerFacetStats(null)).toEqual({
+ frictionRanked: [],
+ keywordRanked: [],
+ totalSucceeded: 0,
+ totalWithFriction: 0,
+ })
+ })
+})
diff --git a/products/replay_vision/frontend/replay_scanners/scannerStats.ts b/products/replay_vision/frontend/replay_scanners/scannerStats.ts
index e92920546e35..e993ad78104c 100644
--- a/products/replay_vision/frontend/replay_scanners/scannerStats.ts
+++ b/products/replay_vision/frontend/replay_scanners/scannerStats.ts
@@ -116,13 +116,17 @@ export function daysFromDateRange(dateFrom: string | null, dateTo: string | null
export interface SummarizerFacetStats {
frictionRanked: [string, number][]
keywordRanked: [string, number][]
- totalWithFacets: number
+ totalSucceeded: number
+ totalWithFriction: number
}
export function deriveSummarizerFacetStats(stats: ObservationStatsApi | null): SummarizerFacetStats {
return {
frictionRanked: (stats?.summarizer?.friction_ranked ?? []).map((f) => [f.term, f.count] as [string, number]),
keywordRanked: (stats?.summarizer?.keyword_ranked ?? []).map((f) => [f.term, f.count] as [string, number]),
- totalWithFacets: stats?.summarizer?.total_with_facets ?? 0,
+ // Summaries that report no friction still count toward the friction rate, so the denominator
+ // is every succeeded summary rather than only those that emitted facets.
+ totalSucceeded: stats?.status_counts.succeeded ?? 0,
+ totalWithFriction: stats?.summarizer?.total_with_friction ?? 0,
}
}
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index 21699e024cd6..a251772a6557 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -41112,6 +41112,8 @@ export namespace Schemas {
keyword_ranked: FacetCount[];
/** Succeeded observations that emitted at least one friction point or keyword. */
total_with_facets: number;
+ /** Succeeded observations that reported at least one friction point. */
+ total_with_friction: number;
}
export interface ObservationStats {