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(signals): show a three-score ranking pill on the recommended inbox sort (#127517)

posthog[bot]da90f457e7d3
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index 585cbf560cac..5df82ad22a09 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -12046,6 +12046,14 @@ snapshots:
hash: v1.k794b7964.0869413b6549ec880738d2b1027557ca43261ba77494056570db3d287894d474.24khdTzcgNLys1nXkfTUjYMnqSPQrgjoAH5KEojzbcc
scenes-app-inbox-cards--report-card-claims--light:
hash: v1.k794b7964.a0c5c50d464e77c37eebc6d632f941a14a1781a4a56887cba8c67bdc0a146339.s_GdO_rSCXgztc4ixwKZxZgq1gxJC77MemS6JtNMGOg
+ scenes-app-inbox-cards--report-card-ranking-pills--dark:
+ hash: v1.k794b7964.e365897a2bbdf261ad943724192056ff7fb2a90ecd73ac48e3bf740b4dcae220.D7hiwD-TX8eBz-kwEqW1fDXapqelqSVNfsLvKIlUkrk
+ scenes-app-inbox-cards--report-card-ranking-pills--light:
+ hash: v1.k794b7964.8ebfc4ef8f9fe3b9ec9abe6c4208367edcd2d465c4febb7072cff732268f540c.tgE38zzI-RKiSiQWDURea608AWtfA6wakjJeg0Fc1EI
+ scenes-app-inbox-cards--report-card-ranking-pills-narrow--dark:
+ hash: v1.k794b7964.271a4b8abfa91dd2dd1f1d167e31623c83ec6a129473d584f7d14520b2ae9fbc.w1Ie4H9cASbns3xtRHMt8MzOE0pbON6WZFcCJ6imZ8U
+ scenes-app-inbox-cards--report-card-ranking-pills-narrow--light:
+ hash: v1.k794b7964.b1c962bc4c49b1e5ceeda2ff47865a2448a8c5a837d82bae3b077f9a150aa13c.59O2bhwWu80qnBNvS7Qco54q_Z9k2qMJ8moVo6q3rxA
scenes-app-inbox-cards--report-card-ranking-tags--dark:
hash: v1.k794b7964.fe2edfc719172a09b7a54479a14278f8c39853b604bb6eda0b17aba928d45d85.ZJo3-Ncode3NwUV8az9HACGNrnYqBDzi2qpFD3OYN6Y
scenes-app-inbox-cards--report-card-ranking-tags--light:
diff --git a/products/signals/frontend/inbox/components/cards/InboxCards.stories.tsx b/products/signals/frontend/inbox/components/cards/InboxCards.stories.tsx
index 721ac1c6b91d..2c546f6914b0 100644
--- a/products/signals/frontend/inbox/components/cards/InboxCards.stories.tsx
+++ b/products/signals/frontend/inbox/components/cards/InboxCards.stories.tsx
@@ -326,6 +326,59 @@ export const ReportCardRankingTags: Story = {
},
}
+// The Recommended pill: strong, mixed and weak scores, a lift under 0.1x, a report edited after scoring, and an unscored report.
+const pillReports: SignalReport[] = [
+ makeReport({
+ title: 'Payment webhook retries stop after one rate limit response',
+ priority: 'P1',
+ source_products: ['logs'],
+ ranking: ranking({ open: 0.8, action: 0.5, fix: 0.3 }, { open: 2.9, action: 3.1, fix: 3.2 }),
+ }),
+ makeReport({
+ title: 'Tooltip flickers on the funnel chart',
+ priority: 'P3',
+ source_products: ['session_replay'],
+ ranking: ranking({ open: 0.5, action: 0.2, fix: 0.04 }, { open: 1.4, action: 0.9, fix: 0.6 }),
+ }),
+ makeReport({
+ title: 'Typo in the billing settings page',
+ priority: 'P4',
+ ranking: ranking({ open: 0.1, action: 0.02, fix: 0.004 }, { open: 0.5, action: 0.3, fix: 0.05 }),
+ }),
+ makeReport({
+ title: 'Retry loop in the export job',
+ priority: 'P3',
+ ranking: ranking({ action: 0.5 }, { action: 1.2 }, true),
+ }),
+ makeReport({ title: 'Slow dashboard load for large projects', priority: 'P2', ranking: null }),
+]
+
+export const ReportCardRankingPills: Story = {
+ render: () => (
+ <CardList>
+ {pillReports.map((report) => (
+ <ReportCard key={report.id} report={report} rankingPill />
+ ))}
+ </CardList>
+ ),
+ play: async ({ canvas }) => {
+ await userEvent.hover(await canvas.findByText('2.9x'))
+ },
+}
+
+/** The narrowest scene the inbox holds: the nav and a side panel open in a 1280px window. */
+export const ReportCardRankingPillsNarrow: Story = {
+ render: () => (
+ <div className="bg-primary min-h-screen w-[520px] px-3 py-6">
+ <div className="@container flex flex-col gap-1.5">
+ {pillReports.map((report) => (
+ <ReportCard key={report.id} report={report} rankingPill />
+ ))}
+ </div>
+ </div>
+ ),
+}
+
// Under the Action sort, so the ranking pill sits in the meta row: the user's claim, their agent's
// claim, a teammate's claim, and no claim.
const claimedRankedReports: SignalReport[] = [
diff --git a/products/signals/frontend/inbox/components/cards/ReportCard.test.tsx b/products/signals/frontend/inbox/components/cards/ReportCard.test.tsx
index 06e1b0cfaf7b..c0cccc6e2483 100644
--- a/products/signals/frontend/inbox/components/cards/ReportCard.test.tsx
+++ b/products/signals/frontend/inbox/components/cards/ReportCard.test.tsx
@@ -499,6 +499,42 @@ describe('ReportCard', () => {
expect(screen.queryByText('Not scored yet')).not.toBeInTheDocument()
})
+ it('shows the three-score pill only when the Recommended list asks for it, and keeps the tags elsewhere', () => {
+ // The harness renders a card for every test; these assert against their own.
+ cleanup()
+ enableImpactColumn()
+ const scored = makeReport('r-2', {
+ ranking: {
+ status: 'scored',
+ model: 'report_embeddings@2026-09-30',
+ scored_at: '2026-09-30T12:00:00Z',
+ predictions: [
+ { outcome: 'open', probability: 0.8, lift: 2.9, readable: true },
+ { outcome: 'action', probability: 0.3, lift: 0.04, readable: true },
+ { outcome: 'fix', probability: 0.41, lift: 2.7, readable: true },
+ ],
+ },
+ })
+ const { container, rerender } = render(<ReportCard report={scored} rankingPill />)
+ const pill = container.querySelector('[data-attr="inbox-ranking-pill"]')
+ expect(pill?.textContent).toBe('Open2.9xAction<0.1xFix2.7x')
+ // The card is a link, so a click that reaches it would open the report.
+ expect(fireEvent.click(pill as Element)).toBe(false)
+ ;(pill as HTMLElement).focus()
+ expect(document.activeElement).toBe(pill)
+
+ rerender(<ReportCard report={scored} rankingPill rankingSortField="ranking_fix" />)
+ expect(container.querySelector('[data-attr="inbox-ranking-pill"]')).toBeNull()
+ expect(screen.getByText('2.7x more likely')).toBeInTheDocument()
+
+ rerender(<ReportCard report={{ ...scored, ranking: { ...scored.ranking!, status: 'stale' } }} rankingPill />)
+ expect(screen.getByText('Score out of date')).toBeInTheDocument()
+
+ rerender(<ReportCard report={scored} />)
+ expect(container.querySelector('[data-attr="inbox-ranking-pill"]')).toBeNull()
+ expect(container.querySelector('[data-attr="inbox-ranking-tag"]')).toBeNull()
+ })
+
it('does not show a list metric without a stored snapshot or with the metrics flag off', () => {
const report = makeReport('r-2', { metrics: [makeMetric({ value: null, value_at: null })] })
diff --git a/products/signals/frontend/inbox/components/cards/ReportCard.tsx b/products/signals/frontend/inbox/components/cards/ReportCard.tsx
index e42684c5fac1..d38d8aada7b0 100644
--- a/products/signals/frontend/inbox/components/cards/ReportCard.tsx
+++ b/products/signals/frontend/inbox/components/cards/ReportCard.tsx
@@ -34,6 +34,7 @@ import {
import { useReportClaim } from '../badges/useReportClaim'
import { inboxCardRowClassName } from './inboxCardRowClassName'
import { ReportCardImpactMetric } from './ReportCardImpactMetric'
+import { ReportCardRankingPill } from './ReportCardRankingPill'
import { ReportCardRankingTag } from './ReportCardRankingTag'
import { useReportCardSelection } from './useReportCardSelection'
import { useReportDismiss } from './useReportDismiss'
@@ -115,6 +116,7 @@ function ReportCardRaw({
preview = false,
selectable = false,
rankingSortField = null,
+ rankingPill = false,
timestampField = 'updated_at',
hideOwnClaim = false,
}: {
@@ -132,6 +134,8 @@ function ReportCardRaw({
selectable?: boolean
/** The active model sort, if any. The meta row then shows the report's probability for that head. */
rankingSortField?: InboxRankingSortField | null
+ /** The Recommended list asked for score pills. The meta row then shows all three scores. A model sort shows its own tag instead. */
+ rankingPill?: boolean
/** The time the card shows. Match it to the active time sort, so the list reads in order. */
timestampField?: 'created_at' | 'updated_at'
/** Hide the user's own claim marker, for views where every card is theirs. */
@@ -276,7 +280,11 @@ function ReportCardRaw({
</Tooltip>
)}
<SignalReportBillingBadge report={report} />
- {rankingSortField && <ReportCardRankingTag report={report} sortField={rankingSortField} />}
+ {rankingSortField ? (
+ <ReportCardRankingTag report={report} sortField={rankingSortField} />
+ ) : rankingPill ? (
+ <ReportCardRankingPill report={report} />
+ ) : null}
{!showImpactColumn && (
<span className="ml-auto flex shrink-0 items-center gap-2">
{claimAvatar}
diff --git a/products/signals/frontend/inbox/components/cards/ReportCardRankingPill.tsx b/products/signals/frontend/inbox/components/cards/ReportCardRankingPill.tsx
new file mode 100644
index 000000000000..b8f354bbef06
--- /dev/null
+++ b/products/signals/frontend/inbox/components/cards/ReportCardRankingPill.tsx
@@ -0,0 +1,70 @@
+import { useValues } from 'kea'
+import { useCallback } from 'react'
+
+import { Tooltip } from '@posthog/lemon-ui'
+
+import { userLogic } from 'scenes/userLogic'
+
+import { INBOX_RANKING_SCORES } from '../../filterOptions'
+import { captureInboxRankingDetailsViewed } from '../../inboxAnalytics'
+import { SignalReport } from '../../types'
+import { RankingPillLifts, rankingPillLifts } from '../../utils/reportOrdering'
+import { formatRankingLift, RankingStrength, rankingStrength } from './rankingFormat'
+import { RankingHoverCard, RankingStatusTag } from './ReportCardRankingTag'
+
+// A strong value is bold too, so color is not the only signal.
+const STRENGTH_VALUE_CLASSES: Record<RankingStrength, string> = {
+ very_likely: 'font-bold text-success',
+ likely: 'font-semibold text-accent',
+ average: 'text-secondary',
+ unlikely: 'text-muted',
+}
+
+/**
+ * The three ranking scores in funnel order, in the card's meta row on the Recommended sort. The chip
+ * stays neutral and each value takes the color of its own strength. A stale or unscored report keeps
+ * the muted tag that the score sorts show.
+ */
+export function ReportCardRankingPill({ report }: { report: SignalReport }): JSX.Element {
+ const isStaff = useValues(userLogic).user?.is_staff ?? false
+ const lifts = rankingPillLifts(report)
+ const state = lifts ? 'scored' : report.ranking?.status === 'stale' ? 'stale' : 'unscored'
+ // Tooltip re-fires onOpen when the callback identity changes, so a new one each render would double count views.
+ const onOpen = useCallback(
+ (): void => captureInboxRankingDetailsViewed({ report, surface: 'pill', head: null, state, strength: null }),
+ [report, state]
+ )
+ if (!lifts || !report.ranking) {
+ return <RankingStatusTag state={state === 'stale' ? 'stale' : 'unscored'} onOpen={onOpen} />
+ }
+ return (
+ <Tooltip
+ title={<RankingHoverCard ranking={report.ranking} active={null} isStaff={isStaff} />}
+ onOpen={onOpen}
+ openOnClick
+ >
+ <button
+ type="button"
+ className="inline-flex max-w-full cursor-help items-stretch divide-x divide-primary overflow-hidden rounded border border-primary bg-surface-primary text-xs leading-none text-secondary tabular-nums"
+ data-attr="inbox-ranking-pill"
+ // The card is a link. A tap on the pill opens the details instead of the report.
+ onClick={(event) => {
+ event.preventDefault()
+ event.stopPropagation()
+ }}
+ >
+ {INBOX_RANKING_SCORES.map((score) => {
+ const lift = lifts[score.outcome as keyof RankingPillLifts]
+ return (
+ <span key={score.outcome} className="flex items-center gap-1 px-1.5 py-1 whitespace-nowrap">
+ <span>{score.name}</span>
+ <span className={lift !== null ? STRENGTH_VALUE_CLASSES[rankingStrength(lift)] : ''}>
+ {lift !== null ? formatRankingLift(lift) : '–'}
+ </span>
+ </span>
+ )
+ })}
+ </button>
+ </Tooltip>
+ )
+}
diff --git a/products/signals/frontend/inbox/components/cards/ReportCardRankingTag.tsx b/products/signals/frontend/inbox/components/cards/ReportCardRankingTag.tsx
index ebdf27cd61c1..1b0c572f451c 100644
--- a/products/signals/frontend/inbox/components/cards/ReportCardRankingTag.tsx
+++ b/products/signals/frontend/inbox/components/cards/ReportCardRankingTag.tsx
@@ -41,61 +41,79 @@ function rankingProbability(ranking: Ranking, outcome: string, isStaff: boolean)
return typeof probability === 'number' ? probability : null
}
-function RankingHoverCard({
+/**
+ * The score details. With an active head, it leads with that head and lists the other readable heads.
+ * Without one, as on the Recommended pill, it lists all three heads in funnel order with their descriptions.
+ */
+export function RankingHoverCard({
ranking,
active,
isStaff,
}: {
ranking: Ranking
- active: InboxRankingScore
+ active: InboxRankingScore | null
isStaff: boolean
}): JSX.Element {
- const lift = rankingLift(ranking, active.outcome)
- const others = INBOX_RANKING_SCORES.filter(
- (score) =>
- score !== active &&
- rankingPrediction(ranking, score.outcome)?.readable &&
- (rankingLift(ranking, score.outcome) !== null ||
- rankingProbability(ranking, score.outcome, isStaff) !== null)
- )
+ const lift = active ? rankingLift(ranking, active.outcome) : null
+ const scores = active
+ ? [
+ active,
+ ...INBOX_RANKING_SCORES.filter(
+ (score) =>
+ score !== active &&
+ rankingPrediction(ranking, score.outcome)?.readable &&
+ (rankingLift(ranking, score.outcome) !== null ||
+ rankingProbability(ranking, score.outcome, isStaff) !== null)
+ ),
+ ]
+ : INBOX_RANKING_SCORES
return (
<div className="flex max-w-96 min-w-80 flex-col gap-2 text-xs">
- <div>
- <div className="font-semibold">
- <span>{active.name}</span>:{' '}
- <span>{lift !== null ? RANKING_STRENGTH_LABELS[rankingStrength(lift)] : 'no comparison'}</span>
- </div>
- <div className="opacity-70">{active.description}</div>
- </div>
- {lift !== null && (
- <div>
- The model rates this report <span>{formatRankingLift(lift)}</span> as likely as the average report.
- </div>
+ {active ? (
+ <>
+ <div>
+ <div className="font-semibold">
+ <span>{active.name}</span>:{' '}
+ <span>
+ {lift !== null ? RANKING_STRENGTH_LABELS[rankingStrength(lift)] : 'no comparison'}
+ </span>
+ </div>
+ <div className="opacity-70">{active.description}</div>
+ </div>
+ {lift !== null && (
+ <div>
+ The model rates this report <span>{formatRankingLift(lift)}</span> as likely as the average
+ report.
+ </div>
+ )}
+ </>
+ ) : (
+ <div className="font-semibold">Compared with the average report</div>
)}
<div className="flex flex-col gap-1">
- {[active, ...others].map((score) => {
+ {scores.map((score) => {
const scoreLift = rankingLift(ranking, score.outcome)
const probability = rankingProbability(ranking, score.outcome, isStaff)
return (
- <div
- key={score.outcome}
- className={clsx('flex items-center gap-2', score === active && 'font-bold')}
- >
- <span className="w-16 shrink-0">{score.name}</span>
- <span className="flex-1">
- <RankingLiftBar lift={scoreLift} />
- </span>
- <span className="w-9 shrink-0 text-right tabular-nums">
- {scoreLift !== null ? formatRankingLift(scoreLift) : null}
- </span>
- <span className="w-24 shrink-0 text-right whitespace-nowrap">
- {scoreLift !== null ? RANKING_STRENGTH_LABELS[rankingStrength(scoreLift)] : null}
- </span>
- {probability !== null && (
- <span className="w-10 shrink-0 text-right font-normal tabular-nums opacity-70">
- {formatRankingProbability(probability)}
+ <div key={score.outcome}>
+ <div className={clsx('flex items-center gap-2', score === active && 'font-bold')}>
+ <span className="w-16 shrink-0">{score.name}</span>
+ <span className="flex-1">
+ <RankingLiftBar lift={scoreLift} />
+ </span>
+ <span className="w-9 shrink-0 text-right tabular-nums">
+ {scoreLift !== null ? formatRankingLift(scoreLift) : null}
+ </span>
+ <span className="w-24 shrink-0 text-right whitespace-nowrap">
+ {scoreLift !== null ? RANKING_STRENGTH_LABELS[rankingStrength(scoreLift)] : null}
</span>
- )}
+ {probability !== null && (
+ <span className="w-10 shrink-0 text-right font-normal tabular-nums opacity-70">
+ {formatRankingProbability(probability)}
+ </span>
+ )}
+ </div>
+ {!active && <div className="opacity-70">{score.description}</div>}
</div>
)
})}
@@ -110,6 +128,24 @@ function RankingHoverCard({
)
}
+/** The muted tag for a report the model has not scored yet, or scored before its last edit. Score sorts put it after the scored ones. */
+export function RankingStatusTag({ state, onOpen }: { state: 'stale' | 'unscored'; onOpen: () => void }): JSX.Element {
+ return (
+ <Tooltip
+ title={
+ state === 'stale'
+ ? 'The title or summary changed after the model scored this report. Until the model scores it again, it sorts after the scored ones.'
+ : 'The model has not scored this report yet. Until it does, the report sorts after the scored ones.'
+ }
+ onOpen={onOpen}
+ >
+ <LemonTag size="small" type="muted" className="cursor-help" data-attr="inbox-ranking-tag">
+ {state === 'stale' ? 'Score out of date' : 'Not scored yet'}
+ </LemonTag>
+ </Tooltip>
+ )
+}
+
/**
* How likely the report is to reach the active model sort's outcome, in the card's meta row. A report
* edited after it was scored, or not scored yet, says so, because the model sort puts it after the scored ones.
@@ -141,6 +177,7 @@ export function ReportCardRankingTag({
(): void =>
captureInboxRankingDetailsViewed({
report,
+ surface: 'tag',
head: score.head,
state,
strength: state === 'scored' ? strength : null,
@@ -148,29 +185,8 @@ export function ReportCardRankingTag({
[report, score.head, state, strength]
)
- if (!ranking || state === 'unscored') {
- return (
- <Tooltip
- title="The model has not scored this report yet. Until it does, the report sorts after the scored ones."
- onOpen={onOpen}
- >
- <LemonTag size="small" type="muted" className="cursor-help" data-attr="inbox-ranking-tag">
- Not scored yet
- </LemonTag>
- </Tooltip>
- )
- }
- if (state === 'stale') {
- return (
- <Tooltip
- title="The title or summary changed after the model scored this report. Until the model scores it again, it sorts after the scored ones."
- onOpen={onOpen}
- >
- <LemonTag size="small" type="muted" className="cursor-help" data-attr="inbox-ranking-tag">
- Score out of date
- </LemonTag>
- </Tooltip>
- )
+ if (!ranking || state !== 'scored') {
+ return <RankingStatusTag state={state === 'stale' ? 'stale' : 'unscored'} onOpen={onOpen} />
}
return (
<Tooltip
diff --git a/products/signals/frontend/inbox/components/cards/rankingFormat.test.ts b/products/signals/frontend/inbox/components/cards/rankingFormat.test.ts
index 918ea161e7f3..b3847101d8a6 100644
--- a/products/signals/frontend/inbox/components/cards/rankingFormat.test.ts
+++ b/products/signals/frontend/inbox/components/cards/rankingFormat.test.ts
@@ -8,7 +8,8 @@ import {
describe('rankingFormat', () => {
test.each([
- [0.04, '0.0x'],
+ [0.04, '<0.1x'],
+ [0.1, '0.1x'],
[1, '1.0x'],
[2.74, '2.7x'],
[9.94, '9.9x'],
@@ -24,6 +25,7 @@ describe('rankingFormat', () => {
[1.04, '1.0x as likely'],
[0.96, '1.0x as likely'],
[0.6, '0.6x as likely'],
+ [0.04, '<0.1x as likely'],
[12.4, '12x more likely'],
])('labels a lift of %s on the pill as %s', (lift, expected) => {
expect(formatRankingLiftComparison(lift)).toBe(expected)
diff --git a/products/signals/frontend/inbox/components/cards/rankingFormat.ts b/products/signals/frontend/inbox/components/cards/rankingFormat.ts
index cbeb2c83e27b..d1741164ec78 100644
--- a/products/signals/frontend/inbox/components/cards/rankingFormat.ts
+++ b/products/signals/frontend/inbox/components/cards/rankingFormat.ts
@@ -5,8 +5,11 @@ export function formatRankingProbability(probability: number): string {
return oneDecimal >= 10 ? `${Math.round(percent)}%` : `${oneDecimal.toFixed(1)}%`
}
-/** One decimal below 10x, no decimals at 10x and above. */
+/** One decimal below 10x, no decimals at 10x and above. A lift under 0.1x reads `<0.1x`, because `0.0x` reads like a bug. */
export function formatRankingLift(lift: number): string {
+ if (lift < 0.1) {
+ return '<0.1x'
+ }
const oneDecimal = Math.round(lift * 10) / 10
return oneDecimal >= 10 ? `${Math.round(lift)}x` : `${oneDecimal.toFixed(1)}x`
}
diff --git a/products/signals/frontend/inbox/components/tabs/ReportsTab.tsx b/products/signals/frontend/inbox/components/tabs/ReportsTab.tsx
index dfc1b2365c5c..a0f9bee53fcf 100644
--- a/products/signals/frontend/inbox/components/tabs/ReportsTab.tsx
+++ b/products/signals/frontend/inbox/components/tabs/ReportsTab.tsx
@@ -57,6 +57,7 @@ interface SectionListState {
pageLoadFailed: boolean
reportsResponseLoading: boolean
hasMore: boolean
+ loadedRankingPill: boolean
}
/**
@@ -74,6 +75,7 @@ function useSectionState(sectionKey: InboxReportSectionKey): SectionListState {
pageLoadFailed,
reportsResponseLoading,
hasMore,
+ loadedRankingPill,
} = useValues(reportListLogic(sectionListLogicProps(sectionKey)))
return {
count,
@@ -84,6 +86,7 @@ function useSectionState(sectionKey: InboxReportSectionKey): SectionListState {
pageLoadFailed,
reportsResponseLoading,
hasMore,
+ loadedRankingPill,
}
}
@@ -169,12 +172,14 @@ const ReportRow = memo(function ReportRow({
report,
sectionKey,
rankingSortField,
+ rankingPill,
timestampField,
hideOwnClaim,
}: {
report: SignalReport
sectionKey: InboxReportSectionKey
rankingSortField: InboxRankingSortField | null
+ rankingPill: boolean
timestampField: 'created_at' | 'updated_at'
hideOwnClaim: boolean
}): JSX.Element {
@@ -184,6 +189,7 @@ const ReportRow = memo(function ReportRow({
report={report}
selectable
rankingSortField={rankingSortField}
+ rankingPill={rankingPill}
timestampField={timestampField}
hideOwnClaim={hideOwnClaim}
onRestore={() =>
@@ -254,6 +260,9 @@ export function ReportsTab(): JSX.Element {
SignalReport[]
>
const rows = mergeReportRows(reportsBySection, selectedSections, activeSortField, activeSortDirection)
+ // Every state's request comes from one flag arm, so any loaded response can say whether to show pills.
+ const rankingPill =
+ activeSortField === 'recommended' && selectedSections.some((key) => sections[key].loadedRankingPill)
// Under a model sort the unscored rows trail the scored ones. A divider marks where they start.
const firstUnscoredIndex = rankingSortField
? rows.findIndex(({ report }) => rankingSortScore(report, rankingSortField) === null)
@@ -412,6 +421,7 @@ export function ReportsTab(): JSX.Element {
report={report}
sectionKey={sectionKey}
rankingSortField={rankingSortField}
+ rankingPill={rankingPill}
timestampField={timestampField}
hideOwnClaim={scope === INBOX_SCOPE_CLAIMED_BY_YOU}
/>
diff --git a/products/signals/frontend/inbox/components/useReportImpressions.ts b/products/signals/frontend/inbox/components/useReportImpressions.ts
index 155888a6b8d0..e19f55e3fc81 100644
--- a/products/signals/frontend/inbox/components/useReportImpressions.ts
+++ b/products/signals/frontend/inbox/components/useReportImpressions.ts
@@ -15,6 +15,7 @@ interface SectionImpressionState {
loadedQueryKey: string | null
loadedContext: ReportListRequestContext | null
loadedRanker: string | null
+ loadedRankingPill: boolean
}
function useSectionImpressionState(sectionKey: InboxReportSectionKey): SectionImpressionState {
@@ -26,6 +27,7 @@ function useSectionImpressionState(sectionKey: InboxReportSectionKey): SectionIm
loadedQueryKey,
loadedContext,
loadedRanker,
+ loadedRankingPill,
} = useValues(reportListLogic(sectionListLogicProps(sectionKey)))
return {
isLoaded,
@@ -35,6 +37,7 @@ function useSectionImpressionState(sectionKey: InboxReportSectionKey): SectionIm
loadedQueryKey,
loadedContext,
loadedRanker,
+ loadedRankingPill,
}
}
@@ -77,9 +80,14 @@ export function useReportImpressions(rows: MergedReportRow[], selectedSections:
const settled = selectedSections.every(
(key) => (sections[key].isLoaded || sections[key].reportsLoadFailed) && !sections[key].reportsResponseLoading
)
- // The ranker is in the key because `sort=recommended` keeps the same query when the server switches rankers.
+ // The ranker and pill setting are in the key because `sort=recommended` keeps the same query when the server switches arms.
const contextKey = JSON.stringify(
- selectedSections.map((key) => [key, sections[key].loadedQueryKey, sections[key].loadedRanker])
+ selectedSections.map((key) => [
+ key,
+ sections[key].loadedQueryKey,
+ sections[key].loadedRanker,
+ sections[key].loadedRankingPill,
+ ])
)
const impressedIdsRef = useRef(new Set<string>())
@@ -125,6 +133,7 @@ export function useReportImpressions(rows: MergedReportRow[], selectedSections:
sortDirection: context.sortDirection,
createdWindow: context.createdWindow,
rankerId: sections[sectionKey].loadedRanker,
+ rankingPill: sections[sectionKey].loadedRankingPill,
})
}
// `sections` is a fresh object each render; `contextKey` and `settled` already change with
diff --git a/products/signals/frontend/inbox/inboxAnalytics.test.ts b/products/signals/frontend/inbox/inboxAnalytics.test.ts
index 49ef80275209..20da39700b5e 100644
--- a/products/signals/frontend/inbox/inboxAnalytics.test.ts
+++ b/products/signals/frontend/inbox/inboxAnalytics.test.ts
@@ -4,6 +4,7 @@ import {
captureInboxQueryChanged,
captureInboxReportAction,
captureInboxReportClosed,
+ captureInboxReportOpened,
captureInboxReportScrolled,
captureInboxReportsImpressed,
captureInboxSettingsChanged,
@@ -127,7 +128,7 @@ describe('inboxAnalytics', () => {
status: 'scored',
model: 'report_embeddings@2026-09-30',
scored_at: '2026-09-30T12:00:00Z',
- predictions: [{ outcome: 'fix', probability: 0.4, lift: null, readable: true }],
+ predictions: [{ outcome: 'fix', probability: 0.4, lift: 2.5, readable: true }],
},
}),
makeReport({ id: 'b', priority: null, actionability: null, source_products: ['error_tracking'] }),
@@ -141,6 +142,7 @@ describe('inboxAnalytics', () => {
sortDirection: 'desc',
createdWindow: '7d',
rankerId: 'fix',
+ rankingPill: true,
})
const props = lastCapture(INBOX_EVENTS.REPORTS_IMPRESSED)
expect(props).toMatchObject({
@@ -152,6 +154,7 @@ describe('inboxAnalytics', () => {
sort_direction: 'desc',
created_window: '7d',
ranker_id: 'fix',
+ ranking_pill: true,
has_pr: true,
})
expect(props?.impressions).toEqual([
@@ -162,11 +165,17 @@ describe('inboxAnalytics', () => {
signal_count: 3,
is_suggested_reviewer: true,
ranking_served_key: 'report_embeddings@2026-09-30',
+ pill_shown: true,
+ pill_open: null,
+ pill_action: null,
+ pill_fix: 2.5,
}),
expect.objectContaining({
report_id: 'b',
rank: 2,
ranking_served_key: null,
+ pill_shown: false,
+ pill_fix: null,
priority: null,
actionability: null,
source_products: ['error_tracking'],
@@ -191,6 +200,57 @@ describe('inboxAnalytics', () => {
})
})
+ it('attributes a pill to opens and actions only after the pill reached the screen', () => {
+ const report = makeReport({
+ ranking: {
+ status: 'scored',
+ model: 'nn@2026-09-30',
+ scored_at: '2026-09-30T12:00:00Z',
+ predictions: [{ outcome: 'fix', probability: 0.4, lift: 2.5, readable: true }],
+ },
+ })
+ const capturedPills = (): (boolean | undefined)[] => {
+ captureInboxReportOpened({
+ report,
+ openMethod: 'click',
+ linkSource: null,
+ previousReportId: null,
+ rank: 1,
+ listSize: 1,
+ section: 'needs-decision',
+ rankerId: 'priority',
+ })
+ captureInboxReportAction({ report, actionType: 'create_pr', surface: 'detail_pane' })
+ return [
+ lastCapture(INBOX_EVENTS.REPORT_OPENED)?.pill_shown,
+ lastCapture(INBOX_EVENTS.REPORT_ACTION)?.pill_shown,
+ ]
+ }
+
+ // A deep link loads a pill arm into the hidden list, so nothing is on screen yet.
+ setInboxServedRanker('priority', true)
+ expect(capturedPills()).toEqual([false, false])
+
+ captureInboxReportsImpressed({
+ tab: 'needs-decision',
+ reports: [report],
+ ranks: [1],
+ listSize: 1,
+ totalCount: 1,
+ hasActiveFilters: false,
+ scope: 'for-you',
+ sortField: 'recommended',
+ sortDirection: 'desc',
+ createdWindow: 'all',
+ rankerId: 'priority',
+ rankingPill: true,
+ })
+ expect(capturedPills()).toEqual([true, true])
+
+ setInboxServedRanker('priority', false)
+ expect(capturedPills()).toEqual([false, false])
+ })
+
it('never attributes a Today action to the Inbox ranker', () => {
setInboxServedRanker('fix')
captureInboxReportAction({ report: makeReport(), actionType: 'discuss', surface: 'today' })
diff --git a/products/signals/frontend/inbox/inboxAnalytics.ts b/products/signals/frontend/inbox/inboxAnalytics.ts
index a226c0bac0ec..b0bb3394710d 100644
--- a/products/signals/frontend/inbox/inboxAnalytics.ts
+++ b/products/signals/frontend/inbox/inboxAnalytics.ts
@@ -15,6 +15,7 @@ import {
SignalReportPriority,
SignalRunKind,
} from './types'
+import { rankingPillLifts } from './utils/reportOrdering'
import { reportPullRequests } from './utils/reportPullRequests'
/**
@@ -318,10 +319,34 @@ function reportAgeHours(report: Pick<SignalReport, 'created_at'>): number {
// and sort changes read it, so the ranking test can join them to the ranker without each caller
// passing it. The Inbox scene clears it on unmount.
let servedInboxRankerId: string | null = null
+// The reports whose pill reached the screen, from impressions. A list response cannot answer this,
+// because the list stays mounted and hidden behind a deep-linked report and still loads a pill arm.
+const seenInboxRankingPillReportIds = new Set<string>()
-/** Record the ranker of the latest list response. Null when the sort is not Recommended. */
-export function setInboxServedRanker(rankerId: string | null): void {
+/** Record the ranker of the latest list response, null when the sort is not Recommended. A list without pills ends pill attribution. */
+export function setInboxServedRanker(rankerId: string | null, rankingPill: boolean = false): void {
servedInboxRankerId = rankerId
+ if (!rankingPill) {
+ seenInboxRankingPillReportIds.clear()
+ }
+}
+
+interface RankingPillProperties {
+ pill_shown: boolean
+ pill_open: number | null
+ pill_action: number | null
+ pill_fix: number | null
+}
+
+/** The lifts the person saw on the report's pill. A list without pills, or a stale or unscored report, shows none. */
+function rankingPillProperties(report: SignalReport, rankingPill: boolean): RankingPillProperties {
+ const lifts = rankingPill ? rankingPillLifts(report) : null
+ return {
+ pill_shown: lifts !== null,
+ pill_open: lifts?.open ?? null,
+ pill_action: lifts?.action ?? null,
+ pill_fix: lifts?.fix ?? null,
+ }
}
interface BaseReportProperties {
@@ -466,8 +491,15 @@ export function captureInboxReportsImpressed(params: {
createdWindow: string | null
/** The ranker the server used for a Recommended list. Null for other sorts. */
rankerId: string | null
+ /** Whether the Recommended list showed score pills. */
+ rankingPill: boolean
}): void {
const rankingSort = params.sortField.startsWith('ranking_')
+ if (params.rankingPill) {
+ params.reports
+ .filter((report) => rankingPillLifts(report) !== null)
+ .forEach((report) => seenInboxRankingPillReportIds.add(report.id))
+ }
captureInboxEvent(INBOX_EVENTS.REPORTS_IMPRESSED, {
tab: params.tab,
list_size: params.listSize,
@@ -478,6 +510,7 @@ export function captureInboxReportsImpressed(params: {
sort_direction: params.sortDirection,
created_window: params.createdWindow,
ranker_id: params.rankerId,
+ ranking_pill: params.rankingPill,
has_pr: params.reports.some((report) => reportPullRequests(report).length > 0),
impression_count: params.reports.length,
impressions: params.reports.map((report, index) => ({
@@ -489,6 +522,7 @@ export function captureInboxReportsImpressed(params: {
total_weight: report.total_weight,
is_suggested_reviewer: report.is_suggested_reviewer,
...(rankingSort ? { ranking_served_key: report.ranking?.model ?? null } : {}),
+ ...rankingPillProperties(report, params.rankingPill),
})),
})
}
@@ -526,6 +560,7 @@ export function captureInboxReportOpened(
list_size: params.listSize,
section: params.section,
ranker_id: params.rankerId,
+ ...rankingPillProperties(params.report, seenInboxRankingPillReportIds.has(params.report.id)),
},
options
)
@@ -571,15 +606,20 @@ export function captureInboxReportScrolled(params: {
})
}
-/** The hover card on a report's model score opened, under one of the model sorts. */
+/**
+ * The hover card on a report's model score opened. `tag` is the single-head tag under a model sort,
+ * and `pill` is the three-score pill on the Recommended sort, which has no active head.
+ */
export function captureInboxRankingDetailsViewed(params: {
report: SignalReport
- head: string
+ surface: 'tag' | 'pill'
+ head: string | null
state: 'scored' | 'stale' | 'unscored'
strength: string | null
}): void {
captureInboxEvent(INBOX_EVENTS.RANKING_DETAILS_VIEWED, {
...baseReportProperties(params.report),
+ surface: params.surface,
ranking_head: params.head,
ranking_state: params.state,
ranking_strength: params.strength,
@@ -606,6 +646,12 @@ export function captureInboxReportAction(params: {
bulk_size: params.bulkSize ?? 1,
// Today lists reports in its own order, so its actions never belong to an Inbox ranker.
ranker_id: params.surface === 'today' ? null : servedInboxRankerId,
+ ...(params.report
+ ? rankingPillProperties(
+ params.report,
+ params.surface !== 'today' && seenInboxRankingPillReportIds.has(params.report.id)
+ )
+ : {}),
...params.extra,
})
}
diff --git a/products/signals/frontend/inbox/inboxSceneLogic.ts b/products/signals/frontend/inbox/inboxSceneLogic.ts
index a39621fe90f7..dc931d3ba63b 100644
--- a/products/signals/frontend/inbox/inboxSceneLogic.ts
+++ b/products/signals/frontend/inbox/inboxSceneLogic.ts
@@ -297,10 +297,16 @@ function findReportRank(id: string): {
const idx = rows.findIndex((row) => row.report.id === id)
if (idx >= 0) {
const sectionKey = rows[idx].sectionKey
- const rankerId =
- reportListLogic.findMounted({ sectionKey, listParams: INBOX_REPORT_SECTION_LIST_PARAMS[sectionKey] })
- ?.values.loadedRanker ?? null
- return { rank: idx + 1, listSize: rows.length, section: sectionKey, rankerId }
+ const sectionValues = reportListLogic.findMounted({
+ sectionKey,
+ listParams: INBOX_REPORT_SECTION_LIST_PARAMS[sectionKey],
+ })?.values
+ return {
+ rank: idx + 1,
+ listSize: rows.length,
+ section: sectionKey,
+ rankerId: sectionValues?.loadedRanker ?? null,
+ }
}
return notFound
}
diff --git a/products/signals/frontend/inbox/logics/reportListLogic.ts b/products/signals/frontend/inbox/logics/reportListLogic.ts
index 30bb8bab187e..512bbce2dd91 100644
--- a/products/signals/frontend/inbox/logics/reportListLogic.ts
+++ b/products/signals/frontend/inbox/logics/reportListLogic.ts
@@ -72,6 +72,8 @@ export interface ReportListRequestContext {
export type ReportListResponse = CountedPaginatedResponse<SignalReport> & {
/** The ranker the server used for `sort=recommended`. Null for every other sort. */
ranker?: string | null
+ /** Whether the client shows a ranking score pill on each card, for `sort=recommended`. Null for every other sort. */
+ ranking_pill?: boolean | null
requestParams?: Record<string, unknown>
requestContext?: ReportListRequestContext
}
@@ -206,6 +208,7 @@ export interface reportListLogicValues {
loadedContext: ReportListRequestContext | null
loadedQueryKey: string | null
loadedRanker: string | null
+ loadedRankingPill: boolean
pageLoadFailed: boolean
reportSourceMeta: Record<string, ReportSourceMeta>
reports: SignalReport[]
@@ -454,6 +457,7 @@ export interface reportListLogicMeta {
loadedQueryKey: (reportsResponse: ReportListResponse | null) => string | null
loadedContext: (reportsResponse: ReportListResponse | null) => ReportListRequestContext | null
loadedRanker: (reportsResponse: ReportListResponse | null) => string | null
+ loadedRankingPill: (reportsResponse: ReportListResponse | null) => boolean
}
}
@@ -867,6 +871,11 @@ export const reportListLogic = kea<reportListLogicType>([
(s) => [s.reportsResponse],
(reportsResponse: ReportListResponse | null): string | null => reportsResponse?.ranker ?? null,
],
+ // Whether the server put this user in a Recommended arm that shows score pills on the cards.
+ loadedRankingPill: [
+ (s) => [s.reportsResponse],
+ (reportsResponse: ReportListResponse | null): boolean => reportsResponse?.ranking_pill === true,
+ ],
}),
listeners(({ actions, values, props, cache }) => ({
@@ -879,7 +888,7 @@ export const reportListLogic = kea<reportListLogicType>([
// loaders report: the first page and each appended page bring rows that need painting. An
// empty announcement matters too, because it retires the rows a narrowed filter dropped.
loadReportsSuccess: () => {
- setInboxServedRanker(values.loadedRanker)
+ setInboxServedRanker(values.loadedRanker, values.loadedRankingPill)
actions.trackReports(props.sectionKey, values.livePrReportIds)
actions.refreshReportMetrics(values.staleMetricReportIds)
// A first page or a refresh asks again for every row, because a report gains sources as
diff --git a/products/signals/frontend/inbox/utils/reportOrdering.ts b/products/signals/frontend/inbox/utils/reportOrdering.ts
index 611493846983..bea7895f6cd8 100644
--- a/products/signals/frontend/inbox/utils/reportOrdering.ts
+++ b/products/signals/frontend/inbox/utils/reportOrdering.ts
@@ -59,6 +59,25 @@ export function rankingPrediction(
return ranking?.predictions.find((prediction) => prediction.outcome === outcome)
}
+export interface RankingPillLifts {
+ open: number | null
+ action: number | null
+ fix: number | null
+}
+
+/** The lifts the Recommended pill shows, or null when the report has no current score to show. */
+export function rankingPillLifts(report: SignalReport): RankingPillLifts | null {
+ if (report.ranking?.status !== 'scored') {
+ return null
+ }
+ const lift = (outcome: string): number | null => {
+ const value = rankingPrediction(report.ranking, outcome)?.lift
+ return typeof value === 'number' && Number.isFinite(value) ? value : null
+ }
+ const lifts = { open: lift('open'), action: lift('action'), fix: lift('fix') }
+ return lifts.open === null && lifts.action === null && lifts.fix === null ? null : lifts
+}
+
/** The served probability a model sort orders by, or null when the report has no score for that outcome or the score is stale. */
export function rankingSortScore(report: SignalReport, field: InboxRankingSortField): number | null {
if (report.ranking?.status !== 'scored') {