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.

fix(signals): stop the inbox onboarding sample card 404ing (#80075)

posthog[bot]bd3092c1ca0c
diff --git a/products/signals/frontend/inbox/InboxScene.tsx b/products/signals/frontend/inbox/InboxScene.tsx
index 9f226206517d..0592919f4c18 100644
--- a/products/signals/frontend/inbox/InboxScene.tsx
+++ b/products/signals/frontend/inbox/InboxScene.tsx
@@ -1,4 +1,5 @@
import { useActions, useValues } from 'kea'
+import { router } from 'kea-router'
import React, { useEffect, useRef } from 'react'
import { IconArrowLeft, IconBug } from '@posthog/icons'
@@ -7,6 +8,7 @@ import { LemonButton, Tooltip } from '@posthog/lemon-ui'
import { useResizeBreakpoints } from 'lib/hooks/useResizeObserver'
import { preflightLogic } from 'scenes/PreflightCheck/preflightLogic'
import { SceneExport } from 'scenes/sceneTypes'
+import { urls } from 'scenes/urls'
import { SceneContent } from '~/layout/scenes/components/SceneContent'
import { SceneTitleSection } from '~/layout/scenes/components/SceneTitleSection'
@@ -232,6 +234,13 @@ export function InboxScene(): JSX.Element {
const { runSessionAnalysis, setScratchpadOpen, setFindingsOpen } = useActions(inboxSceneLogic)
const { onboardingMode } = useValues(inboxOnboardingLogic)
const { isDev } = useValues(preflightLogic)
+ const { searchParams } = useValues(router)
+
+ // Surfaces that embed inbox cards (e.g. the customer analytics feed) set a `?back=` internal path;
+ // send the not-found state back there rather than the inbox, mirroring `InboxDetailFrame`.
+ const rawBack = searchParams.back
+ const backOverride =
+ typeof rawBack === 'string' && rawBack.startsWith('/') && !rawBack.startsWith('//') ? rawBack : null
// Detail routes (report or scout) render full-width over the list (desktop parity), but the list view
// stays *mounted* (just hidden) rather than being unmounted. That keeps `reportListLogic` and the scroll
@@ -312,8 +321,16 @@ export function InboxScene(): JSX.Element {
<ReportDetailSkeleton />
</div>
) : (
- <div className="flex flex-1 items-center justify-center text-sm text-tertiary">
- Report not found.
+ <div className="flex flex-1 flex-col items-center justify-center gap-3 text-center">
+ <div>
+ <h3 className="m-0 text-base font-semibold">Report not found</h3>
+ <p className="m-0 mt-1 text-sm text-tertiary">
+ This report does not exist. It may have been removed.
+ </p>
+ </div>
+ <LemonButton type="secondary" to={backOverride ?? urls.inbox(activeTab)}>
+ {backOverride ? 'Back' : 'Back to inbox'}
+ </LemonButton>
</div>
)}
</div>
diff --git a/products/signals/frontend/inbox/components/cards/ReportCard.test.tsx b/products/signals/frontend/inbox/components/cards/ReportCard.test.tsx
new file mode 100644
index 000000000000..e127fcb26137
--- /dev/null
+++ b/products/signals/frontend/inbox/components/cards/ReportCard.test.tsx
@@ -0,0 +1,54 @@
+import '@testing-library/jest-dom'
+
+import { cleanup, render } from '@testing-library/react'
+
+import { SignalReport, SignalReportStatus } from '../../types'
+import { ReportCard } from './ReportCard'
+
+jest.mock('lib/components/TZLabel', () => ({
+ TZLabel: ({ time }: { time: string }) => <span>{time}</span>,
+}))
+
+function makeReport(overrides: Partial<SignalReport> = {}): SignalReport {
+ return {
+ id: 'report-1',
+ title: 'Hooli traffic is hammering the beta',
+ summary: 'Sign-ups from Hooli IP ranges jumped overnight.',
+ status: SignalReportStatus.READY,
+ total_weight: 0,
+ signal_count: 1,
+ relevant_user_count: null,
+ artefact_count: 0,
+ is_suggested_reviewer: false,
+ priority: 'P2',
+ source_products: ['error_tracking'],
+ created_at: '2026-06-11T10:00:00Z',
+ updated_at: '2026-06-11T10:00:00Z',
+ ...overrides,
+ } as SignalReport
+}
+
+describe('ReportCard', () => {
+ afterEach(cleanup)
+
+ it('links the card to the report detail by default', () => {
+ const { container } = render(<ReportCard report={makeReport()} />)
+ expect(container.querySelector('a')).toHaveAttribute('href', expect.stringContaining('report-1'))
+ })
+
+ it('exposes no routable link in preview mode (the placeholder id 404s)', () => {
+ const { container, getByText } = render(<ReportCard report={makeReport()} preview />)
+ // Card still renders, but nothing navigates to the detail route.
+ expect(getByText('Hooli traffic is hammering the beta')).toBeInTheDocument()
+ expect(container.querySelector('a')).toBeNull()
+ })
+
+ it('exposes no link on a preview PR card either (the PR badge url is fabricated)', () => {
+ const report = makeReport({
+ title: 'fix(compression): stop 4K streams dropping to single-threaded encode',
+ implementation_pr_url: 'https://github.com/PiedPiper/pipernet/pull/486',
+ })
+ const { container } = render(<ReportCard report={report} preview />)
+ expect(container.querySelector('a')).toBeNull()
+ })
+})
diff --git a/products/signals/frontend/inbox/components/cards/ReportCard.tsx b/products/signals/frontend/inbox/components/cards/ReportCard.tsx
index adf6ffa71261..6cdcb5dc124b 100644
--- a/products/signals/frontend/inbox/components/cards/ReportCard.tsx
+++ b/products/signals/frontend/inbox/components/cards/ReportCard.tsx
@@ -100,6 +100,7 @@ export function ReportCard({
onArchive,
onRestore,
backUrl,
+ preview = false,
}: {
report: SignalReport
tabKey?: InboxFlatListTabKey
@@ -108,6 +109,9 @@ export function ReportCard({
onRestore?: () => void
/** Internal path the detail view's back button should return to, for cards rendered outside the inbox. */
backUrl?: string
+ /** Onboarding sample: render as a static card with no detail link and no focusable actions, so its
+ * placeholder report id can never be opened (it 404s). */
+ preview?: boolean
}): JSX.Element {
const isArchived = tabKey === 'archived'
// Resolved reports are terminal (their implementation PR merged) – shown for reference in the
@@ -160,95 +164,108 @@ export function ReportCard({
!!dismissalLabel ||
showBillingBadge
- return (
- <div className={clsx('relative', inboxCardRowClassName(attached, { dashed: !hasPr }))}>
- {hasPr && prNumber != null ? (
- <div className="absolute right-4 top-3 z-10">
- <PrBadge
- prNumber={prNumber}
- prUrl={prUrl}
- state={derivePrState(report.status, report.implementation_pr_merged === true)}
- />
+ const cardBodyClassName = 'flex min-w-0 flex-1 items-start gap-3 text-left text-inherit no-underline'
+ const cardBody = (
+ <>
+ {report.priority && (
+ <div className="shrink-0">
+ <SignalReportPriorityBadge priority={report.priority} />
</div>
- ) : null}
+ )}
- <Link to={detailUrl} className="flex min-w-0 flex-1 items-start gap-3 text-left text-inherit no-underline">
- {report.priority && (
- <div className="shrink-0">
- <SignalReportPriorityBadge priority={report.priority} />
- </div>
- )}
+ <div className="flex flex-col gap-1.5 min-w-0 flex-1">
+ {/* Pad clear of the absolute PR badge on mobile, where the title spans the full card width. */}
+ <div
+ className={clsx(
+ 'min-w-0 break-words font-semibold text-sm leading-snug text-balance',
+ hasPr && 'pr-14 @lg:pr-0'
+ )}
+ >
+ {conventionalTitle && (
+ <ConventionalCommitScopeTag type={conventionalTitle.type} scope={conventionalTitle.scope} />
+ )}
+ {cardTitle}
+ </div>
- <div className="flex flex-col gap-1.5 min-w-0 flex-1">
- {/* Pad clear of the absolute PR badge on mobile, where the title spans the full card width. */}
- <div
+ {headline ? (
+ <p
className={clsx(
- 'min-w-0 break-words font-semibold text-sm leading-snug text-balance',
- hasPr && 'pr-14 @lg:pr-0'
+ 'min-w-0',
+ !hasPr && !isReady && 'opacity-80',
+ 'break-words line-clamp-2 text-xs text-secondary leading-snug m-0'
)}
>
- {conventionalTitle && (
- <ConventionalCommitScopeTag type={conventionalTitle.type} scope={conventionalTitle.scope} />
+ {headline}
+ </p>
+ ) : !hasPr ? (
+ <p
+ className={clsx(
+ 'min-w-0',
+ !isReady && 'opacity-80',
+ 'break-words line-clamp-2 text-xs text-tertiary italic leading-snug m-0'
)}
- {cardTitle}
- </div>
-
- {headline ? (
- <p
- className={clsx(
- 'min-w-0',
- !hasPr && !isReady && 'opacity-80',
- 'break-words line-clamp-2 text-xs text-secondary leading-snug m-0'
- )}
- >
- {headline}
- </p>
- ) : !hasPr ? (
- <p
- className={clsx(
- 'min-w-0',
- !isReady && 'opacity-80',
- 'break-words line-clamp-2 text-xs text-tertiary italic leading-snug m-0'
- )}
- >
- No summary yet. Still collecting context.
- </p>
- ) : null}
-
- {showMeta ? (
- <div className="flex items-center flex-wrap mt-1.5 min-w-0 gap-2.5 text-xs text-tertiary leading-none select-none">
- {hasPr && repoSlug ? <span className="truncate font-mono">{repoSlug}</span> : null}
- <InboxCardSourceMeta
- sourceProducts={report.source_products}
- scoutSkillName={report.scout_name}
- />
- {!hasPr && (!isReady || !report.actionability) && (
- <SignalReportStatusBadge status={report.status} />
- )}
- {!hasPr && report.actionability && (
- <SignalReportActionabilityBadge actionability={report.actionability} />
- )}
- {dismissalLabel && (
- <Tooltip title={report.dismissal_note || undefined}>
- <LemonTag size="small" icon={<IconArchive />}>
- {dismissalLabel}
- </LemonTag>
- </Tooltip>
- )}
- <SignalReportBillingBadge report={report} />
- </div>
- ) : null}
+ >
+ No summary yet. Still collecting context.
+ </p>
+ ) : null}
- {/* In flow on mobile (the card stacks); pinned to the card's bottom-right corner on desktop. */}
- <div className="mt-0.5 @lg:absolute @lg:right-4 @lg:bottom-3 @lg:z-10 @lg:mt-0">
- <TZLabel
- time={report.updated_at ?? report.created_at}
- className="text-xs text-tertiary tabular-nums"
- title="Last updated"
+ {showMeta ? (
+ <div className="flex items-center flex-wrap mt-1.5 min-w-0 gap-2.5 text-xs text-tertiary leading-none select-none">
+ {hasPr && repoSlug ? <span className="truncate font-mono">{repoSlug}</span> : null}
+ <InboxCardSourceMeta
+ sourceProducts={report.source_products}
+ scoutSkillName={report.scout_name}
/>
+ {!hasPr && (!isReady || !report.actionability) && (
+ <SignalReportStatusBadge status={report.status} />
+ )}
+ {!hasPr && report.actionability && (
+ <SignalReportActionabilityBadge actionability={report.actionability} />
+ )}
+ {dismissalLabel && (
+ <Tooltip title={report.dismissal_note || undefined}>
+ <LemonTag size="small" icon={<IconArchive />}>
+ {dismissalLabel}
+ </LemonTag>
+ </Tooltip>
+ )}
+ <SignalReportBillingBadge report={report} />
</div>
+ ) : null}
+
+ {/* In flow on mobile (the card stacks); pinned to the card's bottom-right corner on desktop. */}
+ <div className="mt-0.5 @lg:absolute @lg:right-4 @lg:bottom-3 @lg:z-10 @lg:mt-0">
+ <TZLabel
+ time={report.updated_at ?? report.created_at}
+ className="text-xs text-tertiary tabular-nums"
+ title="Last updated"
+ />
+ </div>
+ </div>
+ </>
+ )
+
+ return (
+ <div className={clsx('relative', inboxCardRowClassName(attached, { dashed: !hasPr }))}>
+ {hasPr && prNumber != null ? (
+ <div className="absolute right-4 top-3 z-10">
+ <PrBadge
+ prNumber={prNumber}
+ // No link in preview mode: the sample PR url is fabricated, and a link would
+ // stay keyboard-focusable inside the otherwise non-routable card.
+ prUrl={preview ? null : prUrl}
+ state={derivePrState(report.status, report.implementation_pr_merged === true)}
+ />
</div>
- </Link>
+ ) : null}
+
+ {preview ? (
+ <div className={cardBodyClassName}>{cardBody}</div>
+ ) : (
+ <Link to={detailUrl} className={cardBodyClassName}>
+ {cardBody}
+ </Link>
+ )}
{/* Refund deliberately isn't offered at the card level – it lives in the report detail
pane, where the consequences are in view. Resolved reports are terminal and a refunded
@@ -283,7 +300,8 @@ export function ReportCard({
tooltip="Archive this report"
aria-label="Archive this report"
loading={isArchiving}
- onClick={onArchiveClick}
+ onClick={preview ? undefined : onArchiveClick}
+ tabIndex={preview ? -1 : undefined}
>
Archive
</LemonButton>
@@ -291,11 +309,16 @@ export function ReportCard({
type="primary"
size="small"
tooltip="Open the full report to see its summary, evidence, and actions"
- onClick={(event) => {
- event.preventDefault()
- event.stopPropagation()
- router.actions.push(detailUrl)
- }}
+ onClick={
+ preview
+ ? undefined
+ : (event) => {
+ event.preventDefault()
+ event.stopPropagation()
+ router.actions.push(detailUrl)
+ }
+ }
+ tabIndex={preview ? -1 : undefined}
>
Review
</LemonButton>
diff --git a/products/signals/frontend/inbox/components/onboarding/InboxOnboardingPreviews.tsx b/products/signals/frontend/inbox/components/onboarding/InboxOnboardingPreviews.tsx
index c6e66dd7b12b..337fd0a1b541 100644
--- a/products/signals/frontend/inbox/components/onboarding/InboxOnboardingPreviews.tsx
+++ b/products/signals/frontend/inbox/components/onboarding/InboxOnboardingPreviews.tsx
@@ -70,9 +70,11 @@ function PreviewCard({ report, tabKey }: { report: SignalReport; tabKey: 'pulls'
// `@container` so ReportCard's `@lg:` row layout resolves against the preview width (it has no
// inbox-list container here). `role="presentation"` – the whole thing is decorative.
<div role="presentation" className="@container relative">
- {/* The real card, kept inert: no navigation, no hover affordances, not focusable. */}
+ {/* The real card in preview mode: no detail link, no focusable actions. That keeps the
+ sample report id (which 404s) out of reach – nobody can click or tab into it – on top
+ of the `pointer-events-none` and overlay below. */}
<div aria-hidden className="pointer-events-none">
- <ReportCard report={report} tabKey={tabKey} />
+ <ReportCard report={report} tabKey={tabKey} preview />
</div>
{/* Always-visible label so the sample reads as a sample, not live work. Sits on the top
diff --git a/products/signals/frontend/inbox/inboxSceneLogic.ts b/products/signals/frontend/inbox/inboxSceneLogic.ts
index e70cf9aaee5a..3399be5262df 100644
--- a/products/signals/frontend/inbox/inboxSceneLogic.ts
+++ b/products/signals/frontend/inbox/inboxSceneLogic.ts
@@ -5,6 +5,7 @@ import { actionToUrl, router, urlToAction } from 'kea-router'
import { lemonToast } from '@posthog/lemon-ui'
import api from 'lib/api'
+import { ApiError } from 'lib/api-error'
import { sceneConfigurations } from 'scenes/scenes'
import { Scene } from 'scenes/sceneTypes'
import { teamLogic } from 'scenes/teamLogic'
@@ -264,12 +265,12 @@ export interface inboxSceneLogicActions {
errorObject?: any
}
loadSelectedReportSuccess: (
- selectedReportResponse: SignalReport,
+ selectedReportResponse: SignalReport | null,
payload?: {
id: string
}
) => {
- selectedReportResponse: SignalReport
+ selectedReportResponse: SignalReport | null
payload?: {
id: string
}
@@ -414,8 +415,24 @@ export const inboxSceneLogic = kea<inboxSceneLogicType>([
selectedReportResponse: [
null as SignalReport | null,
{
- loadSelectedReport: async ({ id }: { id: string }) => {
- return await api.signalReports.get(id)
+ loadSelectedReport: async ({ id }: { id: string }, breakpoint) => {
+ try {
+ const report = await api.signalReports.get(id)
+ breakpoint()
+ return report
+ } catch (error) {
+ // Discard a superseded load so a slow response for a report the user already
+ // navigated away from can't overwrite the current one (e.g. a stale 404
+ // blanking a valid report that resolved first).
+ breakpoint()
+ // An unresolvable id (a stale deep link, or the onboarding sample card) 404s.
+ // Return null so the scene shows a "not found" empty state instead of the
+ // global raw error toast. Let every other failure surface as before.
+ if (error instanceof ApiError && error.status === 404) {
+ return null
+ }
+ throw error
+ }
},
},
],