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 the lift number on the inbox ranking pill (#120038)

posthog[bot]25f4a4dcdd7f
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index a4edfb061459..efda1c33ed7f 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -11399,9 +11399,9 @@ snapshots:
scenes-app-inbox-cards--pull-request-cards--light:
hash: v1.k794b7964.ae590c681e673d8212086b182e35482779f30819265f94e6a20a60393e7b0a35.ftv-NAH82K41FXLPP28A05xAZ1_tiogVU-p9D98d0oo
scenes-app-inbox-cards--report-card-ranking-tags--dark:
- hash: v1.k794b7964.294082f823ab2ce9f78f66e8746953db61e9223adb567a0f695fcd234b92df06.GcCaDeL0q5OBdxC6X5LATc1y6EER1pRwb4jC-CCI6j8
+ hash: v1.k794b7964.5162f6e5135b543fe1be2213da4e29c3923cfc0e424f5a09bcead942808ebb38.OZ348o95rZu8j5qYAkZZ55YhKNgwL9h1HymmwkEAPVU
scenes-app-inbox-cards--report-card-ranking-tags--light:
- hash: v1.k794b7964.8a2bda01a1685a8d2b69aa05b2ddf6b8d9164e1dc98ead1e26dbd8fadbb5e103.GnchgJgJyVKlTAgtUTqypg49s-yl7wLPRkR9a3InLyY
+ hash: v1.k794b7964.3e1956abd86c073c4bea9abef487376c119783cfd94b1884559fa65e209d01c1.60wDjXT3UgolW4cOQk1pZmqq8IRq6n9RXhR-PBa8wKQ
scenes-app-inbox-cards--report-card-states--dark:
hash: v1.k794b7964.73905a1ca2dcdf6532f4a623378a262b15b22f67bf1c3ba6d9c1a86a4a570a56.c5q0K0EVkk4mLF2OvlfGVOkTxhTpmLUcpvoQiPT_-mE
scenes-app-inbox-cards--report-card-states--light:
diff --git a/products/signals/frontend/inbox/components/cards/InboxCards.stories.tsx b/products/signals/frontend/inbox/components/cards/InboxCards.stories.tsx
index 82bc97c59080..d18ce593d6d8 100644
--- a/products/signals/frontend/inbox/components/cards/InboxCards.stories.tsx
+++ b/products/signals/frontend/inbox/components/cards/InboxCards.stories.tsx
@@ -267,7 +267,7 @@ const RANKING = {
stale: false,
}
-// Under the Engage sort: a lift, a probability with no lift, an unscored report, and a report edited after scoring.
+// Under the Engage sort: a lift above 1x, a lift below 1x, a probability with no lift, an unscored report, and a report edited after scoring.
const rankedReports: SignalReport[] = [
makeReport({
title: 'Checkout button does nothing on Safari',
@@ -279,6 +279,12 @@ const rankedReports: SignalReport[] = [
lifts: { open: 0.6, action: 2.1, fixed: 6.0, pr_merged: 2.6 },
},
}),
+ makeReport({
+ title: 'Tooltip flickers on the funnel chart',
+ priority: 'P3',
+ source_products: ['session_replay'],
+ ranking: { ...RANKING, scores: { action: 0.21 }, lifts: { action: 0.6 } },
+ }),
makeReport({
title: 'Slow dashboard load for large projects',
priority: 'P2',
@@ -302,7 +308,7 @@ export const ReportCardRankingTags: Story = {
</CardList>
),
play: async ({ canvas }) => {
- await userEvent.hover(await canvas.findByText('Very likely'))
+ await userEvent.hover(await canvas.findByText('2.1x more likely'))
},
}
diff --git a/products/signals/frontend/inbox/components/cards/ReportCard.test.tsx b/products/signals/frontend/inbox/components/cards/ReportCard.test.tsx
index 0c1fe3f0b9d8..45cce11a644c 100644
--- a/products/signals/frontend/inbox/components/cards/ReportCard.test.tsx
+++ b/products/signals/frontend/inbox/components/cards/ReportCard.test.tsx
@@ -422,7 +422,7 @@ describe('ReportCard', () => {
})
it.each([
- ['with the impact column', true, 'ranking_fixed', 'Very likely'],
+ ['with the impact column', true, 'ranking_fixed', '2.7x more likely'],
[
'without the impact column, falling back to the probability for a head with no lift',
false,
@@ -477,7 +477,7 @@ describe('ReportCard', () => {
})
rerender(<ReportCard report={stale} rankingSortField="ranking_fixed" />)
expect(screen.getByText('Score out of date')).toBeInTheDocument()
- expect(screen.queryByText('Very likely')).not.toBeInTheDocument()
+ expect(screen.queryByText('2.7x more likely')).not.toBeInTheDocument()
rerender(<ReportCard report={makeReport('r-2')} />)
expect(screen.queryByText('Not scored yet')).not.toBeInTheDocument()
diff --git a/products/signals/frontend/inbox/components/cards/ReportCardRankingTag.tsx b/products/signals/frontend/inbox/components/cards/ReportCardRankingTag.tsx
index d6e6603e658f..bbd05b19f981 100644
--- a/products/signals/frontend/inbox/components/cards/ReportCardRankingTag.tsx
+++ b/products/signals/frontend/inbox/components/cards/ReportCardRankingTag.tsx
@@ -9,6 +9,7 @@ import type { InboxRankingSortField } from '../../logics/inboxFiltersLogic'
import { SignalReport } from '../../types'
import {
formatRankingLift,
+ formatRankingLiftComparison,
formatRankingProbability,
RANKING_STRENGTH_LABELS,
RankingStrength,
@@ -152,15 +153,20 @@ export function ReportCardRankingTag({
)
}
return (
- <Tooltip title={<RankingHoverCard ranking={ranking} active={score} />} onOpen={onOpen}>
+ <Tooltip title={<RankingHoverCard ranking={ranking} active={score} />} onOpen={onOpen} openOnClick>
<LemonTag
size="small"
type={strength ? STRENGTH_TAG_TYPES[strength] : 'default'}
className="cursor-help tabular-nums"
data-attr="inbox-ranking-tag"
+ // The card is a link. A tap on the pill opens the details instead of the report.
+ onClick={(event) => {
+ event.preventDefault()
+ event.stopPropagation()
+ }}
>
- {strength
- ? RANKING_STRENGTH_LABELS[strength]
+ {lift !== null
+ ? formatRankingLiftComparison(lift)
: `${formatRankingProbability(probability ?? 0)} ${score.tagLabel}`}
</LemonTag>
</Tooltip>
diff --git a/products/signals/frontend/inbox/components/cards/rankingFormat.test.ts b/products/signals/frontend/inbox/components/cards/rankingFormat.test.ts
index e63a6d3778d8..918ea161e7f3 100644
--- a/products/signals/frontend/inbox/components/cards/rankingFormat.test.ts
+++ b/products/signals/frontend/inbox/components/cards/rankingFormat.test.ts
@@ -1,4 +1,10 @@
-import { formatRankingLift, rankingLiftBarFill, rankingLiftBarPercent, rankingStrength } from './rankingFormat'
+import {
+ formatRankingLift,
+ formatRankingLiftComparison,
+ rankingLiftBarFill,
+ rankingLiftBarPercent,
+ rankingStrength,
+} from './rankingFormat'
describe('rankingFormat', () => {
test.each([
@@ -12,6 +18,17 @@ describe('rankingFormat', () => {
expect(formatRankingLift(lift)).toBe(expected)
})
+ test.each([
+ [2.4, '2.4x more likely'],
+ [1.06, '1.1x more likely'],
+ [1.04, '1.0x as likely'],
+ [0.96, '1.0x as likely'],
+ [0.6, '0.6x as likely'],
+ [12.4, '12x more likely'],
+ ])('labels a lift of %s on the pill as %s', (lift, expected) => {
+ expect(formatRankingLiftComparison(lift)).toBe(expected)
+ })
+
test.each([
[0, 0],
[0.05, 0],
diff --git a/products/signals/frontend/inbox/components/cards/rankingFormat.ts b/products/signals/frontend/inbox/components/cards/rankingFormat.ts
index a2ee1890fdb5..cbeb2c83e27b 100644
--- a/products/signals/frontend/inbox/components/cards/rankingFormat.ts
+++ b/products/signals/frontend/inbox/components/cards/rankingFormat.ts
@@ -11,6 +11,12 @@ export function formatRankingLift(lift: number): string {
return oneDecimal >= 10 ? `${Math.round(lift)}x` : `${oneDecimal.toFixed(1)}x`
}
+/** The card pill text. The split uses the rounded lift, so a pill never reads "1.0x more likely". */
+export function formatRankingLiftComparison(lift: number): string {
+ const formatted = formatRankingLift(lift)
+ return parseFloat(formatted) > 1 ? `${formatted} more likely` : `${formatted} as likely`
+}
+
/**
* Bar position in percent for a lift on a log scale. 1x sits at 50%, and the bar clamps at 0.1x and 10x,
* so a lift and its inverse sit at equal distances from the center.