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(today): show resolved and dismissed items, progress, and a hover card (#110214)

Vojta Bartoš7e2e6eb49f99
diff --git a/frontend/src/layout/today/TodayPreviewCardProvider.tsx b/frontend/src/layout/today/TodayPreviewCardProvider.tsx
index 4f0ded0ba886..7e692d81e43c 100644
--- a/frontend/src/layout/today/TodayPreviewCardProvider.tsx
+++ b/frontend/src/layout/today/TodayPreviewCardProvider.tsx
@@ -4,6 +4,8 @@ import { ReactNode, useCallback, useMemo, useRef, useState } from 'react'
import { Card } from '@posthog/quill'
+import { TodayReportHoverCard } from 'scenes/project-homepage/today/TodayReportHoverCard'
+
import { TodayChatHoverCard } from './TodayChatHoverCard'
import { TodayPreviewCard, TodayPreviewCardContext } from './todayPreviewCardContext'
import { TodayPreviewPayload } from './todayPreviewCards'
@@ -12,6 +14,14 @@ import { todaySessionMenuLogic } from './todaySessionMenuLogic'
import { todaySessionSelectionLogic } from './todaySessionSelectionLogic'
import { TodaySpaceHoverCard } from './TodaySpaceHoverCard'
+/** Beside a row, centered on it, so the path to a tall card is short from any row. Under a link in the
+ * briefing text instead, so the card does not cover the line. */
+function placement(payload: TodayPreviewPayload): Pick<PreviewCard.Positioner.Props, 'side' | 'align' | 'sideOffset'> {
+ return payload.kind === 'report' && payload.surface === 'briefing'
+ ? { side: 'bottom', align: 'start', sideOffset: 6 }
+ : { side: 'right', align: 'center', sideOffset: 10 }
+}
+
/**
* One hover card for every row in the sidebar, like PostHog Desktop. The rows are only triggers on a shared handle,
* and Base UI skips the open delay when the pointer moves to another trigger of an open card,
@@ -56,13 +66,12 @@ export function TodayPreviewCardProvider({ children }: { children: ReactNode }):
{({ payload }) =>
payload ? (
<PreviewCard.Portal>
- {/* Centered on the row, so the path to a tall card is short from any row. */}
<PreviewCard.Positioner
data-quill
data-quill-portal="popover"
- side="right"
- align="center"
- sideOffset={10}
+ // Quill's portal rule reads this token and wins over a z-index utility class.
+ className="[--quill-z-popover:var(--z-popover-with-chart)]"
+ {...placement(payload)}
>
{/* Inside the popup, not its `render`: on React 18 quill's Card takes no ref. */}
<PreviewCard.Popup className="outline-none">
@@ -71,6 +80,8 @@ export function TodayPreviewCardProvider({ children }: { children: ReactNode }):
<TodaySpaceHoverCard preview={payload} onAction={close} />
) : payload.kind === 'chat' ? (
<TodayChatHoverCard preview={payload} onAction={close} />
+ ) : payload.kind === 'report' ? (
+ <TodayReportHoverCard preview={payload} />
) : (
<TodaySessionHoverCard
// Keyed on the row, so moving to another row unmounts the card and lowers the submenu flag.
diff --git a/frontend/src/layout/today/TodayPreviewTrigger.tsx b/frontend/src/layout/today/TodayPreviewTrigger.tsx
index 33325c3501f4..de35b4f09c4b 100644
--- a/frontend/src/layout/today/TodayPreviewTrigger.tsx
+++ b/frontend/src/layout/today/TodayPreviewTrigger.tsx
@@ -14,9 +14,12 @@ const CLOSE_DELAY_MS = 100
*/
export function TodayPreviewTrigger({
payload,
+ inline = false,
children,
}: {
payload: TodayPreviewPayload
+ /** Wraps a link inside running text, so the trigger must not break the line. */
+ inline?: boolean
children: ReactNode
}): JSX.Element {
const card = useContext(TodayPreviewCardContext)
@@ -29,7 +32,7 @@ export function TodayPreviewTrigger({
payload={payload}
delay={OPEN_DELAY_MS}
closeDelay={CLOSE_DELAY_MS}
- render={<div className="min-w-0" />}
+ render={inline ? <span /> : <div className="min-w-0" />}
>
{children}
</PreviewCard.Trigger>
diff --git a/frontend/src/layout/today/TodayShell.tsx b/frontend/src/layout/today/TodayShell.tsx
index 8c16f2599ab7..9148d6613abc 100644
--- a/frontend/src/layout/today/TodayShell.tsx
+++ b/frontend/src/layout/today/TodayShell.tsx
@@ -67,7 +67,9 @@ export function TodayShell({ className }: { className?: string }): JSX.Element {
const pane = (
<div className="TodayShell__pane">
{activePane === 'home' ? (
- <TodayHomeSidebar />
+ <TodayPreviewCardProvider>
+ <TodayHomeSidebar />
+ </TodayPreviewCardProvider>
) : activePane === 'spaces' ? (
<TodayPreviewCardProvider>
<TodaySpacesSidebar />
diff --git a/frontend/src/layout/today/todayPreviewCards.ts b/frontend/src/layout/today/todayPreviewCards.ts
index f68bbf49cd0b..1ad216edfac1 100644
--- a/frontend/src/layout/today/todayPreviewCards.ts
+++ b/frontend/src/layout/today/todayPreviewCards.ts
@@ -1,4 +1,5 @@
import { getOriginProductMeta } from 'products/posthog_ai/frontend/api/taskSource'
+import type { ReportChartApi, ReportMetricApi } from 'products/signals/frontend/generated/api.schemas'
import { ChannelDTOApi, PrStateEnumApi, TaskUserBasicInfoApi } from 'products/tasks/frontend/generated/api.schemas'
import { SpacePresence } from 'products/tasks/frontend/spaces/spacePresence'
import { TaskPullRequest } from 'products/tasks/frontend/spaces/taskPullRequests'
@@ -58,7 +59,37 @@ export interface TodayChatPreview {
timestamp: string | null
}
-export type TodayPreviewPayload = TodaySessionPreview | TodaySpacePreview | TodayChatPreview
+/** What a report's hover card says, read from a personal briefing item or from one of the team's reports. */
+export interface TodayReportCard {
+ /** Stable per report and list. It keys the card's live metric queries and its analytics. */
+ key: string
+ title: string
+ /** Why the briefing picked the report. Null for the team's reports, which no briefing picked. */
+ reason: string | null
+ /** Resolved or dismissed since the briefing, or null while open. */
+ stateLabel: string | null
+ resolved: boolean
+ priority: string | null
+ summary: string | null
+ pullRequestState: PrStateEnumApi | null
+ pullRequestUrl: string | null
+ signalCount: number | null
+ updatedAt: string | null
+ metrics: ReportMetricApi[]
+ /** Charts from the report body. The card draws one when no metric has a chart. */
+ charts: ReportChartApi[]
+ sourceLabel: string
+}
+
+/** A report's hover card. The card text comes with the page, so it opens without a request. */
+export interface TodayReportPreview {
+ kind: 'report'
+ card: TodayReportCard
+ /** Where the card opened: a link in the briefing text, or a left-bar row. */
+ surface: 'briefing' | 'sidebar'
+}
+
+export type TodayPreviewPayload = TodaySessionPreview | TodaySpacePreview | TodayChatPreview | TodayReportPreview
export function spaceKind(space: Pick<ChannelDTOApi, 'channel_type' | 'system_role'>): TodaySpaceKind {
if (space.system_role === 'personal' || space.channel_type === 'personal') {
diff --git a/frontend/src/scenes/project-homepage/today/Today.scss b/frontend/src/scenes/project-homepage/today/Today.scss
index 6b093e744c15..2dc7637c79b2 100644
--- a/frontend/src/scenes/project-homepage/today/Today.scss
+++ b/frontend/src/scenes/project-homepage/today/Today.scss
@@ -175,11 +175,17 @@
color: var(--today-body-text);
}
-.TodayNavItem[data-done='true'] .TodayNavItem__title,
-.TodayReportLink[data-done='true'] {
+.TodayNavItem[data-state='done'] .TodayNavItem__title,
+.TodayReportLink[data-state='done'] {
text-decoration: line-through;
}
+// Dismissed is not done: it stays readable, only quieter, and the left bar says why.
+.TodayNavItem[data-state='dismissed'] .TodayNavItem__copy,
+.TodayReportLink[data-state='dismissed'] {
+ opacity: 0.55;
+}
+
.TodayNavItem__meta {
margin-top: 3px;
font-size: 11px;
@@ -380,6 +386,12 @@
}
}
+.TodayHome__progress {
+ font-size: 13px;
+ font-variant-numeric: tabular-nums;
+ color: var(--today-faint);
+}
+
.TodayHome__foot {
margin-top: 48px;
diff --git a/frontend/src/scenes/project-homepage/today/Today.stories.tsx b/frontend/src/scenes/project-homepage/today/Today.stories.tsx
index 223a4ae6a0ee..e7d45a75d1de 100644
--- a/frontend/src/scenes/project-homepage/today/Today.stories.tsx
+++ b/frontend/src/scenes/project-homepage/today/Today.stories.tsx
@@ -7,6 +7,8 @@ import { Card } from '@posthog/quill'
import { FEATURE_FLAGS } from 'lib/constants'
import { App } from 'scenes/App'
+import { briefingItemReportCard } from 'scenes/project-homepage/today/todayBriefingItems'
+import { TodayReportHoverCard } from 'scenes/project-homepage/today/TodayReportHoverCard'
import { urls } from 'scenes/urls'
import { todayListAppearanceLogic } from '~/layout/today/todayListAppearanceLogic'
@@ -21,7 +23,10 @@ import { mswDecorator } from '~/mocks/browser'
import { EMPTY_PAGINATED_RESPONSE } from '~/mocks/handlers'
import { makeReport, mockSignals } from 'products/signals/frontend/inbox/__mocks__/inboxMocks'
-import { reportMetricQueryHandler } from 'products/signals/frontend/inbox/__mocks__/reportMetricMocks'
+import {
+ reportMetricQueryHandler,
+ reportMetricsFixture,
+} from 'products/signals/frontend/inbox/__mocks__/reportMetricMocks'
import { SignalReportStatus } from 'products/signals/frontend/inbox/types'
import { ChannelDTOApi, TaskListItemApi } from 'products/tasks/frontend/generated/api.schemas'
import type { BriefingApi, BriefingItemApi } from 'products/today/frontend/generated/api.schemas'
@@ -282,6 +287,7 @@ const REPORTS = [
title: 'Signup form rejects plus-addressed emails',
summary:
'Sign-ups with a plus sign in the email address fail validation since the last release.\n\n## Impact\n\nNew teams that use plus addressing cannot finish signing up.',
+ summary_lead: 'Sign-ups with a plus sign in the email address fail validation since the last release.',
status: SignalReportStatus.READY,
signal_count: 12,
updated_at: '2026-09-28T07:00:00Z',
@@ -294,6 +300,7 @@ const REPORTS = [
id: 'report-2',
title: 'Pricing page visitors drop off at the plan table',
summary: 'Most visitors who reach the plan table leave without starting a trial.',
+ summary_lead: 'Most visitors who reach the plan table leave without starting a trial.',
status: SignalReportStatus.READY,
signal_count: 5,
updated_at: '2026-09-27T16:00:00Z',
@@ -309,6 +316,7 @@ const REPORTS = [
id: 'report-3',
title: 'LLM costs doubled for the summarize tool',
summary: 'Token usage for the summarize tool doubled after the prompt change.',
+ summary_lead: 'Token usage for the summarize tool doubled after the prompt change.',
status: SignalReportStatus.PENDING_INPUT,
signal_count: 3,
updated_at: '2026-09-27T10:00:00Z',
@@ -321,6 +329,8 @@ const REPORTS = [
title: 'Checkout conversion fell after the address form change',
summary:
'Fewer people finish checkout since the address form gained a required phone field.\n\n[Checkout conversion](chart:checkout-conversion)\n\nThe drop is sharpest on mobile, where the field is hard to fill.',
+ summary_lead:
+ 'Fewer people finish checkout since the address form gained a required phone field. The drop is sharpest on mobile, where the field is hard to fill.',
status: SignalReportStatus.READY,
signal_count: 4,
updated_at: '2026-09-28T08:00:00Z',
@@ -367,6 +377,7 @@ function briefingItem(overrides: Partial<BriefingItemApi> & Pick<BriefingItemApi
reason: 'waiting_for_you',
state: 'open',
source_product: null,
+ report: null,
...overrides,
}
}
@@ -400,6 +411,41 @@ const PERSONAL_BRIEFING: BriefingApi = {
signal: 'P1, fix ready for review',
rank: 1,
source_product: 'error_tracking',
+ title: 'Signup form rejects plus-addressed emails',
+ report: {
+ priority: 'P1',
+ summary:
+ 'Since the release on Friday, the signup form rejects emails with a plus sign. People who try again with another address finish signup, the rest drop off at the email step.',
+ pull_request_state: 'open',
+ pull_request_url: 'https://github.com/example-org/web/pull/4821',
+ signal_count: 23,
+ updated_at: '2026-09-28T15:10:00Z',
+ metrics: [
+ {
+ metric_id: 'affected-users',
+ title: 'Affected users',
+ kind: 'affected_users',
+ role: 'primary',
+ value: 52,
+ series: [12, 18, 15, 22, 31, 40, 52],
+ value_format: 'count',
+ unit: 'users',
+ query: reportMetricsFixture[0].query,
+ },
+ ...reportMetricsFixture.slice(1).map((metric) => ({
+ metric_id: metric.metric_id,
+ title: metric.title,
+ kind: metric.kind,
+ role: metric.role ?? 'supporting',
+ value: metric.value ?? 0,
+ series: metric.series ?? null,
+ value_format: metric.value_format ?? 'number',
+ unit: metric.unit ?? null,
+ query: metric.query,
+ })),
+ ],
+ charts: [],
+ },
}),
briefingItem({
key: 'report:report-3',
@@ -407,6 +453,31 @@ const PERSONAL_BRIEFING: BriefingApi = {
signal: 'P2, claimed by you',
rank: 2,
source_product: 'llm_analytics',
+ title: 'Summarize tool costs doubled after the prompt change',
+ report: {
+ priority: 'P2',
+ summary:
+ 'The summarize tool now sends the whole thread as context instead of the last ten messages. Token use per call doubled on Tuesday and has stayed there. Cost per conversation rose the same amount, while answer ratings did not change. Trimming the context back would undo the rise.',
+ pull_request_state: null,
+ pull_request_url: null,
+ signal_count: 7,
+ updated_at: '2026-09-27T09:00:00Z',
+ metrics: [],
+ charts: [
+ {
+ chart_id: 'summarize-tokens',
+ title: 'Tokens per summarize call',
+ query: {
+ kind: 'InsightVizNode',
+ source: {
+ kind: 'TrendsQuery',
+ series: [{ kind: 'EventsNode', event: '$ai_generation' }],
+ dateRange: { date_from: '2026-09-14', date_to: '2026-09-28' },
+ },
+ },
+ },
+ ],
+ },
}),
briefingItem({
key: 'dashboard:12',
@@ -556,6 +627,7 @@ const meta: Meta = {
'/api/projects/:team_id/dashboards/': { results: DASHBOARDS, count: DASHBOARDS.length },
},
post: {
+ '/api/environments/:team_id/query/:kind/': reportMetricQueryHandler,
'/api/projects/:team_id/tasks/summaries/': {
count: 2,
next: null,
@@ -596,6 +668,26 @@ export const HomeWithPersonalBriefing: Story = {
decorators: [mswDecorator({ get: { '/api/projects/:team_id/today/briefing/': PERSONAL_BRIEFING } })],
}
+// One report was resolved and another dismissed after the briefing was written.
+export const HomeWithResolvedAndDismissedItems: Story = {
+ decorators: [
+ mswDecorator({
+ get: {
+ '/api/projects/:team_id/today/briefing/': {
+ ...PERSONAL_BRIEFING,
+ items: PERSONAL_BRIEFING.items.map((item) =>
+ item.key === 'report:report-3'
+ ? { ...item, state: 'dismissed' }
+ : item.key === 'report:report-1'
+ ? { ...item, state: 'done' }
+ : item
+ ),
+ },
+ },
+ }),
+ ],
+}
+
export const HomeWithNothingForYou: Story = {
decorators: [
mswDecorator({
@@ -887,6 +979,34 @@ export const SpaceHoverCard: Story = {
),
}
+export const ReportHoverCard: Story = {
+ render: () => (
+ <HoverCardFrame>
+ <TodayReportHoverCard
+ preview={{
+ kind: 'report',
+ card: briefingItemReportCard(PERSONAL_BRIEFING.items[0]),
+ surface: 'sidebar',
+ }}
+ />
+ </HoverCardFrame>
+ ),
+}
+
+export const ReportHoverCardResolved: Story = {
+ render: () => (
+ <HoverCardFrame>
+ <TodayReportHoverCard
+ preview={{
+ kind: 'report',
+ card: briefingItemReportCard({ ...PERSONAL_BRIEFING.items[1], state: 'done' }),
+ surface: 'sidebar',
+ }}
+ />
+ </HoverCardFrame>
+ ),
+}
+
// The details are picked through the logic, where the dialog saves them, so each session row shows a second line.
export const SpacesPaneWithListItemDetails: Story = {
play: async ({ canvasElement }) => {
diff --git a/frontend/src/scenes/project-homepage/today/TodayBriefing.tsx b/frontend/src/scenes/project-homepage/today/TodayBriefing.tsx
index 1dffdea28c68..432f7242399f 100644
--- a/frontend/src/scenes/project-homepage/today/TodayBriefing.tsx
+++ b/frontend/src/scenes/project-homepage/today/TodayBriefing.tsx
@@ -7,6 +7,8 @@ import { Link } from 'lib/lemon-ui/Link'
import { Spinner } from 'lib/lemon-ui/Spinner/Spinner'
import { urls } from 'scenes/urls'
+import { TodayPreviewTrigger } from '~/layout/today/TodayPreviewTrigger'
+
import { TodayAskBox } from './TodayAskBox'
import { TodayChipStack } from './TodayChipStack'
import { TodayIcon } from './TodayIcon'
@@ -30,7 +32,7 @@ function TodayMetaLine(): JSX.Element {
}
function BriefingSegment({ segment }: { segment: TodayBriefingSegment }): JSX.Element {
- const { hoveredReportId, reports } = useValues(todayLogic)
+ const { hoveredReportId, reports, teamReportPreviews } = useValues(todayLogic)
const { reportOpened, setHoveredReportId } = useActions(todayLogic)
const { reportId } = segment
if (!reportId) {
@@ -52,7 +54,15 @@ function BriefingSegment({ segment }: { segment: TodayBriefingSegment }): JSX.El
{segment.text}
</Link>
)
- return segment.highlight ? <span className="TodayHome__highlight">{link}</span> : link
+ const preview = teamReportPreviews.briefing[reportId]
+ const linkWithCard = preview ? (
+ <TodayPreviewTrigger payload={preview} inline>
+ {link}
+ </TodayPreviewTrigger>
+ ) : (
+ link
+ )
+ return segment.highlight ? <span className="TodayHome__highlight">{linkWithCard}</span> : linkWithCard
}
function TodayBriefingReports(): JSX.Element {
diff --git a/frontend/src/scenes/project-homepage/today/TodayHome.tsx b/frontend/src/scenes/project-homepage/today/TodayHome.tsx
index 538ae70aa715..ef91935793b4 100644
--- a/frontend/src/scenes/project-homepage/today/TodayHome.tsx
+++ b/frontend/src/scenes/project-homepage/today/TodayHome.tsx
@@ -2,6 +2,8 @@ import './Today.scss'
import { useValues } from 'kea'
+import { TodayPreviewCardProvider } from '~/layout/today/TodayPreviewCardProvider'
+
import { TodayBriefing } from './TodayBriefing'
import { todayLogic } from './todayLogic'
import { TodayReportPage } from './TodayReportPage'
@@ -12,7 +14,13 @@ export function TodayHome(): JSX.Element {
return (
<div className="Today flex-1 min-h-full @container/today">
- {reportId ? <TodayReportPage key={reportId} reportId={reportId} /> : <TodayBriefing />}
+ {reportId ? (
+ <TodayReportPage key={reportId} reportId={reportId} />
+ ) : (
+ <TodayPreviewCardProvider>
+ <TodayBriefing />
+ </TodayPreviewCardProvider>
+ )}
</div>
)
}
diff --git a/frontend/src/scenes/project-homepage/today/TodayHomeSidebar.tsx b/frontend/src/scenes/project-homepage/today/TodayHomeSidebar.tsx
index 88b9c93453b0..48b86d6246e4 100644
--- a/frontend/src/scenes/project-homepage/today/TodayHomeSidebar.tsx
+++ b/frontend/src/scenes/project-homepage/today/TodayHomeSidebar.tsx
@@ -8,14 +8,16 @@ import { LinkPrimitive } from 'lib/lemon-ui/Link'
import { removeProjectIdIfPresent } from 'lib/utils/kea-router'
import { urls } from 'scenes/urls'
-import { isExternalHref, itemHref, itemSource } from './todayBriefingItems'
+import { TodayPreviewTrigger } from '~/layout/today/TodayPreviewTrigger'
+
+import { isExternalHref, itemHref, itemSource, itemStateLabel } from './todayBriefingItems'
import { TodayIcon } from './TodayIcon'
import { todayLogic } from './todayLogic'
import { TodayNavItem } from './TodayNavItem'
import { reportIcon, reportMeta, reportSource, reportTitle } from './todaySignalReports'
function PersonalBriefingNavItems(): JSX.Element {
- const { briefingItems, hoveredItemKey } = useValues(todayLogic)
+ const { briefingItems, reportPreviews, hoveredItemKey } = useValues(todayLogic)
const { itemOpened, setHoveredItemKey } = useActions(todayLogic)
const { location } = useValues(router)
const currentPath = removeProjectIdIfPresent(location.pathname)
@@ -25,23 +27,31 @@ function PersonalBriefingNavItems(): JSX.Element {
{briefingItems.map((item) => {
const href = itemHref(item)
const source = itemSource(item)
- return (
+ const preview = reportPreviews.sidebar[item.key]
+ const row = (
<TodayNavItem
key={item.key}
title={item.label}
- meta={item.signal || source.label}
+ meta={itemStateLabel(item) ?? (item.signal || source.label)}
color={source.color}
icon={<TodayIcon icon={source.icon} />}
to={href}
target={isExternalHref(href) ? '_blank' : undefined}
active={hoveredItemKey === item.key}
current={removeProjectIdIfPresent(href) === currentPath}
- done={item.state === 'done'}
+ state={item.state}
dataAttr="today-nav-item"
onClick={() => itemOpened(item, 'sidebar')}
onHoverChange={(hovered) => setHoveredItemKey(hovered ? item.key : null)}
/>
)
+ return preview ? (
+ <TodayPreviewTrigger key={item.key} payload={preview}>
+ {row}
+ </TodayPreviewTrigger>
+ ) : (
+ row
+ )
})}
</>
)
@@ -57,6 +67,7 @@ export function TodayHomeSidebar(): JSX.Element {
reportSummary,
showPersonalBriefing,
personalBriefing,
+ teamReportPreviews,
} = useValues(todayLogic)
const { reportOpened, setHoveredReportId } = useActions(todayLogic)
@@ -103,19 +114,20 @@ export function TodayHomeSidebar(): JSX.Element {
</>
) : (
reports.map((report) => (
- <TodayNavItem
- key={report.id}
- title={reportTitle(report)}
- meta={reportMeta(report)}
- color={reportSource(report).color}
- icon={<TodayIcon icon={reportIcon(report)} />}
- to={urls.todayReport(report.id)}
- active={hoveredReportId === report.id}
- current={reportId === report.id}
- dataAttr="today-nav-report"
- onClick={() => reportOpened(report, 'sidebar')}
- onHoverChange={(hovered) => setHoveredReportId(hovered ? report.id : null)}
- />
+ <TodayPreviewTrigger key={report.id} payload={teamReportPreviews.sidebar[report.id]}>
+ <TodayNavItem
+ title={reportTitle(report)}
+ meta={reportMeta(report)}
+ color={reportSource(report).color}
+ icon={<TodayIcon icon={reportIcon(report)} />}
+ to={urls.todayReport(report.id)}
+ active={hoveredReportId === report.id}
+ current={reportId === report.id}
+ dataAttr="today-nav-report"
+ onClick={() => reportOpened(report, 'sidebar')}
+ onHoverChange={(hovered) => setHoveredReportId(hovered ? report.id : null)}
+ />
+ </TodayPreviewTrigger>
))
)}
</div>
diff --git a/frontend/src/scenes/project-homepage/today/TodayNavItem.tsx b/frontend/src/scenes/project-homepage/today/TodayNavItem.tsx
index 4dfd943d8150..1870577f3bfe 100644
--- a/frontend/src/scenes/project-homepage/today/TodayNavItem.tsx
+++ b/frontend/src/scenes/project-homepage/today/TodayNavItem.tsx
@@ -1,5 +1,7 @@
import { Link } from 'lib/lemon-ui/Link'
+import type { BriefingItemStateEnumApi } from 'products/today/frontend/generated/api.schemas'
+
interface TodayNavItemProps {
title: string
meta: string
@@ -10,8 +12,8 @@ interface TodayNavItemProps {
/** Highlighted because the matching report is hovered elsewhere on the page. */
active?: boolean
current?: boolean
- /** Crossed out, because the item was resolved after the briefing was written. */
- done?: boolean
+ /** Crossed out when the item was resolved after the briefing was written, faded when it was dismissed. */
+ state?: BriefingItemStateEnumApi
onClick?: () => void
onHoverChange?: (hovered: boolean) => void
dataAttr?: string
@@ -26,7 +28,7 @@ export function TodayNavItem({
target,
active = false,
current = false,
- done = false,
+ state = 'open',
onClick,
onHoverChange,
dataAttr,
@@ -39,7 +41,7 @@ export function TodayNavItem({
className="TodayNavItem"
data-active={active || current}
aria-current={current ? 'page' : undefined}
- data-done={done}
+ data-state={state}
data-attr={dataAttr}
onClick={onClick}
onMouseEnter={() => onHoverChange?.(true)}
diff --git a/frontend/src/scenes/project-homepage/today/TodayPersonalBriefing.tsx b/frontend/src/scenes/project-homepage/today/TodayPersonalBriefing.tsx
index 8660dd1ebd2f..f7a11fb4bb9c 100644
--- a/frontend/src/scenes/project-homepage/today/TodayPersonalBriefing.tsx
+++ b/frontend/src/scenes/project-homepage/today/TodayPersonalBriefing.tsx
@@ -4,6 +4,8 @@ import { Link } from 'lib/lemon-ui/Link'
import { pluralize } from 'lib/utils/strings'
import { urls } from 'scenes/urls'
+import { TodayPreviewTrigger } from '~/layout/today/TodayPreviewTrigger'
+
import type { BriefingSegmentApi } from 'products/today/frontend/generated/api.schemas'
import { isExternalHref, itemHref, itemSource } from './todayBriefingItems'
@@ -12,7 +14,7 @@ import { TodayIcon } from './TodayIcon'
import { todayLogic } from './todayLogic'
function PersonalBriefingSegment({ segment }: { segment: BriefingSegmentApi }): JSX.Element {
- const { briefingItems, hoveredItemKey } = useValues(todayLogic)
+ const { briefingItems, reportPreviews, hoveredItemKey } = useValues(todayLogic)
const { itemOpened, setHoveredItemKey } = useActions(todayLogic)
const item = segment.item_key ? briefingItems.find((candidate) => candidate.key === segment.item_key) : undefined
if (!item) {
@@ -26,7 +28,7 @@ function PersonalBriefingSegment({ segment }: { segment: BriefingSegmentApi }):
subtle
className="TodayReportLink"
data-active={hoveredItemKey === item.key}
- data-done={item.state === 'done'}
+ data-state={item.state}
data-attr="today-briefing-item"
onClick={() => itemOpened(item, 'briefing')}
onMouseEnter={() => setHoveredItemKey(item.key)}
@@ -35,7 +37,15 @@ function PersonalBriefingSegment({ segment }: { segment: BriefingSegmentApi }):
{segment.text}
</Link>
)
- return segment.highlight ? <span className="TodayHome__highlight">{link}</span> : link
+ const preview = reportPreviews.briefing[item.key]
+ const linkWithCard = preview ? (
+ <TodayPreviewTrigger payload={preview} inline>
+ {link}
+ </TodayPreviewTrigger>
+ ) : (
+ link
+ )
+ return segment.highlight ? <span className="TodayHome__highlight">{linkWithCard}</span> : linkWithCard
}
function PersonalBriefingChips(): JSX.Element | null {
@@ -61,7 +71,7 @@ function PersonalBriefingChips(): JSX.Element | null {
}
export function TodayPersonalBriefing(): JSX.Element | null {
- const { personalBriefing, inboxMore } = useValues(todayLogic)
+ const { personalBriefing, inboxMore, briefingProgress } = useValues(todayLogic)
const { askAi } = useActions(todayLogic)
if (!personalBriefing) {
@@ -90,6 +100,11 @@ export function TodayPersonalBriefing(): JSX.Element | null {
<span>{personalBriefing.headline}</span>
<PersonalBriefingChips />
</p>
+ {briefingProgress && (
+ <p className="TodayHome__progress" data-attr="today-briefing-progress">
+ {`${briefingProgress.done} of ${briefingProgress.total} done`}
+ </p>
+ )}
{personalBriefing.paragraphs.map((paragraph, index) => (
<p key={index}>
{paragraph.map((segment, segmentIndex) => (
diff --git a/frontend/src/scenes/project-homepage/today/TodayReportHoverCard.tsx b/frontend/src/scenes/project-homepage/today/TodayReportHoverCard.tsx
new file mode 100644
index 000000000000..0d0398def3a3
--- /dev/null
+++ b/frontend/src/scenes/project-homepage/today/TodayReportHoverCard.tsx
@@ -0,0 +1,212 @@
+import { useActions } from 'kea'
+import { Suspense, useEffect } from 'react'
+
+import { IconPullRequest } from '@posthog/icons'
+import {
+ Badge,
+ Item,
+ ItemActions,
+ ItemContent,
+ ItemDescription,
+ ItemSeparator,
+ ItemTitle,
+ Skeleton,
+ Text,
+ cn,
+} from '@posthog/quill'
+
+import { dayjs } from 'lib/dayjs'
+import { LinkPrimitive } from 'lib/lemon-ui/Link'
+import { lazyWithRetry } from 'lib/utils/retryImport'
+import { pluralize } from 'lib/utils/strings'
+
+import type { TodayReportPreview } from '~/layout/today/todayPreviewCards'
+
+import { selectReportCardImpactMetric } from 'products/signals/frontend/inbox/components/cards/ReportCardImpactMetric'
+import { reportChartGraphQuery } from 'products/signals/frontend/inbox/utils/reportChartQuery'
+import {
+ asReportMetricAggregateQuery,
+ asReportMetricSeriesQuery,
+ reportMetricRowParts,
+} from 'products/signals/frontend/inbox/utils/reportMetrics'
+import { pullRequestStateMeta } from 'products/tasks/frontend/spaces/TaskPullRequestChip'
+
+import { todayLogic } from './todayLogic'
+
+// The charts load on the first hover: the card sits in the app shell, and the query and chart code
+// they need must stay out of the bundle every page loads.
+const TodayReportHoverCardMetric = lazyWithRetry(() =>
+ import('./TodayReportHoverCardMetric').then((m) => ({ default: m.TodayReportHoverCardMetric }))
+)
+const TodayReportHoverCardChart = lazyWithRetry(() =>
+ import('./TodayReportHoverCardChart').then((m) => ({ default: m.TodayReportHoverCardChart }))
+)
+
+// The card lists a few more metrics by their saved value. A chart for each would run two live queries per metric on every hover.
+const LISTED_METRIC_COUNT = 2
+
+/**
+ * A report's hover card, on its left-bar row and on its links in the briefing text: its priority, why the
+ * briefing picked it, what happened to it since, its implementation pull request, summary and headline
+ * metric. The text comes with the page. The metric runs its live query while the card is open, and a
+ * report without a metric shows the card without it.
+ */
+export function TodayReportHoverCard({ preview }: { preview: TodayReportPreview }): JSX.Element {
+ const { card } = preview
+ const { reportPreviewed } = useActions(todayLogic)
+ // Keyed on the report, not the card object: a poll replaces the object while the card stays open.
+ useEffect(() => {
+ reportPreviewed(card.key, preview.surface)
+ }, [card.key, preview.surface, reportPreviewed])
+
+ const pullRequestState = pullRequestStateMeta(card.pullRequestState)
+ const metric = selectReportCardImpactMetric(card.metrics)
+ const aggregateQuery = metric ? asReportMetricAggregateQuery(metric.query) : null
+ const seriesQuery = metric ? asReportMetricSeriesQuery(metric) : null
+ const lead = [card.priority, card.reason].filter(Boolean).join(' · ')
+ const hasMetricChart = !!(metric && aggregateQuery && seriesQuery)
+ // A report without a metric to chart shows the first chart from its body instead.
+ const bodyChart = hasMetricChart
+ ? null
+ : card.charts.map((chart) => ({ chart, query: reportChartGraphQuery(chart) })).find(({ query }) => query)
+ const hasChart = hasMetricChart || !!bodyChart
+ const otherMetrics = card.metrics.flatMap((candidate) => {
+ const parts = hasMetricChart && candidate === metric ? null : reportMetricRowParts(candidate, candidate.value)
+ return parts ? [{ metric: candidate, value: [parts.value, parts.unit].filter(Boolean).join(' ') }] : []
+ })
+ const listedMetrics = otherMetrics.slice(0, LISTED_METRIC_COUNT)
+ const unlistedMetricCount = otherMetrics.length - listedMetrics.length
+ const activity = [
+ card.signalCount ? pluralize(card.signalCount, 'signal') : null,
+ card.updatedAt ? `updated ${dayjs(card.updatedAt).fromNow()}` : null,
+ ]
+ .filter(Boolean)
+ .join(' · ')
+
+ return (
+ <div className="flex flex-col" data-attr="today-report-hover-card">
+ {/* `flex-nowrap` keeps the state badge beside a long title. */}
+ <Item size="xs" className="flex-nowrap items-start">
+ <ItemContent className="min-w-0 gap-0.5">
+ {/* `wrap-anywhere`: the title sizes to its content, so a long title would widen the card. */}
+ <ItemTitle className="wrap-anywhere">
+ <span className="min-w-0 font-semibold">{card.title}</span>
+ </ItemTitle>
+ {(lead || card.pullRequestUrl) && (
+ <ItemDescription className="flex flex-wrap items-center gap-x-1.5">
+ {lead && <span>{lead}</span>}
+ {card.pullRequestUrl && (
+ <span className="flex min-w-0 items-center gap-1.5">
+ {lead && <span aria-hidden>·</span>}
+ <LinkPrimitive
+ to={card.pullRequestUrl}
+ target="_blank"
+ data-attr="today-report-hover-card-pr"
+ // Dotted at rest, so the one mark that opens something reads as a link.
+ className="flex min-w-0 items-center gap-1 font-normal text-foreground underline decoration-dotted underline-offset-2"
+ >
+ <IconPullRequest
+ className={cn('size-3 shrink-0', pullRequestState?.iconClassName)}
+ />
+ <span className="truncate">
+ {pullRequestState
+ ? `PR ${pullRequestState.label.toLowerCase()}`
+ : 'Pull request'}
+ </span>
+ </LinkPrimitive>
+ </span>
+ )}
+ </ItemDescription>
+ )}
+ </ItemContent>
+ {card.stateLabel && (
+ <ItemActions className="self-start">
+ <Badge variant={card.resolved ? 'completed' : 'default'}>{card.stateLabel}</Badge>
+ </ItemActions>
+ )}
+ </Item>
+ {card.summary && (
+ // Its own row, so the summary uses the full card width, not the column beside the state badge.
+ <Item size="xs" className="pt-0">
+ <ItemContent className="min-w-0">
+ {/* A few lines say what the report is about. Without a chart below, the summary gets the room. */}
+ <Text
+ size="xs"
+ variant="muted"
+ className={cn('leading-snug break-words', hasChart ? 'line-clamp-3' : 'line-clamp-8')}
+ >
+ {card.summary}
+ </Text>
+ </ItemContent>
+ </Item>
+ )}
+ {(hasChart || listedMetrics.length > 0) && (
+ <>
+ <ItemSeparator className="my-0" />
+ <Item size="xs">
+ <ItemContent className="min-w-0 gap-1.5">
+ {/* The metric and report charts are `h-36`, so the card keeps its size while they load. */}
+ <Suspense fallback={hasChart ? <Skeleton className="h-36 w-full" /> : null}>
+ {metric && aggregateQuery && seriesQuery && (
+ <TodayReportHoverCardMetric
+ cardKey={card.key}
+ metric={metric}
+ aggregateQuery={aggregateQuery.source}
+ seriesQuery={seriesQuery.source}
+ />
+ )}
+ {bodyChart?.query && (
+ <TodayReportHoverCardChart
+ cardKey={card.key}
+ chart={bodyChart.chart}
+ query={bodyChart.query}
+ />
+ )}
+ </Suspense>
+ {listedMetrics.map(({ metric: listed, value }) => (
+ <div
+ key={listed.metric_id}
+ className="flex items-baseline justify-between gap-2"
+ data-attr="today-report-hover-card-listed-metric"
+ >
+ <Text
+ size="xs"
+ variant="muted"
+ render={<span title={listed.title} />}
+ className="truncate"
+ >
+ {listed.title}
+ </Text>
+ <Text
+ size="xs"
+ render={<span translate="no" />}
+ className="shrink-0 font-semibold tabular-nums"
+ >
+ {value}
+ </Text>
+ </div>
+ ))}
+ {unlistedMetricCount > 0 && (
+ <Text size="xs" variant="muted" render={<span />}>
+ {`${pluralize(unlistedMetricCount, 'more metric')} in the report`}
+ </Text>
+ )}
+ </ItemContent>
+ </Item>
+ </>
+ )}
+ <ItemSeparator className="my-0" />
+ {/* Each half wraps as a whole, so a narrow card never leaves one word on its own line. */}
+ <div className="flex flex-wrap justify-between gap-x-3 px-3 py-2">
+ <Text size="xs" variant="muted" render={<span />} className="whitespace-nowrap">
+ {card.sourceLabel}
+ </Text>
+ {activity && (
+ <Text size="xs" variant="muted" render={<span />} className="whitespace-nowrap">
+ {activity}
+ </Text>
+ )}
+ </div>
+ </div>
+ )
+}
diff --git a/frontend/src/scenes/project-homepage/today/TodayReportHoverCardChart.tsx b/frontend/src/scenes/project-homepage/today/TodayReportHoverCardChart.tsx
new file mode 100644
index 000000000000..44aeed30a4e5
--- /dev/null
+++ b/frontend/src/scenes/project-homepage/today/TodayReportHoverCardChart.tsx
@@ -0,0 +1,33 @@
+import { Text } from '@posthog/quill'
+
+import { Query } from '~/queries/Query/Query'
+import type { Node } from '~/queries/schema/schema-general'
+
+import type { ReportChartApi } from 'products/signals/frontend/generated/api.schemas'
+import { OBSERVATION_CHART_HEIGHT_CLASS } from 'products/signals/frontend/inbox/components/detail/ReportObservationChart'
+
+/** A chart from the report body without its frame: its title, then the graph at the metric chart's height. */
+export function TodayReportHoverCardChart({
+ cardKey,
+ chart,
+ query,
+}: {
+ cardKey: string
+ chart: ReportChartApi
+ query: Node
+}): JSX.Element {
+ // The SQLEditor prefix lets a SQL graph size to its box rather than to the window.
+ const uniqueKey = `SQLEditor-today-report-chart-${cardKey}-${chart.chart_id}`
+
+ return (
+ <div className="flex flex-col gap-1.5" data-attr="today-report-hover-card-chart">
+ <Text size="xs" variant="muted" render={<span title={chart.title} />} className="truncate">
+ {chart.title}
+ </Text>
+ <div className={`flex flex-col ${OBSERVATION_CHART_HEIGHT_CLASS}`}>
+ {/* Keyed, so moving to another report's card does not reuse this chart's query logic. */}
+ <Query key={uniqueKey} query={query} uniqueKey={uniqueKey} readOnly embedded />
+ </div>
+ </div>
+ )
+}
diff --git a/frontend/src/scenes/project-homepage/today/TodayReportHoverCardMetric.tsx b/frontend/src/scenes/project-homepage/today/TodayReportHoverCardMetric.tsx
new file mode 100644
index 000000000000..0967cb028c68
--- /dev/null
+++ b/frontend/src/scenes/project-homepage/today/TodayReportHoverCardMetric.tsx
@@ -0,0 +1,78 @@
+import { useValues } from 'kea'
+
+import { Skeleton, Text } from '@posthog/quill'
+
+import { DataNodeLogicProps, dataNodeLogic } from '~/queries/nodes/DataNode/dataNodeLogic'
+import type { TrendsQuery } from '~/queries/schema/schema-general'
+
+import type { ReportMetricApi } from 'products/signals/frontend/generated/api.schemas'
+import {
+ OBSERVATION_CHART_HEIGHT_CLASS,
+ ReportObservationChart,
+} from 'products/signals/frontend/inbox/components/detail/ReportObservationChart'
+import {
+ reportMetricAggregate,
+ reportMetricChartType,
+ reportMetricRowParts,
+ reportMetricSeriesPoints,
+ reportMetricWindowLabel,
+} from 'products/signals/frontend/inbox/utils/reportMetrics'
+
+/**
+ * The report detail's live chart without its frame: what the metric measures and its live value on one
+ * line, then the chart. The saved value shows until the live query answers.
+ */
+export function TodayReportHoverCardMetric({
+ cardKey,
+ metric,
+ aggregateQuery,
+ seriesQuery,
+}: {
+ cardKey: string
+ metric: ReportMetricApi
+ aggregateQuery: TrendsQuery
+ seriesQuery: TrendsQuery
+}): JSX.Element {
+ const aggregateProps: DataNodeLogicProps = {
+ key: `TodayReportMetricAggregate.${cardKey}.${metric.metric_id}`,
+ query: aggregateQuery,
+ autoLoad: true,
+ }
+ const seriesProps: DataNodeLogicProps = {
+ key: `TodayReportMetricSeries.${cardKey}.${metric.metric_id}`,
+ query: seriesQuery,
+ autoLoad: true,
+ }
+ const { response } = useValues(dataNodeLogic(aggregateProps))
+ const { response: seriesResponse, responseError: seriesError } = useValues(dataNodeLogic(seriesProps))
+
+ const parts = reportMetricRowParts(metric, reportMetricAggregate(response) ?? metric.value)
+ const points = reportMetricSeriesPoints(seriesResponse)
+ const window = reportMetricWindowLabel(metric.query)
+ const label = window ? `${metric.title}, ${window.toLowerCase()}` : metric.title
+
+ return (
+ <div className="flex flex-col gap-1.5" data-attr="today-report-hover-card-metric">
+ <div className="flex items-baseline justify-between gap-2">
+ <Text size="xs" variant="muted" render={<span title={label} />} className="truncate">
+ {label}
+ </Text>
+ {parts && (
+ <Text size="xs" render={<span translate="no" />} className="shrink-0 font-semibold tabular-nums">
+ {`${parts.value} ${parts.unit}`}
+ </Text>
+ )}
+ </div>
+ {points ? (
+ <ReportObservationChart
+ metric={metric}
+ points={points}
+ type={reportMetricChartType(metric)}
+ interval={seriesQuery.interval}
+ />
+ ) : !seriesError && seriesResponse == null ? (
+ <Skeleton className={`${OBSERVATION_CHART_HEIGHT_CLASS} w-full`} />
+ ) : null}
+ </div>
+ )
+}
diff --git a/frontend/src/scenes/project-homepage/today/todayBriefingItems.ts b/frontend/src/scenes/project-homepage/today/todayBriefingItems.ts
index 4a4b34015beb..220907170256 100644
--- a/frontend/src/scenes/project-homepage/today/todayBriefingItems.ts
+++ b/frontend/src/scenes/project-homepage/today/todayBriefingItems.ts
@@ -1,6 +1,13 @@
import { urls } from 'scenes/urls'
-import type { BriefingApi, BriefingItemApi } from 'products/today/frontend/generated/api.schemas'
+import type { TodayReportCard } from '~/layout/today/todayPreviewCards'
+
+import type {
+ BriefingApi,
+ BriefingItemApi,
+ BriefingItemStateEnumApi,
+ TodayItemReasonEnumApi,
+} from 'products/today/frontend/generated/api.schemas'
import { TodayReportSource, sourceStyle } from './todaySignalReports'
@@ -12,6 +19,57 @@ export function itemSource(item: Pick<BriefingItemApi, 'source' | 'source_produc
return sourceStyle(item.source_product ?? item.source)
}
+const REASON_LABELS: Record<TodayItemReasonEnumApi, string> = {
+ claimed_by_you: 'You claimed it',
+ waiting_for_you: 'Waiting for your input',
+ suggested_reviewer: 'You are a suggested reviewer',
+ urgent_for_project: 'Urgent, and nobody owns it',
+ dashboard_you_viewed: 'A dashboard you viewed',
+ dashboard_you_starred: 'A dashboard you starred',
+ insight_you_viewed: 'An insight you viewed',
+ insight_you_starred: 'An insight you starred',
+ alert_firing: 'An alert you follow is firing',
+ assigned_ticket: 'Assigned to you',
+ assigned_error_issue: 'Assigned to you or your role',
+ review_requested: 'Your review was requested',
+ your_pull_request: 'Your pull request',
+}
+
+/** Why the briefing picked the item, as the hover card says it. */
+export function itemReasonLabel(item: Pick<BriefingItemApi, 'reason'>): string {
+ return REASON_LABELS[item.reason]
+}
+
+const STATE_LABELS: Record<BriefingItemStateEnumApi, string | null> = {
+ open: null,
+ done: 'Resolved',
+ dismissed: 'Dismissed',
+}
+
+/** What happened to the item since the briefing was written, or null while it is still open. */
+export function itemStateLabel(item: Pick<BriefingItemApi, 'state'>): string | null {
+ return STATE_LABELS[item.state]
+}
+
+export function briefingItemReportCard(item: BriefingItemApi): TodayReportCard {
+ return {
+ key: item.key,
+ title: item.title,
+ reason: itemReasonLabel(item),
+ stateLabel: itemStateLabel(item),
+ resolved: item.state === 'done',
+ priority: item.report?.priority ?? null,
+ summary: item.report?.summary || null,
+ pullRequestState: item.report?.pull_request_state ?? null,
+ pullRequestUrl: item.report?.pull_request_url ?? null,
+ signalCount: item.report?.signal_count ?? null,
+ updatedAt: item.report?.updated_at ?? null,
+ metrics: item.report?.metrics ?? [],
+ charts: item.report?.charts ?? [],
+ sourceLabel: itemSource(item).label,
+ }
+}
+
/** The report id of a `report:<id>` item, else null. */
export function itemReportId(item: Pick<BriefingItemApi, 'key'>): string | null {
return item.key.startsWith('report:') ? item.key.slice('report:'.length) : null
diff --git a/frontend/src/scenes/project-homepage/today/todayLogic.test.ts b/frontend/src/scenes/project-homepage/today/todayLogic.test.ts
index ddc08166b8ba..97359085353f 100644
--- a/frontend/src/scenes/project-homepage/today/todayLogic.test.ts
+++ b/frontend/src/scenes/project-homepage/today/todayLogic.test.ts
@@ -6,7 +6,7 @@ import { initKeaTests } from '~/test/init'
import { makeReport } from 'products/signals/frontend/inbox/__mocks__/inboxMocks'
import { SignalReport } from 'products/signals/frontend/inbox/types'
-import type { BriefingApi } from 'products/today/frontend/generated/api.schemas'
+import type { BriefingApi, BriefingItemReportApi } from 'products/today/frontend/generated/api.schemas'
import { BRIEFING_POLL_MS, TOP_REPORT_COUNT, reportIdFromPath, todayLogic } from './todayLogic'
import { isSampleReportId } from './todaySampleReports'
@@ -31,6 +31,7 @@ function makeBriefing(overrides: Partial<BriefingApi> = {}): BriefingApi {
reason: 'waiting_for_you',
state: 'open',
source_product: null,
+ report: null,
},
],
more_reports_count: 0,
@@ -138,6 +139,58 @@ describe('todayLogic', () => {
expect(briefingCalls).toBe(2)
})
+ test.each([
+ ['nothing is off the list yet', ['open', 'open'], null],
+ ['a resolved and a dismissed item both count', ['done', 'dismissed', 'open'], { done: 2, total: 3 }],
+ ] as const)('counts briefing progress when %s', async (_name, states, expected) => {
+ const [item] = makeBriefing().items
+ briefingResponses = [
+ [200, makeBriefing({ items: states.map((state, index) => ({ ...item, key: `report:${index}`, state })) })],
+ ]
+ const logic = todayLogic()
+ logic.mount()
+
+ await expectLogic(logic)
+ .toDispatchActions(['loadPersonalBriefingSuccess'])
+ .toMatchValues({ briefingProgress: expected })
+ })
+
+ it('gives a hover card to the reports of both lists, and only to items with report details', async () => {
+ const [item] = makeBriefing().items
+ const report: BriefingItemReportApi = {
+ priority: 'P1',
+ summary: 'Signups fail for plus-addressed emails.',
+ pull_request_state: null,
+ pull_request_url: null,
+ signal_count: 3,
+ updated_at: '2026-09-30T08:00:00Z',
+ metrics: [],
+ charts: [],
+ }
+ listResponse = [200, { results: [makeReport({ id: 'team-a' })], count: 1 }]
+ briefingResponses = [
+ [
+ 200,
+ makeBriefing({
+ items: [
+ { ...item, report },
+ // A deleted report, and an item from an older briefing that is not a report.
+ { ...item, key: 'report:deleted', state: 'dismissed' },
+ { ...item, key: 'dashboard:12', group: 'dashboard', reason: 'dashboard_you_viewed' },
+ ],
+ }),
+ ],
+ ]
+ const logic = todayLogic()
+ logic.mount()
+
+ await expectLogic(logic).toDispatchActions(['loadPersonalBriefingSuccess'])
+ expect(Object.keys(logic.values.reportPreviews.briefing)).toEqual(['report:a'])
+ expect(Object.keys(logic.values.reportPreviews.sidebar)).toEqual(['report:a'])
+ expect(Object.keys(logic.values.teamReportPreviews.briefing)).toEqual(['team-a'])
+ expect(Object.keys(logic.values.teamReportPreviews.sidebar)).toEqual(['team-a'])
+ })
+
it('asks for the top reports for the person and counts the rest', async () => {
const reports = [makeReport({ id: 'a' }), makeReport({ id: 'b' })]
listResponse = [200, { results: reports, count: 9 }]
diff --git a/frontend/src/scenes/project-homepage/today/todayLogic.ts b/frontend/src/scenes/project-homepage/today/todayLogic.ts
index 0bb2f7a78dc8..b29bccf546b3 100644
--- a/frontend/src/scenes/project-homepage/today/todayLogic.ts
+++ b/frontend/src/scenes/project-homepage/today/todayLogic.ts
@@ -13,6 +13,7 @@ import { teamLogic } from 'scenes/teamLogic'
import { urls } from 'scenes/urls'
import { userLogic } from 'scenes/userLogic'
+import type { TodayReportCard, TodayReportPreview } from '~/layout/today/todayPreviewCards'
import { TeamType, UserType } from '~/types'
import { signalsReportsForYouRetrieve } from 'products/signals/frontend/generated/api'
@@ -24,13 +25,14 @@ import type { TeamPublicType } from '../../../types'
import {
TodayItemOpenSurface,
briefingDayKey,
+ briefingItemReportCard,
hasBriefingText,
isBriefingSettled,
isExternalHref,
itemHref,
} from './todayBriefingItems'
import { SAMPLE_BRIEFING, parseSampleParam, sampleTopReports } from './todaySampleReports'
-import { TodayBriefingSegment, briefingForReports } from './todaySignalReports'
+import { TodayBriefingSegment, briefingForReports, teamReportCard } from './todaySignalReports'
export const TOP_REPORT_COUNT = 5
const CLOCK_MS = 30_000
@@ -97,6 +99,12 @@ export function reportSummaryForHour(hour: number, count: number): string {
return `${reports} still ${verb} your attention`
}
+/** How many of the briefing's items were resolved or dismissed since it was written. */
+export interface TodayBriefingProgress {
+ done: number
+ total: number
+}
+
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface todayLogicValues {
currentProjectId: number | string // teamLogic
@@ -105,6 +113,7 @@ export interface todayLogicValues {
briefing: TodayBriefingSegment[][]
briefingItems: BriefingItemApi[]
briefingPolls: number
+ briefingProgress: TodayBriefingProgress | null
briefingWaiting: boolean
gaveUpWaitingFor: string | null
greeting: string
@@ -120,10 +129,12 @@ export interface todayLogicValues {
refreshedBriefing: BriefingApi | null
refreshedBriefingLoading: boolean
reportId: string | null
+ reportPreviews: Record<TodayReportPreview['surface'], Record<string, TodayReportPreview>>
reportSummary: string
reports: SignalReport[]
reportsFailed: boolean
showPersonalBriefing: boolean
+ teamReportPreviews: Record<TodayReportPreview['surface'], Record<string, TodayReportPreview>>
topReports: TodayReports | null
topReportsLoading: boolean
useSampleData: boolean
@@ -231,6 +242,13 @@ export interface todayLogicActions {
report: SignalReport
source: TodayReportOpenSource
}
+ reportPreviewed: (
+ cardKey: string,
+ surface: TodayReportPreview['surface']
+ ) => {
+ cardKey: string
+ surface: 'briefing' | 'sidebar'
+ }
setHoveredItemKey: (itemKey: string | null) => {
itemKey: string | null
}
@@ -261,6 +279,13 @@ export interface todayLogicMeta {
showPersonalBriefing: (personalBriefing: BriefingApi | null, useSampleData: boolean) => boolean
inboxMore: (personalBriefing: BriefingApi | null) => TodayInboxMore | null
briefingItems: (personalBriefing: BriefingApi | null, showPersonalBriefing: boolean) => BriefingItemApi[]
+ reportPreviews: (
+ briefingItems: BriefingItemApi[]
+ ) => Record<TodayReportPreview['surface'], Record<string, TodayReportPreview>>
+ teamReportPreviews: (
+ reports: SignalReport[]
+ ) => Record<TodayReportPreview['surface'], Record<string, TodayReportPreview>>
+ briefingProgress: (briefingItems: BriefingItemApi[]) => TodayBriefingProgress | null
briefingWaiting: (
personalBriefing: BriefingApi | null,
gaveUpWaitingFor: string | null,
@@ -271,6 +296,15 @@ export interface todayLogicMeta {
export type todayLogicType = MakeLogicType<todayLogicValues, todayLogicActions, Record<string, any>, todayLogicMeta>
+/** The same cards keyed for both surfaces. Each card is built once and shared by both. */
+function previewsBySurface(
+ cards: [string, TodayReportCard][]
+): Record<TodayReportPreview['surface'], Record<string, TodayReportPreview>> {
+ const previews = (surface: TodayReportPreview['surface']): Record<string, TodayReportPreview> =>
+ Object.fromEntries(cards.map(([key, card]) => [key, { kind: 'report', card, surface }]))
+ return { briefing: previews('briefing'), sidebar: previews('sidebar') }
+}
+
export const todayLogic = kea<todayLogicType>([
path(['scenes', 'project-homepage', 'today', 'todayLogic']),
connect(() => ({
@@ -287,6 +321,7 @@ export const todayLogic = kea<todayLogicType>([
setHoveredItemKey: (itemKey: string | null) => ({ itemKey }),
openItem: (item: BriefingItemApi, surface: TodayItemOpenSurface) => ({ item, surface }),
itemOpened: (item: BriefingItemApi, surface: TodayItemOpenSurface) => ({ item, surface }),
+ reportPreviewed: (cardKey: string, surface: TodayReportPreview['surface']) => ({ cardKey, surface }),
pollBriefing: true,
stopWaitingForBriefing: (briefingId: string) => ({ briefingId }),
}),
@@ -444,6 +479,31 @@ export const todayLogic = kea<todayLogicType>([
(personalBriefing: BriefingApi | null, showPersonalBriefing: boolean): BriefingItemApi[] =>
showPersonalBriefing && personalBriefing ? personalBriefing.items : [],
],
+ // The card stores its trigger's payload, so each report keeps one object per surface across renders.
+ reportPreviews: [
+ (s) => [s.briefingItems],
+ (
+ briefingItems: BriefingItemApi[]
+ ): Record<TodayReportPreview['surface'], Record<string, TodayReportPreview>> =>
+ // Only items with report details: other items, and deleted reports, have nothing to show.
+ previewsBySurface(
+ briefingItems.filter((item) => item.report).map((item) => [item.key, briefingItemReportCard(item)])
+ ),
+ ],
+ // The team's reports stand in until the personal briefing is written, and get the same card.
+ teamReportPreviews: [
+ (s) => [s.reports],
+ (reports: SignalReport[]): Record<TodayReportPreview['surface'], Record<string, TodayReportPreview>> =>
+ previewsBySurface(reports.map((report) => [report.id, teamReportCard(report)])),
+ ],
+ // Shown once something is off the list: "0 of 5 done" reads as a nag, not progress.
+ briefingProgress: [
+ (s) => [s.briefingItems],
+ (briefingItems: BriefingItemApi[]): TodayBriefingProgress | null => {
+ const done = briefingItems.filter((item) => item.state !== 'open').length
+ return done > 0 ? { done, total: briefingItems.length } : null
+ },
+ ],
// While a newer briefing is written, the server returns the shown one as `writing`, so the
// text stays on screen and the page keeps asking until the new one is ready.
briefingWaiting: [
@@ -511,6 +571,7 @@ export const todayLogic = kea<todayLogicType>([
writer: personalBriefing.writer,
item_count: personalBriefing.items.length,
done_item_count: personalBriefing.items.filter((item) => item.state === 'done').length,
+ dismissed_item_count: personalBriefing.items.filter((item) => item.state === 'dismissed').length,
more_reports_count: personalBriefing.more_reports_count,
})
},
@@ -556,6 +617,32 @@ export const todayLogic = kea<todayLogicType>([
surface,
})
},
+ reportPreviewed: ({ cardKey, surface }) => {
+ const item = values.briefingItems.find((candidate) => candidate.key === cardKey)
+ if (item) {
+ // pinned: analytics event name and properties. Renaming them breaks dashboards.
+ posthog.capture('today report previewed', {
+ list: 'personal',
+ source: item.source,
+ reason: item.reason,
+ rank: item.rank,
+ state: item.state,
+ has_metric: !!item.report?.metrics.length,
+ surface,
+ })
+ return
+ }
+ const rank = values.reports.findIndex((report) => teamReportCard(report).key === cardKey) + 1
+ if (rank === 0 || values.useSampleData) {
+ return
+ }
+ posthog.capture('today report previewed', {
+ list: 'team',
+ rank,
+ has_metric: !!values.reports[rank - 1].metrics?.length,
+ surface,
+ })
+ },
locationChanged: ({ searchParams }) => {
const useSampleData = parseSampleParam(searchParams.sample)
if (useSampleData !== null && useSampleData !== values.useSampleData) {
diff --git a/frontend/src/scenes/project-homepage/today/todaySignalReports.ts b/frontend/src/scenes/project-homepage/today/todaySignalReports.ts
index afb794f67613..1b35cdab69c1 100644
--- a/frontend/src/scenes/project-homepage/today/todaySignalReports.ts
+++ b/frontend/src/scenes/project-homepage/today/todaySignalReports.ts
@@ -1,5 +1,7 @@
import { dayjs } from 'lib/dayjs'
+import type { TodayReportCard } from '~/layout/today/todayPreviewCards'
+
import { isActionCapableReport } from 'products/signals/frontend/inbox/inboxTaskKickoffLogic'
import { SignalReport } from 'products/signals/frontend/inbox/types'
@@ -77,6 +79,26 @@ export function reportSource(report: Pick<SignalReport, 'source_products'>): Tod
return sourceStyle(report.source_products?.[0])
}
+/** The hover card of one of the team's reports, shown while the personal briefing is not written yet. */
+export function teamReportCard(report: SignalReport): TodayReportCard {
+ return {
+ key: `team-report:${report.id}`,
+ title: reportTitle(report),
+ reason: null,
+ stateLabel: null,
+ resolved: false,
+ priority: report.priority ?? null,
+ summary: report.summary_lead || null,
+ pullRequestState: report.implementation_pr_merged ? 'merged' : (report.implementation_pr_state ?? null),
+ pullRequestUrl: report.implementation_pr_url ?? null,
+ signalCount: report.signal_count,
+ updatedAt: report.updated_at,
+ metrics: report.metrics ?? [],
+ charts: report.charts ?? [],
+ sourceLabel: reportSource(report).label,
+ }
+}
+
export function reportIcon(report: Pick<SignalReport, 'source_products' | 'implementation_pr_url'>): TodayReportIcon {
return report.implementation_pr_url ? 'pr' : reportSource(report).icon
}
diff --git a/frontend/src/styles/base.scss b/frontend/src/styles/base.scss
index b9a1f3068a99..2431f376555b 100644
--- a/frontend/src/styles/base.scss
+++ b/frontend/src/styles/base.scss
@@ -742,6 +742,10 @@
// over a modal opened after pinning.
--z-chart-tooltip: var(--z-graph-tooltip);
+ // A popover that holds a chart sits one layer under chart tooltips, which portal to the body,
+ // so the chart's tooltip shows on top of it. It stays above --z-modal.
+ --z-popover-with-chart: calc(var(--z-graph-tooltip) - 1);
+
// 1161 and 1162 are reserved to be set from code
// 1166 through 1169 are reserved to be set from code
// this allows us to place some modals on top of others
diff --git a/products/signals/backend/briefing_reports.py b/products/signals/backend/briefing_reports.py
index 95e0251b5634..2351a8ff9e7b 100644
--- a/products/signals/backend/briefing_reports.py
+++ b/products/signals/backend/briefing_reports.py
@@ -4,6 +4,7 @@ The briefing ranks items across products, so this module only answers "which rep
person, and how". It does not order across relations; the caller does that.
"""
+import re
from collections.abc import Sequence
from datetime import datetime
from enum import StrEnum
@@ -18,9 +19,15 @@ from posthog.models import Team, User
from products.signals.backend.artefact_attribution import ArtefactAttribution
from products.signals.backend.artefact_schemas import ActionabilityChoice, RankingScore, priority_from_judgment
-from products.signals.backend.implementation_pr import implementation_pr_report_filter
-from products.signals.backend.models import SignalReport, SignalReportArtefact
+from products.signals.backend.implementation_pr import (
+ fetch_implementation_pr_state_for_reports,
+ implementation_pr_report_filter,
+)
+from products.signals.backend.models import SignalReport, SignalReportArtefact, SignalReportAssignment
+from products.signals.backend.report_charts import ReportChartSnapshot, saved_charts
from products.signals.backend.report_claims import reports_with_active_claim
+from products.signals.backend.report_metric_access import ReportMetricAccessPolicy
+from products.signals.backend.report_metrics import ReportMetricSnapshot, saved_metric_snapshots
from products.signals.backend.signal_metadata import fetch_source_products_for_reports
from products.signals.backend.suggested_reviewer_index import report_ids_naming_reviewers
@@ -28,6 +35,8 @@ logger = structlog.get_logger(__name__)
_OPEN_STATUSES = (SignalReport.Status.READY, SignalReport.Status.PENDING_INPUT)
_SUMMARY_LIMIT = 300
+# The hover card shows more of the summary than the briefing writer reads.
+SUMMARY_LEAD_LIMIT = 450
PR_MERGED_HEAD = "pr_merged"
@@ -62,10 +71,28 @@ class BriefingReport:
pr_merged_probability: float | None
+# The implementation pull request states a briefing shows. `unknown` reads as no state.
+IMPLEMENTATION_PR_STATES: tuple[str, ...] = tuple(
+ state for state in SignalReportAssignment.PrState.values if state != SignalReportAssignment.PrState.UNKNOWN
+)
+
+
@frozen
-class ReportState:
+class BriefingReportDetails:
+ """The current state of a report a briefing names, read live so a briefing written earlier stays true."""
+
report_id: str
status: str
+ priority: str | None
+ summary: str
+ # One of IMPLEMENTATION_PR_STATES, or None when the report has no implementation PR.
+ pull_request_state: str | None
+ pull_request_url: str | None
+ signal_count: int
+ updated_at: datetime
+ # Only metrics with a saved snapshot, so the briefing shows a figure before the live query answers.
+ metrics: list[ReportMetricSnapshot]
+ charts: list[ReportChartSnapshot]
def _latest_artefacts(report_ids: Sequence[str], artefact_type: str) -> dict[str, str]:
@@ -232,8 +259,8 @@ def reports_for_briefing(
BriefingReport(
report_id=str(report.id),
relation=relation,
- title=" ".join((report.title or "").split())[:200] or "Untitled report",
- summary=" ".join((report.summary or "").split())[:_SUMMARY_LIMIT],
+ title=_trimmed(report.title, 200) or "Untitled report",
+ summary=_trimmed(report.summary, _SUMMARY_LIMIT),
status=report.status,
priority=priorities.get(str(report.id)),
has_implementation_pr=report.id in with_pr,
@@ -265,9 +292,80 @@ def open_report_counts(*, team_id: int, user: User, exclude_report_ids: Sequence
return OpenReportCounts(for_person=row["for_person"], in_project=row["in_project"])
-def report_states(*, team_id: int, report_ids: Sequence[str]) -> list[ReportState]:
- """Current status of the given reports, so a briefing written earlier can show which are done."""
+def _pull_request_state(state: str, merged: bool) -> str | None:
+ if merged:
+ return SignalReportAssignment.PrState.MERGED
+ return state if state in IMPLEMENTATION_PR_STATES else None
+
+
+def _trimmed(text: str | None, limit: int) -> str:
+ return " ".join((text or "").split())[:limit]
+
+
+_MARKDOWN_HEADING_LINE = re.compile(r"^ {0,3}#{1,6}(?:[ \t].*)?$", re.MULTILINE)
+# A `chart:` link places a chart in the report body. Plain text has no chart to place, so the link goes.
+# Load-bearing: the label and destination classes exclude `[`. Without that, a summary of unclosed
+# brackets makes each start position rescan the rest of the text, which costs seconds per summary.
+_MARKDOWN_CHART_LINK = re.compile(r"\[[^\[\]]*\]\(chart:[^)\[]*\)")
+_MARKDOWN_CHART_ID = re.compile(r"\]\(chart:([^)\s\[]+)\)")
+_MARKDOWN_LINK = re.compile(r"\[([^\[\]]*)\]\([^)\[]*\)")
+# Only `**` and backticks: `__` also appears inside identifiers such as `__init__` or `team__id`.
+_MARKDOWN_EMPHASIS = re.compile(r"\*\*|`")
+
+
+def summary_lead(summary: str | None, limit: int) -> str:
+ """The opening of a report's markdown summary as plain text on one line: the text before its first
+ section heading, with chart links removed and other links reduced to their text."""
+ sections = _MARKDOWN_HEADING_LINE.split(summary or "")
+ lead = next((section for section in sections if section.strip()), "")
+ lead = _MARKDOWN_CHART_LINK.sub("", lead)
+ lead = _MARKDOWN_LINK.sub(r"\1", lead)
+ return _trimmed(_MARKDOWN_EMPHASIS.sub("", lead), limit)
+
+
+def _charts_by_reference(charts: list[ReportChartSnapshot], summary: str | None) -> list[ReportChartSnapshot]:
+ """The charts the summary references, in the order it references them, then the rest in stored order."""
+ referenced = list(dict.fromkeys(_MARKDOWN_CHART_ID.findall(summary or "")))
+ rank = {chart_id: index for index, chart_id in enumerate(referenced)}
+ return sorted(charts, key=lambda chart: rank.get(chart.chart_id, len(rank)))
+
+
+def report_details(
+ *, team_id: int, report_ids: Sequence[str], metric_access: ReportMetricAccessPolicy
+) -> list[BriefingReportDetails]:
+ """Current status, priority, summary, implementation PR and metric snapshots of the given reports.
+
+ A briefing written earlier reads these live, so it shows which reports are done and what changed.
+ Only the metrics whose snapshot `metric_access` lets the viewer read are returned, as in the Inbox.
+ """
if not report_ids:
return []
- rows = SignalReport.objects.filter(team_id=team_id, id__in=list(report_ids)).values_list("id", "status")
- return [ReportState(report_id=str(report_id), status=status) for report_id, status in rows]
+ reports = list(
+ SignalReport.objects.filter(team_id=team_id, id__in=list(report_ids)).only(
+ "id", "status", "summary", "metrics", "charts", "signal_count", "updated_at"
+ )
+ )
+ found_ids = [str(report.id) for report in reports]
+ priorities = _priorities(found_ids)
+ pull_requests = fetch_implementation_pr_state_for_reports(found_ids, team_id=team_id)
+ details = []
+ for report in reports:
+ report_id = str(report.id)
+ pull_request = pull_requests.get(report_id)
+ details.append(
+ BriefingReportDetails(
+ report_id=report_id,
+ status=report.status,
+ priority=priorities.get(report_id),
+ summary=summary_lead(report.summary, SUMMARY_LEAD_LIMIT),
+ pull_request_state=_pull_request_state(pull_request.state, pull_request.merged)
+ if pull_request
+ else None,
+ pull_request_url=pull_request.url if pull_request else None,
+ signal_count=report.signal_count,
+ updated_at=report.updated_at,
+ metrics=saved_metric_snapshots(report.metrics, metric_access),
+ charts=_charts_by_reference(saved_charts(report.charts), report.summary),
+ )
+ )
+ return details
diff --git a/products/signals/backend/facade/api.py b/products/signals/backend/facade/api.py
index 526e3fb8a99c..601a7ebb7bfa 100644
--- a/products/signals/backend/facade/api.py
+++ b/products/signals/backend/facade/api.py
@@ -27,19 +27,31 @@ from products.signals.backend.artefact_schemas import (
TASK_RUN_TYPE_DISCUSSION as TASK_RUN_TYPE_DISCUSSION,
)
from products.signals.backend.briefing_reports import (
+ IMPLEMENTATION_PR_STATES as IMPLEMENTATION_PR_STATES,
# Re-exported for the Today briefing, which ranks these reports next to other products' items.
BriefingReport as BriefingReport,
+ BriefingReportDetails as BriefingReportDetails,
BriefingReportRelation as BriefingReportRelation,
OpenReportCounts as OpenReportCounts,
- ReportState as ReportState,
open_report_counts as open_report_counts,
- report_states as report_states,
+ report_details as report_details,
reports_for_briefing as reports_for_briefing,
)
from products.signals.backend.contracts import DIRECT_STEERABLE_SOURCES, SIGNAL_VARIANT_LOOKUP, SignalRemediation
from products.signals.backend.enums import SIGNAL_SOURCE_PRODUCT_LABELS, SignalSourceProduct
from products.signals.backend.models import SignalReport, SignalScoutConfig, SignalScoutRun, SignalSourceConfig
from products.signals.backend.report_actionability_repair import RepairedBatch, repair_latest_actionability
+from products.signals.backend.report_metric_access import (
+ # Re-exported so the Today briefing reads report metrics with the viewer's access, as the Inbox does.
+ ReportMetricAccessPolicy as ReportMetricAccessPolicy,
+)
+from products.signals.backend.report_metrics import (
+ # Re-exported so the Today briefing can serialize metric snapshots with the inbox's vocabulary.
+ REPORT_METRIC_KINDS as REPORT_METRIC_KINDS,
+ REPORT_METRIC_ROLES as REPORT_METRIC_ROLES,
+ REPORT_METRIC_VALUE_FORMATS as REPORT_METRIC_VALUE_FORMATS,
+ ReportMetricSnapshot as ReportMetricSnapshot,
+)
from products.signals.backend.scout_harness.create_access import can_create_scout
from products.signals.backend.scout_harness.run_gates import (
# Re-exported so the workflows endpoint can branch on why a fire was refused without reaching
diff --git a/products/signals/backend/report_charts.py b/products/signals/backend/report_charts.py
index a873700f67cc..0594060d546d 100644
--- a/products/signals/backend/report_charts.py
+++ b/products/signals/backend/report_charts.py
@@ -14,7 +14,7 @@ import json
from collections.abc import Collection, Sequence
from typing import Any, Literal
-from pydantic import BaseModel, Field, field_validator
+from pydantic import BaseModel, Field, ValidationError, field_validator
# The slug is the target of a `chart:` markdown link, so it has to survive being parsed as a URL.
# Mirrors the routing-safe identifier shape used across the signals schemas, inlined to keep this
@@ -289,6 +289,33 @@ class ReportChart(BaseModel):
return validate_report_query(v)
+class ReportChartSnapshot(BaseModel):
+ """A stored report chart as a reader shows it.
+
+ Reading a chart this way skips the query checks `ReportChart` runs on write. The query was checked
+ when the chart was saved, and the reader's query endpoint checks it again when it runs.
+ """
+
+ model_config = {"frozen": True, "extra": "ignore"}
+
+ chart_id: str
+ title: str
+ query: dict[str, Any]
+
+
+def saved_charts(raw_charts: object) -> list[ReportChartSnapshot]:
+ """The charts in a report's stored `charts` list, in order. Malformed entries are skipped."""
+ if not isinstance(raw_charts, list):
+ return []
+ charts: list[ReportChartSnapshot] = []
+ for raw in raw_charts:
+ try:
+ charts.append(ReportChartSnapshot.model_validate(raw))
+ except ValidationError:
+ continue
+ return charts
+
+
def chart_batch_query_chars(charts: Sequence[ReportChart]) -> int:
"""Serialized size of a set of charts' queries, for `MAX_REPORT_CHARTS_QUERY_CHARS`."""
return sum(len(json.dumps(chart.query)) for chart in charts)
diff --git a/products/signals/backend/report_metrics.py b/products/signals/backend/report_metrics.py
index 2dbe81af7794..f8d7c28385e2 100644
--- a/products/signals/backend/report_metrics.py
+++ b/products/signals/backend/report_metrics.py
@@ -20,7 +20,7 @@ import math
import logging
from collections.abc import Sequence
from datetime import UTC, datetime, timedelta
-from typing import Any, Literal
+from typing import TYPE_CHECKING, Any, Literal
from pydantic import BaseModel, Field, ValidationError, field_validator, model_validator
@@ -28,6 +28,9 @@ from posthog.hogql.errors import BaseHogQLError
from products.signals.backend.report_charts import validate_report_query
+if TYPE_CHECKING:
+ from products.signals.backend.report_metric_access import ReportMetricAccessPolicy
+
logger = logging.getLogger(__name__)
_METRIC_ID_RE = re.compile(r"^[a-z0-9][a-z0-9_-]*$")
@@ -701,3 +704,42 @@ def metric_batch_error(metrics: Sequence[ReportMetric]) -> str | None:
if affected_users_count > 1:
return "a report accepts at most one affected_users metric"
return None
+
+
+class ReportMetricSnapshot(BaseModel):
+ """The saved figure of one report metric, with its live query as stored.
+
+ Reading a snapshot this way skips the query validation `ReportMetric` runs. The query was
+ validated when the metric was saved, and the reader runs it through the regular query endpoint.
+ """
+
+ model_config = {"frozen": True, "extra": "ignore"}
+
+ metric_id: str
+ title: str
+ kind: ReportMetricKind
+ role: ReportMetricRole = "supporting"
+ value: float
+ series: list[float] | None = None
+ value_format: ReportMetricValueFormat = "number"
+ unit: str | None = None
+ query: dict[str, Any] = Field(default_factory=dict)
+
+
+def saved_metric_snapshots(raw_metrics: object, metric_access: ReportMetricAccessPolicy) -> list[ReportMetricSnapshot]:
+ """The metrics in a report's stored `metrics` list that have a saved value the viewer may read.
+
+ Malformed entries are skipped. A snapshot the viewer may not read is left out entirely, because it
+ carries both the userless value and the query definition the Inbox redacts for that viewer.
+ """
+ if not isinstance(raw_metrics, list):
+ return []
+ snapshots: list[ReportMetricSnapshot] = []
+ for raw in raw_metrics:
+ if not isinstance(raw, dict) or raw.get("value") is None or not metric_access.may_read_snapshot(raw):
+ continue
+ try:
+ snapshots.append(ReportMetricSnapshot.model_validate(raw))
+ except ValidationError:
+ continue
+ return snapshots
diff --git a/products/signals/backend/serializers.py b/products/signals/backend/serializers.py
index ef0b71e02c15..70795593e8e7 100644
--- a/products/signals/backend/serializers.py
+++ b/products/signals/backend/serializers.py
@@ -50,6 +50,7 @@ if TYPE_CHECKING:
from products.signals.backend.report_claims import ReportClaim
from .artefact_schemas import NON_WRITABLE_ARTEFACT_TYPES, RankingScore, priority_from_judgment
+from .briefing_reports import SUMMARY_LEAD_LIMIT, summary_lead
from .daily_limit import reports_generated_today, team_day_start
from .models import (
GITHUB_LABEL_NAME_MAX_LENGTH,
@@ -1184,6 +1185,12 @@ class SignalReportSerializer(serializers.ModelSerializer):
"would be accepted (see the field's schema for the reason values)."
),
)
+ summary_lead = serializers.SerializerMethodField(
+ help_text=(
+ "The opening of `summary` as plain text on one line: the text before its first section heading, "
+ f"with chart links removed and other links reduced to their text. At most {SUMMARY_LEAD_LIMIT} characters."
+ ),
+ )
priority = serializers.SerializerMethodField(
help_text="P0–P4 from the latest priority judgment artefact (when present).",
)
@@ -1287,6 +1294,7 @@ class SignalReportSerializer(serializers.ModelSerializer):
"id",
"title",
"summary",
+ "summary_lead",
"status",
"total_weight", # Used for priority scoring
"signal_count", # Used for occurrence count
@@ -1351,6 +1359,9 @@ class SignalReportSerializer(serializers.ModelSerializer):
return None
return data if isinstance(data, dict) else None
+ def get_summary_lead(self, obj: SignalReport) -> str:
+ return summary_lead(obj.summary, SUMMARY_LEAD_LIMIT)
+
def get_priority(self, obj: SignalReport) -> str | None:
prefetched = getattr(obj, "prefetched_priority_artefacts", None)
if prefetched is not None:
diff --git a/products/signals/backend/test/test_briefing_reports.py b/products/signals/backend/test/test_briefing_reports.py
index 781a98e082bd..6ead6f9ad248 100644
--- a/products/signals/backend/test/test_briefing_reports.py
+++ b/products/signals/backend/test/test_briefing_reports.py
@@ -1,5 +1,8 @@
import json
+import time
from datetime import UTC, datetime, timedelta
+from types import SimpleNamespace
+from typing import cast
from posthog.test.base import BaseTest
@@ -7,15 +10,20 @@ from django.test import SimpleTestCase
from django.utils import timezone
from parameterized import parameterized
+from rest_framework.request import Request
from products.signals.backend.artefact_schemas import ActionabilityChoice, RankingModelResult, RankingScore
from products.signals.backend.briefing_reports import (
BriefingReportRelation,
_briefing_order,
open_report_counts,
+ report_details,
reports_for_briefing,
+ summary_lead,
)
from products.signals.backend.models import SignalReport, SignalReportArtefact
+from products.signals.backend.report_metric_access import ReportMetricAccessPolicy
+from products.signals.backend.test.report_metric_test_fixtures import trends_metric_query
class TestReportsForBriefing(BaseTest):
@@ -61,6 +69,53 @@ class TestReportsForBriefing(BaseTest):
)
SignalReportArtefact.objects.filter(pk=artefact.pk).update(created_at=timezone.now() - age)
+ def test_report_details_keep_only_metrics_with_a_saved_snapshot(self) -> None:
+ report = self._urgent_report("Checkout fails")
+ query = trends_metric_query(
+ series=[{"kind": "EventsNode", "event": "$exception", "math": "dau"}], date_from="-14d"
+ )
+
+ def metric(metric_id: str, value: float | None) -> dict:
+ return {
+ "metric_id": metric_id,
+ "title": "Affected users",
+ "kind": "affected_users",
+ "role": "primary",
+ "value": value,
+ "value_at": "2026-09-30T12:00:00Z" if value is not None else None,
+ "series": [3.0, 9.0, 17.0] if value is not None else None,
+ "value_format": "count",
+ "unit": "users",
+ "query": query,
+ }
+
+ report.metrics = [metric("measured", 17), metric("not-measured", None), {"metric_id": "broken"}]
+ report.summary = "Leaks continue. [Form errors](chart:form-errors)"
+ report.charts = [
+ {"chart_id": "page-leaves", "title": "Page leaves", "query": query},
+ {"chart_id": "broken"},
+ {"chart_id": "form-errors", "title": "Form errors", "query": query},
+ ]
+ report.save(update_fields=["metrics", "charts", "summary"])
+
+ viewer = ReportMetricAccessPolicy(
+ request=cast(Request, SimpleNamespace(user=self.user, successful_authenticator=None)), team=self.team
+ )
+ [details] = report_details(team_id=self.team.id, report_ids=[str(report.id)], metric_access=viewer)
+ # Without a viewer the policy reads nothing, so the briefing must hide every metric, as the Inbox does.
+ [unreadable] = report_details(
+ team_id=self.team.id,
+ report_ids=[str(report.id)],
+ metric_access=ReportMetricAccessPolicy(request=None, team=self.team),
+ )
+
+ assert (details.status, details.priority, details.pull_request_state) == ("ready", "P0", None)
+ assert [(m.metric_id, m.value, m.series, m.query) for m in details.metrics] == [
+ ("measured", 17, [3.0, 9.0, 17.0], query)
+ ]
+ assert [(c.chart_id, c.query) for c in details.charts] == [("form-errors", query), ("page-leaves", query)]
+ assert unreadable.metrics == []
+
def test_open_report_counts_do_not_subtract_a_report_that_was_never_open(self) -> None:
shown_open = self._urgent_report("Shown, still open")
self._urgent_report("Not shown")
@@ -135,3 +190,34 @@ class TestBriefingOrder(SimpleTestCase):
ordered = sorted(reports, key=lambda r: _briefing_order(r[3], r[1], r[2], updated_at))
assert [report_id for report_id, *_ in ordered] == expected
+
+
+class TestSummaryLead(SimpleTestCase):
+ @parameterized.expand(
+ [
+ ("plain text", "Signups fail.\nPeople leave.", "Signups fail. People leave."),
+ ("stops at a section", "Signups fail.\n\n## Impact\nNew teams cannot sign up.", "Signups fail."),
+ ("skips an opening heading", "## Summary\nSignups fail.\n## Impact\nMore.", "Signups fail."),
+ ("skips a bare opening heading", "##\nSignups fail.", "Signups fail."),
+ (
+ "keeps underscores in identifiers",
+ "The `__init__` method sets `feature__enabled` to false.",
+ "The __init__ method sets feature__enabled to false.",
+ ),
+ ("a hash inside a line stays", "Issue #42 ## fails", "Issue #42 ## fails"),
+ (
+ "drops chart links and keeps link text",
+ "Leaks **typed text**. [Page leaves](chart:page-leaves) See [the form](https://example.com/form).",
+ "Leaks typed text. See the form.",
+ ),
+ ("no summary", None, ""),
+ ]
+ )
+ def test_summary_lead(self, _name: str, summary: str | None, expected: str) -> None:
+ assert summary_lead(summary, 300) == expected
+
+ @parameterized.expand([("unclosed labels", "[" * 20_000), ("unclosed destinations", "[a](" * 5_000)])
+ def test_summary_lead_stays_fast_on_unclosed_links(self, _name: str, summary: str) -> None:
+ started = time.perf_counter()
+ summary_lead(summary, 450)
+ assert time.perf_counter() - started < 0.5
diff --git a/products/signals/frontend/generated/api.schemas.ts b/products/signals/frontend/generated/api.schemas.ts
index 6025736ed4ab..dc58216a7579 100644
--- a/products/signals/frontend/generated/api.schemas.ts
+++ b/products/signals/frontend/generated/api.schemas.ts
@@ -606,6 +606,8 @@ export interface SignalReportListApi {
readonly title: string | null
/** @nullable */
readonly summary: string | null
+ /** The opening of `summary` as plain text on one line: the text before its first section heading, with chart links removed and other links reduced to their text. At most 450 characters. */
+ readonly summary_lead: string
readonly status: SignalReportStatusEnumApi
readonly total_weight: number
readonly signal_count: number
@@ -823,6 +825,8 @@ export interface SignalReportApi {
readonly title: string | null
/** @nullable */
readonly summary: string | null
+ /** The opening of `summary` as plain text on one line: the text before its first section heading, with chart links removed and other links reduced to their text. At most 450 characters. */
+ readonly summary_lead: string
readonly status: SignalReportStatusEnumApi
readonly total_weight: number
readonly signal_count: number
diff --git a/products/signals/frontend/inbox/components/detail/ReportChart.tsx b/products/signals/frontend/inbox/components/detail/ReportChart.tsx
index a365dc2b9dae..77c23b58c732 100644
--- a/products/signals/frontend/inbox/components/detail/ReportChart.tsx
+++ b/products/signals/frontend/inbox/components/detail/ReportChart.tsx
@@ -16,46 +16,9 @@ import { ChartDisplayType, InsightLogicProps } from '~/types'
import type { ReportChartApi, SizeEnumApi } from 'products/signals/frontend/generated/api.schemas'
import { chartOpenTarget } from '../../utils/chartOpenTarget'
+import { asEmbeddedChart, isGraphicalSqlNode } from '../../utils/reportChartQuery'
import { ReportChartsContext } from './reportChartsContext'
-/**
- * Strip the chrome a query node carries for the insight scene (filter bar, header, results table)
- * so the report shows the chart alone. A scout writes the query against the insight schema, so it
- * can arrive with any of these turned on. Mirrors what `NotebookNodeQuery` does for the same reason.
- */
-function asEmbeddedChart(query: Record<string, any>): Node {
- const node = { ...query, full: false } as any
- if (isInsightVizNode(node) || isSavedInsightNode(node)) {
- node.showFilters = false
- node.showHeader = false
- node.showTable = false
- node.showCorrelationTable = false
- node.embedded = true
- // Forced on rather than left alone: an explicit `false` (which the notebook query node sets,
- // and a scout can copy from one) makes `InsightVizDisplay` omit the result body entirely, so
- // the report would draw a titled card with nothing in it.
- node.showResults = true
- }
- return node as Node
-}
-
-/**
- * A SQL node draws a table unless it was given a graphical display, and only a graph needs a box.
- *
- * `Auto` is not one: it defers to the data visualization, which reads the result and draws a table
- * for nonnumeric columns or a bold number for a single numeric one. Neither wants a graph's fixed
- * height — the table ends up clipped into a scrolling region and the number sits in an oversized
- * card — and nothing here can tell which it will be before the query returns. So it sizes to its
- * content, like the table an absent display already produces.
- */
-function isGraphicalSqlNode(query: Node): boolean {
- if (!isDataVisualizationNode(query)) {
- return false
- }
- const { display } = query as DataVisualizationNode
- return !!display && display !== ChartDisplayType.ActionsTable && display !== ChartDisplayType.Auto
-}
-
// Written out per size rather than built from one map: Tailwind only emits classes it can read
// literally in the source, so a height assembled at runtime would compile to nothing.
const SIZE_HEIGHTS: Record<SizeEnumApi, string> = {
diff --git a/products/signals/frontend/inbox/types.ts b/products/signals/frontend/inbox/types.ts
index 26975e116431..fc5501d0dfb3 100644
--- a/products/signals/frontend/inbox/types.ts
+++ b/products/signals/frontend/inbox/types.ts
@@ -89,6 +89,8 @@ export interface SignalReport {
id: string
title: string | null
summary: string | null
+ /** The opening of `summary` as plain text, before its first section heading. */
+ summary_lead?: string
status: SignalReportStatus
total_weight: number
signal_count: number
diff --git a/products/signals/frontend/inbox/utils/reportChartQuery.test.ts b/products/signals/frontend/inbox/utils/reportChartQuery.test.ts
new file mode 100644
index 000000000000..ac8d83ab04b2
--- /dev/null
+++ b/products/signals/frontend/inbox/utils/reportChartQuery.test.ts
@@ -0,0 +1,30 @@
+import type { ReportChartApi } from 'products/signals/frontend/generated/api.schemas'
+
+import { reportChartGraphQuery } from './reportChartQuery'
+
+const CHART: ReportChartApi = {
+ chart_id: 'signups-drop',
+ title: 'Daily signups',
+ query: null,
+ caption: null,
+ size: null,
+}
+
+describe('reportChartGraphQuery', () => {
+ it.each([
+ ['a trends line', { kind: 'InsightVizNode', source: { kind: 'TrendsQuery', series: [] } }, true],
+ [
+ 'a trends number',
+ {
+ kind: 'InsightVizNode',
+ source: { kind: 'TrendsQuery', series: [], trendsFilter: { display: 'BoldNumber' } },
+ },
+ false,
+ ],
+ ['a retention grid', { kind: 'InsightVizNode', source: { kind: 'RetentionQuery' } }, false],
+ ['a SQL line', { kind: 'DataVisualizationNode', source: {}, display: 'ActionsLineGraph' }, true],
+ ['a SQL number', { kind: 'DataVisualizationNode', source: {}, display: 'BoldNumber' }, false],
+ ])('treats %s as a graph for a compact surface: %s', (_, query, isGraph) => {
+ expect(reportChartGraphQuery({ ...CHART, query }) !== null).toBe(isGraph)
+ })
+})
diff --git a/products/signals/frontend/inbox/utils/reportChartQuery.ts b/products/signals/frontend/inbox/utils/reportChartQuery.ts
new file mode 100644
index 000000000000..efdd67ca7fdc
--- /dev/null
+++ b/products/signals/frontend/inbox/utils/reportChartQuery.ts
@@ -0,0 +1,67 @@
+import { DataVisualizationNode, InsightVizNode, Node } from '~/queries/schema/schema-general'
+import { isDataVisualizationNode, isInsightVizNode, isSavedInsightNode, isTrendsQuery } from '~/queries/utils'
+import { ChartDisplayType } from '~/types'
+
+import type { ReportChartApi } from 'products/signals/frontend/generated/api.schemas'
+
+/**
+ * Strip the chrome a query node carries for the insight scene (filter bar, header, results table)
+ * so the report shows the chart alone. A scout writes the query against the insight schema, so it
+ * can arrive with any of these turned on. Mirrors what `NotebookNodeQuery` does for the same reason.
+ */
+export function asEmbeddedChart(query: Record<string, any>): Node {
+ const node = { ...query, full: false } as any
+ if (isInsightVizNode(node) || isSavedInsightNode(node)) {
+ node.showFilters = false
+ node.showHeader = false
+ node.showTable = false
+ node.showCorrelationTable = false
+ node.embedded = true
+ // Forced on rather than left alone: an explicit `false` (which the notebook query node sets,
+ // and a scout can copy from one) makes `InsightVizDisplay` omit the result body entirely, so
+ // the report would draw a titled card with nothing in it.
+ node.showResults = true
+ }
+ return node as Node
+}
+
+/**
+ * A SQL node draws a table unless it was given a graphical display, and only a graph needs a box.
+ *
+ * `Auto` is not one: it defers to the data visualization, which reads the result and draws a table
+ * for nonnumeric columns or a bold number for a single numeric one. Neither wants a graph's fixed
+ * height — the table ends up clipped into a scrolling region and the number sits in an oversized
+ * card — and nothing here can tell which it will be before the query returns. So it sizes to its
+ * content, like the table an absent display already produces.
+ */
+export function isGraphicalSqlNode(query: Node): boolean {
+ if (!isDataVisualizationNode(query)) {
+ return false
+ }
+ const { display } = query as DataVisualizationNode
+ return !!display && display !== ChartDisplayType.ActionsTable && display !== ChartDisplayType.Auto
+}
+
+// Displays that are not a graph over time: they need more room than a compact surface has.
+const NON_GRAPH_DISPLAYS = new Set<string | undefined>([
+ ChartDisplayType.BoldNumber,
+ ChartDisplayType.ActionsTable,
+ ChartDisplayType.WorldMap,
+])
+
+/**
+ * The chart's query as a bare graph for a compact surface, or null when it is not a graph. Only trends
+ * and SQL graphs qualify: a saved insight loads through its own scene logic, retention and paths draw a
+ * grid or a fan of rows, and a table or a single number needs more room.
+ */
+export function reportChartGraphQuery(chart: ReportChartApi): Node | null {
+ if (!chart.query || typeof chart.query !== 'object') {
+ return null
+ }
+ const query = asEmbeddedChart(chart.query as Record<string, any>)
+ if (isInsightVizNode(query)) {
+ const { source } = query as InsightVizNode
+ return isTrendsQuery(source) && !NON_GRAPH_DISPLAYS.has(source.trendsFilter?.display) ? query : null
+ }
+ return isGraphicalSqlNode(query) && !NON_GRAPH_DISPLAYS.has((query as DataVisualizationNode).display) ? query : null
+}
diff --git a/products/today/backend/facade/api.py b/products/today/backend/facade/api.py
index a6b1ab97ac14..f3abdc2de26e 100644
--- a/products/today/backend/facade/api.py
+++ b/products/today/backend/facade/api.py
@@ -2,24 +2,37 @@
from posthog.models import Team, User
+from products.signals.backend.facade import api as signals
+
from ..feature_flags import may_get_briefing as may_get_briefing
from ..logic import briefings
from . import contracts
from .enums import BriefingStatus
-def get_briefing(*, team: Team, user: User, timezone_name: str | None) -> contracts.Briefing:
- """Today's briefing for the person. Starts generating one when there is none yet."""
+def get_briefing(
+ *, team: Team, user: User, timezone_name: str | None, metric_access: signals.ReportMetricAccessPolicy
+) -> contracts.Briefing:
+ """Today's briefing for the person. Starts generating one when there is none yet.
+
+ `metric_access` is the request's access to report metrics, so report cards hide what the Inbox hides.
+ """
current = briefings.get_or_start_briefing(team=team, user=user, timezone_name=timezone_name)
return briefings.to_contract(
- current.shown, team, user, status=BriefingStatus.WRITING if current.generating else None
+ current.shown,
+ team,
+ user,
+ metric_access=metric_access,
+ status=BriefingStatus.WRITING if current.generating else None,
)
-def refresh_briefing(*, team: Team, user: User, timezone_name: str | None) -> contracts.Briefing:
+def refresh_briefing(
+ *, team: Team, user: User, timezone_name: str | None, metric_access: signals.ReportMetricAccessPolicy
+) -> contracts.Briefing:
"""Regenerate today's briefing. The ready one stays until the new one is written."""
briefings.refresh_briefing(team=team, user=user, timezone_name=timezone_name)
- return get_briefing(team=team, user=user, timezone_name=timezone_name)
+ return get_briefing(team=team, user=user, timezone_name=timezone_name, metric_access=metric_access)
def delete_briefings_for_teams(team_ids: list[int]) -> None:
diff --git a/products/today/backend/facade/contracts.py b/products/today/backend/facade/contracts.py
index 6746da99b3af..2356285c3afc 100644
--- a/products/today/backend/facade/contracts.py
+++ b/products/today/backend/facade/contracts.py
@@ -1,6 +1,7 @@
"""Contract types for today: what the product returns to its API, MCP tools and other products."""
from datetime import date, datetime
+from typing import Any
from pydantic.dataclasses import dataclass
@@ -14,6 +15,44 @@ class BriefingSegment:
highlight: bool = False
+@dataclass(frozen=True)
+class BriefingItemMetric:
+ """A report metric's saved snapshot and its live query. The same fields as the inbox list's metric."""
+
+ metric_id: str
+ title: str
+ kind: str
+ role: str
+ value: float
+ series: list[float] | None
+ value_format: str
+ unit: str | None
+ query: dict[str, Any]
+
+
+@dataclass(frozen=True)
+class BriefingItemChart:
+ """A chart from the report body. The hover card draws it when the report has no metric to chart."""
+
+ chart_id: str
+ title: str
+ query: dict[str, Any]
+
+
+@dataclass(frozen=True)
+class BriefingItemReport:
+ """What the left bar's hover card shows for a report, read live with the item's state."""
+
+ priority: str | None
+ summary: str
+ pull_request_state: str | None
+ pull_request_url: str | None
+ signal_count: int
+ updated_at: datetime
+ metrics: list[BriefingItemMetric]
+ charts: list[BriefingItemChart]
+
+
@dataclass(frozen=True)
class BriefingItem:
key: str
@@ -28,6 +67,8 @@ class BriefingItem:
state: ItemState
# For a report, the product its signals came from (error_tracking, session_replay, ...), else None.
source_product: str | None
+ # For a report that still exists, its live details, else None.
+ report: BriefingItemReport | None
@dataclass(frozen=True)
diff --git a/products/today/backend/facade/enums.py b/products/today/backend/facade/enums.py
index 3ac9283d917c..afd17daf7855 100644
--- a/products/today/backend/facade/enums.py
+++ b/products/today/backend/facade/enums.py
@@ -53,4 +53,7 @@ class ItemReason(StrEnum):
class ItemState(StrEnum):
OPEN = "open"
+ # Resolved, fixed or merged since the briefing was written.
DONE = "done"
+ # Dismissed or deleted since the briefing was written.
+ DISMISSED = "dismissed"
diff --git a/products/today/backend/logic/briefings.py b/products/today/backend/logic/briefings.py
index d1497e8dcc7d..9b7a2d225259 100644
--- a/products/today/backend/logic/briefings.py
+++ b/products/today/backend/logic/briefings.py
@@ -29,7 +29,12 @@ VIEW_STAMP_EVERY = timedelta(hours=1)
logger = structlog.get_logger(__name__)
-_DONE_REPORT_STATUSES = {"resolved", "suppressed", "deleted"}
+_DELETED_REPORT_STATUS = "deleted"
+_REPORT_STATES = {
+ "resolved": ItemState.DONE,
+ "suppressed": ItemState.DISMISSED,
+ _DELETED_REPORT_STATUS: ItemState.DISMISSED,
+}
def start_generation(briefing: DailyBriefing) -> None:
@@ -190,30 +195,76 @@ def _inbox_counts(team: Team, user: User, shown: list[FactSheetItem]) -> InboxCo
return InboxCounts(more_for_you=counts.for_person, open_in_project=counts.in_project)
-def _live_states(team: Team, items: list[FactSheetItem]) -> dict[str, ItemState]:
+def _report_details(
+ team: Team, items: list[FactSheetItem], metric_access: signals.ReportMetricAccessPolicy
+) -> dict[str, signals.BriefingReportDetails]:
report_ids = [item.key.split(":", 1)[1] for item in items if item.key.startswith("report:")]
- states: dict[str, ItemState] = {}
+ if not report_ids:
+ return {}
try:
- for state in signals.report_states(team_id=team.id, report_ids=report_ids):
- if state.status in _DONE_REPORT_STATUSES:
- states[f"report:{state.report_id}"] = ItemState.DONE
+ details = signals.report_details(team_id=team.id, report_ids=report_ids, metric_access=metric_access)
except Exception as error:
capture_exception(error, {"team_id": team.id, "product": "today"})
- return states
+ return {}
+ return {f"report:{detail.report_id}": detail for detail in details}
+
+
+def _live_states(reports: dict[str, signals.BriefingReportDetails]) -> dict[str, ItemState]:
+ """Which reports were resolved or dismissed since the briefing was written."""
+ return {key: _REPORT_STATES[detail.status] for key, detail in reports.items() if detail.status in _REPORT_STATES}
+
+
+def _report_contract(detail: signals.BriefingReportDetails) -> contracts.BriefingItemReport | None:
+ # A deleted report keeps its state on the item, but none of its content, as in the Inbox.
+ if detail.status == _DELETED_REPORT_STATUS:
+ return None
+ return contracts.BriefingItemReport(
+ priority=detail.priority,
+ summary=detail.summary,
+ pull_request_state=detail.pull_request_state,
+ pull_request_url=detail.pull_request_url,
+ signal_count=detail.signal_count,
+ updated_at=detail.updated_at,
+ metrics=[
+ contracts.BriefingItemMetric(
+ metric_id=metric.metric_id,
+ title=metric.title,
+ kind=metric.kind,
+ role=metric.role,
+ value=metric.value,
+ series=metric.series,
+ value_format=metric.value_format,
+ unit=metric.unit,
+ query=metric.query,
+ )
+ for metric in detail.metrics
+ ],
+ charts=[
+ contracts.BriefingItemChart(chart_id=chart.chart_id, title=chart.title, query=chart.query)
+ for chart in detail.charts
+ ],
+ )
def to_contract(
- briefing: DailyBriefing, team: Team, user: User, *, status: BriefingStatus | None = None
+ briefing: DailyBriefing,
+ team: Team,
+ user: User,
+ *,
+ metric_access: signals.ReportMetricAccessPolicy,
+ status: BriefingStatus | None = None,
) -> contracts.Briefing:
"""The briefing as the page shows it: only the items the text names, with live states and counts.
`status` overrides the row's own: while a newer briefing is being written, the
page gets the last ready one as `writing`, so it keeps showing the text and keeps polling.
+ `metric_access` is the viewer's access to report metrics, so the briefing hides what the Inbox hides.
"""
fact_sheet = stored_fact_sheet(briefing)
shown = fact_sheet.items if fact_sheet else []
content = BriefingContent.model_validate(briefing.content or {})
- states = _live_states(team, shown)
+ reports = _report_details(team, shown, metric_access)
+ states = _live_states(reports)
counts = _inbox_counts(team, user, shown)
return contracts.Briefing(
id=str(briefing.id),
@@ -241,6 +292,7 @@ def to_contract(
rank=item.rank,
state=states.get(item.key, ItemState.OPEN),
source_product=item.source_product,
+ report=_report_contract(reports[item.key]) if item.key in reports else None,
)
for item in shown
],
diff --git a/products/today/backend/presentation/serializers.py b/products/today/backend/presentation/serializers.py
index 39e12bdf809f..db6650124bfc 100644
--- a/products/today/backend/presentation/serializers.py
+++ b/products/today/backend/presentation/serializers.py
@@ -3,7 +3,19 @@
from rest_framework import serializers
from rest_framework_dataclasses.serializers import DataclassSerializer
-from ..facade.contracts import Briefing, BriefingItem, BriefingSegment, Candidate, CandidateFact, CandidateList
+from products.signals.backend.facade import api as signals
+
+from ..facade.contracts import (
+ Briefing,
+ BriefingItem,
+ BriefingItemChart,
+ BriefingItemMetric,
+ BriefingItemReport,
+ BriefingSegment,
+ Candidate,
+ CandidateFact,
+ CandidateList,
+)
class TodayQuerySerializer(serializers.Serializer):
@@ -26,6 +38,66 @@ class BriefingSegmentSerializer(DataclassSerializer):
dataclass = BriefingSegment
+class BriefingItemMetricSerializer(DataclassSerializer):
+ metric_id = serializers.CharField(help_text="Stable slug of the metric within its report.")
+ title = serializers.CharField(help_text="Short label of what the metric measures.")
+ kind = serializers.ChoiceField(
+ choices=signals.REPORT_METRIC_KINDS, help_text="What the value measures, for example affected_users."
+ )
+ role = serializers.ChoiceField(
+ choices=signals.REPORT_METRIC_ROLES,
+ help_text="`primary` for the report's key observation, otherwise `supporting`.",
+ )
+ value = serializers.FloatField(help_text="The latest saved snapshot of the metric.")
+ series = serializers.ListField(
+ child=serializers.FloatField(),
+ allow_null=True,
+ help_text="Trailing per-bucket values saved with the snapshot, oldest first. Null when none were saved.",
+ )
+ value_format = serializers.ChoiceField(
+ choices=signals.REPORT_METRIC_VALUE_FORMATS, help_text="How to format the value, for example count."
+ )
+ unit = serializers.CharField(allow_null=True, help_text="Optional short suffix or currency code, such as USD.")
+ query = serializers.JSONField(
+ help_text="The metric's live InsightVizNode wrapping one TrendsQuery, as the report stores it."
+ )
+
+ class Meta:
+ dataclass = BriefingItemMetric
+
+
+class BriefingItemChartSerializer(DataclassSerializer):
+ chart_id = serializers.CharField(help_text="Stable slug of the chart within its report.")
+ title = serializers.CharField(help_text="Short heading of the chart.")
+ query = serializers.JSONField(help_text="The query node the report body draws, as the report stores it.")
+
+ class Meta:
+ dataclass = BriefingItemChart
+
+
+class BriefingItemReportSerializer(DataclassSerializer):
+ priority = serializers.CharField(allow_null=True, help_text="The report's priority, P0 to P4, or null if unset.")
+ summary = serializers.CharField(help_text="The report's summary, shortened to a few sentences.")
+ pull_request_state = serializers.ChoiceField(
+ choices=signals.IMPLEMENTATION_PR_STATES,
+ allow_null=True,
+ help_text="State of the report's implementation pull request, or null when it has none.",
+ )
+ pull_request_url = serializers.CharField(
+ allow_null=True, help_text="URL of the report's implementation pull request, or null when it has none."
+ )
+ signal_count = serializers.IntegerField(help_text="How many signals the report groups.")
+ updated_at = serializers.DateTimeField(help_text="When the report last changed.")
+ metrics = BriefingItemMetricSerializer(
+ many=True, help_text="The report's metrics that have a saved snapshot, in the report's order."
+ )
+
+ charts = BriefingItemChartSerializer(many=True, help_text="The charts in the report body, in the report's order.")
+
+ class Meta:
+ dataclass = BriefingItemReport
+
+
class BriefingItemSerializer(DataclassSerializer):
key = serializers.CharField(
help_text="Stable item key, for example report:<uuid>, dashboard:<id> or ticket:<uuid>."
@@ -42,9 +114,18 @@ class BriefingItemSerializer(DataclassSerializer):
allow_null=True,
help_text="For a report, the product its signals came from, for example error_tracking or session_replay. Null for every other item.",
)
+ report = BriefingItemReportSerializer(
+ allow_null=True,
+ help_text="For a report, its priority, summary, implementation pull request and the metric snapshots the viewer may read. Null for every other item and for a deleted report.",
+ )
class Meta:
dataclass = BriefingItem
+ extra_kwargs = {
+ "state": {
+ "help_text": "`done` when the item was resolved since the briefing was written, `dismissed` when it was dismissed or suppressed, else `open`. Pull requests always stay `open`."
+ },
+ }
class BriefingSerializer(DataclassSerializer):
diff --git a/products/today/backend/presentation/views.py b/products/today/backend/presentation/views.py
index b0c890475930..16424fd28dde 100644
--- a/products/today/backend/presentation/views.py
+++ b/products/today/backend/presentation/views.py
@@ -13,6 +13,8 @@ from posthog.api.mixins import validated_request
from posthog.api.routing import TeamAndOrgViewSetMixin
from posthog.models import User
+from products.signals.backend.facade import api as signals
+
from ..facade import api
from .serializers import BriefingSerializer, CandidateListSerializer, TodayQuerySerializer
@@ -39,7 +41,10 @@ class TodayViewSet(TeamAndOrgViewSetMixin, viewsets.ViewSet):
def briefing(self, request: Request, **kwargs) -> Response:
user = self._user()
briefing = api.get_briefing(
- team=self.team, user=user, timezone_name=request.validated_query_data.get("timezone")
+ team=self.team,
+ user=user,
+ timezone_name=request.validated_query_data.get("timezone"),
+ metric_access=signals.ReportMetricAccessPolicy(request=request, team=self.team),
)
return Response(BriefingSerializer(briefing).data)
@@ -53,7 +58,10 @@ class TodayViewSet(TeamAndOrgViewSetMixin, viewsets.ViewSet):
def refresh(self, request: Request, **kwargs) -> Response:
user = self._user()
briefing = api.refresh_briefing(
- team=self.team, user=user, timezone_name=request.validated_query_data.get("timezone")
+ team=self.team,
+ user=user,
+ timezone_name=request.validated_query_data.get("timezone"),
+ metric_access=signals.ReportMetricAccessPolicy(request=request, team=self.team),
)
return Response(BriefingSerializer(briefing).data)
diff --git a/products/today/backend/tests/test_briefing_items.py b/products/today/backend/tests/test_briefing_items.py
new file mode 100644
index 000000000000..cd3699e92db4
--- /dev/null
+++ b/products/today/backend/tests/test_briefing_items.py
@@ -0,0 +1,117 @@
+import uuid
+from datetime import UTC, date, datetime
+
+from unittest.mock import MagicMock, patch
+
+from django.test import SimpleTestCase
+
+from posthog.models import Team, User
+
+from products.signals.backend.facade import api as signals
+from products.today.backend.facade.enums import BriefingStatus, ItemGroup, ItemReason, ItemSource, ItemState
+from products.today.backend.logic import briefings
+from products.today.backend.logic.fact_sheet import FactSheet, FactSheetItem
+from products.today.backend.models import DailyBriefing
+
+RESOLVED_REPORT = uuid.UUID("00000000-0000-4000-8000-000000000001")
+DISMISSED_REPORT = uuid.UUID("00000000-0000-4000-8000-000000000002")
+OPEN_REPORT = uuid.UUID("00000000-0000-4000-8000-000000000003")
+MISSING_REPORT = uuid.UUID("00000000-0000-4000-8000-000000000004")
+DELETED_REPORT = uuid.UUID("00000000-0000-4000-8000-000000000005")
+
+
+def _item(report_id: uuid.UUID) -> FactSheetItem:
+ return FactSheetItem(
+ key=f"report:{report_id}",
+ group=ItemGroup.REPORT,
+ source=ItemSource.SELF_DRIVING,
+ reason=ItemReason.WAITING_FOR_YOU,
+ title=str(report_id),
+ url="/project/1/inbox",
+ rank=1,
+ facts={},
+ )
+
+
+def _report_details(report_id: uuid.UUID, status: str) -> signals.BriefingReportDetails:
+ return signals.BriefingReportDetails(
+ report_id=str(report_id),
+ status=status,
+ priority="P1",
+ summary="Checkout fails for some users",
+ pull_request_state="merged",
+ pull_request_url="https://github.com/example/app/pull/1",
+ signal_count=12,
+ updated_at=datetime(2026, 9, 30, 12, 0, tzinfo=UTC),
+ metrics=[
+ signals.ReportMetricSnapshot(
+ metric_id="affected-users",
+ title="Affected users",
+ kind="affected_users",
+ role="primary",
+ value=42.0,
+ series=[10.0, 20.0, 42.0],
+ value_format="count",
+ unit="users",
+ query={"kind": "InsightVizNode"},
+ )
+ ],
+ charts=[],
+ )
+
+
+class TestBriefingItemStates(SimpleTestCase):
+ def test_items_show_what_was_resolved_or_dismissed_since_the_briefing_was_written(self) -> None:
+ items = [
+ _item(RESOLVED_REPORT),
+ _item(DISMISSED_REPORT),
+ _item(OPEN_REPORT),
+ _item(MISSING_REPORT),
+ _item(DELETED_REPORT),
+ ]
+ briefing = DailyBriefing(
+ id=uuid.uuid4(),
+ team_id=1,
+ user_id=1,
+ local_day=date(2026, 10, 1),
+ status=BriefingStatus.READY,
+ facts=FactSheet(items=items).model_dump(mode="json"),
+ content={},
+ created_at=datetime(2026, 10, 1, 6, 0, tzinfo=UTC),
+ )
+
+ with (
+ patch.object(
+ briefings.signals,
+ "report_details",
+ return_value=[
+ _report_details(RESOLVED_REPORT, "resolved"),
+ _report_details(DISMISSED_REPORT, "suppressed"),
+ _report_details(OPEN_REPORT, "ready"),
+ _report_details(DELETED_REPORT, "deleted"),
+ ],
+ ),
+ patch.object(
+ briefings.signals,
+ "open_report_counts",
+ return_value=signals.OpenReportCounts(for_person=0, in_project=0),
+ ),
+ ):
+ contract = briefings.to_contract(briefing, Team(id=1), User(id=1), metric_access=MagicMock())
+
+ assert {item.key: item.state for item in contract.items} == {
+ f"report:{RESOLVED_REPORT}": ItemState.DONE,
+ f"report:{DISMISSED_REPORT}": ItemState.DISMISSED,
+ f"report:{OPEN_REPORT}": ItemState.OPEN,
+ f"report:{MISSING_REPORT}": ItemState.OPEN,
+ f"report:{DELETED_REPORT}": ItemState.DISMISSED,
+ }
+ report = next(item.report for item in contract.items if item.key == f"report:{RESOLVED_REPORT}")
+ assert report is not None
+ assert (report.priority, report.pull_request_state, [(m.value, m.query) for m in report.metrics]) == (
+ "P1",
+ "merged",
+ [(42.0, {"kind": "InsightVizNode"})],
+ )
+ reports_without_details = [item.key for item in contract.items if item.report is None]
+ assert reports_without_details == [f"report:{MISSING_REPORT}", f"report:{DELETED_REPORT}"]
diff --git a/products/today/frontend/generated/api.schemas.ts b/products/today/frontend/generated/api.schemas.ts
index 5bc3af0071e6..1f0f6bf85b9f 100644
--- a/products/today/frontend/generated/api.schemas.ts
+++ b/products/today/frontend/generated/api.schemas.ts
@@ -19,6 +19,159 @@ export interface BriefingSegmentApi {
highlight: boolean
}
+/**
+ * * `draft` - draft
+ * * `open` - open
+ * * `closed` - closed
+ * * `merged` - merged
+ */
+export type PullRequestStateEnumApi = (typeof PullRequestStateEnumApi)[keyof typeof PullRequestStateEnumApi]
+
+export const PullRequestStateEnumApi = {
+ Draft: 'draft',
+ Open: 'open',
+ Closed: 'closed',
+ Merged: 'merged',
+} as const
+
+/**
+ * * `affected_users` - affected_users
+ * * `affected_sessions` - affected_sessions
+ * * `occurrences` - occurrences
+ * * `conversion_rate` - conversion_rate
+ * * `error_rate` - error_rate
+ * * `duration` - duration
+ * * `revenue` - revenue
+ * * `custom` - custom
+ */
+export type ReportMetricKindEnumApi = (typeof ReportMetricKindEnumApi)[keyof typeof ReportMetricKindEnumApi]
+
+export const ReportMetricKindEnumApi = {
+ AffectedUsers: 'affected_users',
+ AffectedSessions: 'affected_sessions',
+ Occurrences: 'occurrences',
+ ConversionRate: 'conversion_rate',
+ ErrorRate: 'error_rate',
+ Duration: 'duration',
+ Revenue: 'revenue',
+ Custom: 'custom',
+} as const
+
+/**
+ * * `primary` - primary
+ * * `supporting` - supporting
+ */
+export type RoleEnumApi = (typeof RoleEnumApi)[keyof typeof RoleEnumApi]
+
+export const RoleEnumApi = {
+ Primary: 'primary',
+ Supporting: 'supporting',
+} as const
+
+/**
+ * * `number` - number
+ * * `count` - count
+ * * `percentage` - percentage
+ * * `percentage_scaled` - percentage_scaled
+ * * `duration` - duration
+ * * `currency` - currency
+ */
+export type ValueFormatEnumApi = (typeof ValueFormatEnumApi)[keyof typeof ValueFormatEnumApi]
+
+export const ValueFormatEnumApi = {
+ Number: 'number',
+ Count: 'count',
+ Percentage: 'percentage',
+ PercentageScaled: 'percentage_scaled',
+ Duration: 'duration',
+ Currency: 'currency',
+} as const
+
+export interface BriefingItemMetricApi {
+ /** Stable slug of the metric within its report. */
+ metric_id: string
+ /** Short label of what the metric measures. */
+ title: string
+ /** What the value measures, for example affected_users.
+ *
+ * * `affected_users` - affected_users
+ * * `affected_sessions` - affected_sessions
+ * * `occurrences` - occurrences
+ * * `conversion_rate` - conversion_rate
+ * * `error_rate` - error_rate
+ * * `duration` - duration
+ * * `revenue` - revenue
+ * * `custom` - custom */
+ kind: ReportMetricKindEnumApi
+ /** `primary` for the report's key observation, otherwise `supporting`.
+ *
+ * * `primary` - primary
+ * * `supporting` - supporting */
+ role: RoleEnumApi
+ /** The latest saved snapshot of the metric. */
+ value: number
+ /**
+ * Trailing per-bucket values saved with the snapshot, oldest first. Null when none were saved.
+ * @nullable
+ */
+ series: number[] | null
+ /** How to format the value, for example count.
+ *
+ * * `number` - number
+ * * `count` - count
+ * * `percentage` - percentage
+ * * `percentage_scaled` - percentage_scaled
+ * * `duration` - duration
+ * * `currency` - currency */
+ value_format: ValueFormatEnumApi
+ /**
+ * Optional short suffix or currency code, such as USD.
+ * @nullable
+ */
+ unit: string | null
+ /** The metric's live InsightVizNode wrapping one TrendsQuery, as the report stores it. */
+ query: unknown
+}
+
+export interface BriefingItemChartApi {
+ /** Stable slug of the chart within its report. */
+ chart_id: string
+ /** Short heading of the chart. */
+ title: string
+ /** The query node the report body draws, as the report stores it. */
+ query: unknown
+}
+
+export interface BriefingItemReportApi {
+ /**
+ * The report's priority, P0 to P4, or null if unset.
+ * @nullable
+ */
+ priority: string | null
+ /** The report's summary, shortened to a few sentences. */
+ summary: string
+ /** State of the report's implementation pull request, or null when it has none.
+ *
+ * * `draft` - draft
+ * * `open` - open
+ * * `closed` - closed
+ * * `merged` - merged */
+ pull_request_state: PullRequestStateEnumApi | null
+ /**
+ * URL of the report's implementation pull request, or null when it has none.
+ * @nullable
+ */
+ pull_request_url: string | null
+ /** How many signals the report groups. */
+ signal_count: number
+ /** When the report last changed. */
+ updated_at: string
+ /** The report's metrics that have a saved snapshot, in the report's order. */
+ metrics: BriefingItemMetricApi[]
+ /** The charts in the report body, in the report's order. */
+ charts: BriefingItemChartApi[]
+}
+
/**
* * `report` - REPORT
* * `dashboard` - DASHBOARD
@@ -87,12 +240,14 @@ export const TodayItemReasonEnumApi = {
/**
* * `open` - OPEN
* * `done` - DONE
+ * * `dismissed` - DISMISSED
*/
export type BriefingItemStateEnumApi = (typeof BriefingItemStateEnumApi)[keyof typeof BriefingItemStateEnumApi]
export const BriefingItemStateEnumApi = {
Open: 'open',
Done: 'done',
+ Dismissed: 'dismissed',
} as const
export interface BriefingItemApi {
@@ -113,9 +268,16 @@ export interface BriefingItemApi {
* @nullable
*/
source_product: string | null
+ /** For a report, its priority, summary, implementation pull request and the metric snapshots the viewer may read. Null for every other item and for a deleted report. */
+ report: BriefingItemReportApi | null
group: TodayItemGroupEnumApi
source: TodayItemSourceEnumApi
reason: TodayItemReasonEnumApi
+ /** `done` when the item was resolved since the briefing was written, `dismissed` when it was dismissed or suppressed, else `open`. Pull requests always stay `open`.
+ *
+ * * `open` - OPEN
+ * * `done` - DONE
+ * * `dismissed` - DISMISSED */
state: BriefingItemStateEnumApi
}
diff --git a/products/today/frontend/generated/api.zod.schemas.ts b/products/today/frontend/generated/api.zod.schemas.ts
index 5ea67ca4d0bb..4788961246b6 100644
--- a/products/today/frontend/generated/api.zod.schemas.ts
+++ b/products/today/frontend/generated/api.zod.schemas.ts
@@ -18,6 +18,187 @@ export const BriefingSegmentApi = zod.object({
export type BriefingSegmentApi = zod.input<typeof BriefingSegmentApi>
export type BriefingSegmentApiOutput = zod.output<typeof BriefingSegmentApi>
+export const PullRequestStateEnumApi = zod
+ .enum(['draft', 'open', 'closed', 'merged'])
+ .describe('\* `draft` - draft\n\* `open` - open\n\* `closed` - closed\n\* `merged` - merged')
+
+export type PullRequestStateEnumApi = zod.input<typeof PullRequestStateEnumApi>
+export type PullRequestStateEnumApiOutput = zod.output<typeof PullRequestStateEnumApi>
+
+export const ReportMetricKindEnumApi = zod
+ .enum([
+ 'affected_users',
+ 'affected_sessions',
+ 'occurrences',
+ 'conversion_rate',
+ 'error_rate',
+ 'duration',
+ 'revenue',
+ 'custom',
+ ])
+ .describe(
+ '\* `affected_users` - affected_users\n\* `affected_sessions` - affected_sessions\n\* `occurrences` - occurrences\n\* `conversion_rate` - conversion_rate\n\* `error_rate` - error_rate\n\* `duration` - duration\n\* `revenue` - revenue\n\* `custom` - custom'
+ )
+
+export type ReportMetricKindEnumApi = zod.input<typeof ReportMetricKindEnumApi>
+export type ReportMetricKindEnumApiOutput = zod.output<typeof ReportMetricKindEnumApi>
+
+export const RoleEnumApi = zod
+ .enum(['primary', 'supporting'])
+ .describe('\* `primary` - primary\n\* `supporting` - supporting')
+
+export type RoleEnumApi = zod.input<typeof RoleEnumApi>
+export type RoleEnumApiOutput = zod.output<typeof RoleEnumApi>
+
+export const ValueFormatEnumApi = zod
+ .enum(['number', 'count', 'percentage', 'percentage_scaled', 'duration', 'currency'])
+ .describe(
+ '\* `number` - number\n\* `count` - count\n\* `percentage` - percentage\n\* `percentage_scaled` - percentage_scaled\n\* `duration` - duration\n\* `currency` - currency'
+ )
+
+export type ValueFormatEnumApi = zod.input<typeof ValueFormatEnumApi>
+export type ValueFormatEnumApiOutput = zod.output<typeof ValueFormatEnumApi>
+
+export const BriefingItemMetricApi = zod.object({
+ metric_id: zod.string().describe('Stable slug of the metric within its report.'),
+ title: zod.string().describe('Short label of what the metric measures.'),
+ kind: zod
+ .enum([
+ 'affected_users',
+ 'affected_sessions',
+ 'occurrences',
+ 'conversion_rate',
+ 'error_rate',
+ 'duration',
+ 'revenue',
+ 'custom',
+ ])
+ .describe(
+ '\* `affected_users` - affected_users\n\* `affected_sessions` - affected_sessions\n\* `occurrences` - occurrences\n\* `conversion_rate` - conversion_rate\n\* `error_rate` - error_rate\n\* `duration` - duration\n\* `revenue` - revenue\n\* `custom` - custom'
+ )
+ .describe(
+ 'What the value measures, for example affected_users.\n\n\* `affected_users` - affected_users\n\* `affected_sessions` - affected_sessions\n\* `occurrences` - occurrences\n\* `conversion_rate` - conversion_rate\n\* `error_rate` - error_rate\n\* `duration` - duration\n\* `revenue` - revenue\n\* `custom` - custom'
+ ),
+ role: zod
+ .enum(['primary', 'supporting'])
+ .describe('\* `primary` - primary\n\* `supporting` - supporting')
+ .describe(
+ "`primary` for the report's key observation, otherwise `supporting`.\n\n\* `primary` - primary\n\* `supporting` - supporting"
+ ),
+ value: zod.number().describe('The latest saved snapshot of the metric.'),
+ series: zod
+ .array(zod.number())
+ .nullable()
+ .describe('Trailing per-bucket values saved with the snapshot, oldest first. Null when none were saved.'),
+ value_format: zod
+ .enum(['number', 'count', 'percentage', 'percentage_scaled', 'duration', 'currency'])
+ .describe(
+ '\* `number` - number\n\* `count` - count\n\* `percentage` - percentage\n\* `percentage_scaled` - percentage_scaled\n\* `duration` - duration\n\* `currency` - currency'
+ )
+ .describe(
+ 'How to format the value, for example count.\n\n\* `number` - number\n\* `count` - count\n\* `percentage` - percentage\n\* `percentage_scaled` - percentage_scaled\n\* `duration` - duration\n\* `currency` - currency'
+ ),
+ unit: zod.string().nullable().describe('Optional short suffix or currency code, such as USD.'),
+ query: zod
+ .unknown()
+ .describe("The metric's live InsightVizNode wrapping one TrendsQuery, as the report stores it."),
+})
+
+export type BriefingItemMetricApi = zod.input<typeof BriefingItemMetricApi>
+export type BriefingItemMetricApiOutput = zod.output<typeof BriefingItemMetricApi>
+
+export const BriefingItemChartApi = zod.object({
+ chart_id: zod.string().describe('Stable slug of the chart within its report.'),
+ title: zod.string().describe('Short heading of the chart.'),
+ query: zod.unknown().describe('The query node the report body draws, as the report stores it.'),
+})
+
+export type BriefingItemChartApi = zod.input<typeof BriefingItemChartApi>
+export type BriefingItemChartApiOutput = zod.output<typeof BriefingItemChartApi>
+
+export const BriefingItemReportApi = zod.object({
+ priority: zod.string().nullable().describe("The report's priority, P0 to P4, or null if unset."),
+ summary: zod.string().describe("The report's summary, shortened to a few sentences."),
+ pull_request_state: zod
+ .union([
+ zod
+ .enum(['draft', 'open', 'closed', 'merged'])
+ .describe('\* `draft` - draft\n\* `open` - open\n\* `closed` - closed\n\* `merged` - merged'),
+ zod.null(),
+ ])
+ .describe(
+ "State of the report's implementation pull request, or null when it has none.\n\n\* `draft` - draft\n\* `open` - open\n\* `closed` - closed\n\* `merged` - merged"
+ ),
+ pull_request_url: zod
+ .string()
+ .nullable()
+ .describe("URL of the report's implementation pull request, or null when it has none."),
+ signal_count: zod.number().describe('How many signals the report groups.'),
+ updated_at: zod.iso.datetime({ offset: true }).describe('When the report last changed.'),
+ metrics: zod
+ .array(
+ zod.object({
+ metric_id: zod.string().describe('Stable slug of the metric within its report.'),
+ title: zod.string().describe('Short label of what the metric measures.'),
+ kind: zod
+ .enum([
+ 'affected_users',
+ 'affected_sessions',
+ 'occurrences',
+ 'conversion_rate',
+ 'error_rate',
+ 'duration',
+ 'revenue',
+ 'custom',
+ ])
+ .describe(
+ '\* `affected_users` - affected_users\n\* `affected_sessions` - affected_sessions\n\* `occurrences` - occurrences\n\* `conversion_rate` - conversion_rate\n\* `error_rate` - error_rate\n\* `duration` - duration\n\* `revenue` - revenue\n\* `custom` - custom'
+ )
+ .describe(
+ 'What the value measures, for example affected_users.\n\n\* `affected_users` - affected_users\n\* `affected_sessions` - affected_sessions\n\* `occurrences` - occurrences\n\* `conversion_rate` - conversion_rate\n\* `error_rate` - error_rate\n\* `duration` - duration\n\* `revenue` - revenue\n\* `custom` - custom'
+ ),
+ role: zod
+ .enum(['primary', 'supporting'])
+ .describe('\* `primary` - primary\n\* `supporting` - supporting')
+ .describe(
+ "`primary` for the report's key observation, otherwise `supporting`.\n\n\* `primary` - primary\n\* `supporting` - supporting"
+ ),
+ value: zod.number().describe('The latest saved snapshot of the metric.'),
+ series: zod
+ .array(zod.number())
+ .nullable()
+ .describe(
+ 'Trailing per-bucket values saved with the snapshot, oldest first. Null when none were saved.'
+ ),
+ value_format: zod
+ .enum(['number', 'count', 'percentage', 'percentage_scaled', 'duration', 'currency'])
+ .describe(
+ '\* `number` - number\n\* `count` - count\n\* `percentage` - percentage\n\* `percentage_scaled` - percentage_scaled\n\* `duration` - duration\n\* `currency` - currency'
+ )
+ .describe(
+ 'How to format the value, for example count.\n\n\* `number` - number\n\* `count` - count\n\* `percentage` - percentage\n\* `percentage_scaled` - percentage_scaled\n\* `duration` - duration\n\* `currency` - currency'
+ ),
+ unit: zod.string().nullable().describe('Optional short suffix or currency code, such as USD.'),
+ query: zod
+ .unknown()
+ .describe("The metric's live InsightVizNode wrapping one TrendsQuery, as the report stores it."),
+ })
+ )
+ .describe("The report's metrics that have a saved snapshot, in the report's order."),
+ charts: zod
+ .array(
+ zod.object({
+ chart_id: zod.string().describe('Stable slug of the chart within its report.'),
+ title: zod.string().describe('Short heading of the chart.'),
+ query: zod.unknown().describe('The query node the report body draws, as the report stores it.'),
+ })
+ )
+ .describe("The charts in the report body, in the report's order."),
+})
+
+export type BriefingItemReportApi = zod.input<typeof BriefingItemReportApi>
+export type BriefingItemReportApiOutput = zod.output<typeof BriefingItemReportApi>
+
export const TodayItemGroupEnumApi = zod
.enum(['report', 'dashboard', 'other'])
.describe('\* `report` - REPORT\n\* `dashboard` - DASHBOARD\n\* `other` - OTHER')
@@ -57,7 +238,9 @@ export const TodayItemReasonEnumApi = zod
export type TodayItemReasonEnumApi = zod.input<typeof TodayItemReasonEnumApi>
export type TodayItemReasonEnumApiOutput = zod.output<typeof TodayItemReasonEnumApi>
-export const BriefingItemStateEnumApi = zod.enum(['open', 'done']).describe('\* `open` - OPEN\n\* `done` - DONE')
+export const BriefingItemStateEnumApi = zod
+ .enum(['open', 'done', 'dismissed'])
+ .describe('\* `open` - OPEN\n\* `done` - DONE\n\* `dismissed` - DISMISSED')
export type BriefingItemStateEnumApi = zod.input<typeof BriefingItemStateEnumApi>
export type BriefingItemStateEnumApiOutput = zod.output<typeof BriefingItemStateEnumApi>
@@ -75,6 +258,101 @@ export const BriefingItemApi = zod.object({
.describe(
'For a report, the product its signals came from, for example error_tracking or session_replay. Null for every other item.'
),
+ report: zod
+ .union([
+ zod.object({
+ priority: zod.string().nullable().describe("The report's priority, P0 to P4, or null if unset."),
+ summary: zod.string().describe("The report's summary, shortened to a few sentences."),
+ pull_request_state: zod
+ .union([
+ zod
+ .enum(['draft', 'open', 'closed', 'merged'])
+ .describe(
+ '\* `draft` - draft\n\* `open` - open\n\* `closed` - closed\n\* `merged` - merged'
+ ),
+ zod.null(),
+ ])
+ .describe(
+ "State of the report's implementation pull request, or null when it has none.\n\n\* `draft` - draft\n\* `open` - open\n\* `closed` - closed\n\* `merged` - merged"
+ ),
+ pull_request_url: zod
+ .string()
+ .nullable()
+ .describe("URL of the report's implementation pull request, or null when it has none."),
+ signal_count: zod.number().describe('How many signals the report groups.'),
+ updated_at: zod.iso.datetime({ offset: true }).describe('When the report last changed.'),
+ metrics: zod
+ .array(
+ zod.object({
+ metric_id: zod.string().describe('Stable slug of the metric within its report.'),
+ title: zod.string().describe('Short label of what the metric measures.'),
+ kind: zod
+ .enum([
+ 'affected_users',
+ 'affected_sessions',
+ 'occurrences',
+ 'conversion_rate',
+ 'error_rate',
+ 'duration',
+ 'revenue',
+ 'custom',
+ ])
+ .describe(
+ '\* `affected_users` - affected_users\n\* `affected_sessions` - affected_sessions\n\* `occurrences` - occurrences\n\* `conversion_rate` - conversion_rate\n\* `error_rate` - error_rate\n\* `duration` - duration\n\* `revenue` - revenue\n\* `custom` - custom'
+ )
+ .describe(
+ 'What the value measures, for example affected_users.\n\n\* `affected_users` - affected_users\n\* `affected_sessions` - affected_sessions\n\* `occurrences` - occurrences\n\* `conversion_rate` - conversion_rate\n\* `error_rate` - error_rate\n\* `duration` - duration\n\* `revenue` - revenue\n\* `custom` - custom'
+ ),
+ role: zod
+ .enum(['primary', 'supporting'])
+ .describe('\* `primary` - primary\n\* `supporting` - supporting')
+ .describe(
+ "`primary` for the report's key observation, otherwise `supporting`.\n\n\* `primary` - primary\n\* `supporting` - supporting"
+ ),
+ value: zod.number().describe('The latest saved snapshot of the metric.'),
+ series: zod
+ .array(zod.number())
+ .nullable()
+ .describe(
+ 'Trailing per-bucket values saved with the snapshot, oldest first. Null when none were saved.'
+ ),
+ value_format: zod
+ .enum(['number', 'count', 'percentage', 'percentage_scaled', 'duration', 'currency'])
+ .describe(
+ '\* `number` - number\n\* `count` - count\n\* `percentage` - percentage\n\* `percentage_scaled` - percentage_scaled\n\* `duration` - duration\n\* `currency` - currency'
+ )
+ .describe(
+ 'How to format the value, for example count.\n\n\* `number` - number\n\* `count` - count\n\* `percentage` - percentage\n\* `percentage_scaled` - percentage_scaled\n\* `duration` - duration\n\* `currency` - currency'
+ ),
+ unit: zod
+ .string()
+ .nullable()
+ .describe('Optional short suffix or currency code, such as USD.'),
+ query: zod
+ .unknown()
+ .describe(
+ "The metric's live InsightVizNode wrapping one TrendsQuery, as the report stores it."
+ ),
+ })
+ )
+ .describe("The report's metrics that have a saved snapshot, in the report's order."),
+ charts: zod
+ .array(
+ zod.object({
+ chart_id: zod.string().describe('Stable slug of the chart within its report.'),
+ title: zod.string().describe('Short heading of the chart.'),
+ query: zod
+ .unknown()
+ .describe('The query node the report body draws, as the report stores it.'),
+ })
+ )
+ .describe("The charts in the report body, in the report's order."),
+ }),
+ zod.null(),
+ ])
+ .describe(
+ 'For a report, its priority, summary, implementation pull request and the metric snapshots the viewer may read. Null for every other item and for a deleted report.'
+ ),
group: zod
.enum(['report', 'dashboard', 'other'])
.describe('\* `report` - REPORT\n\* `dashboard` - DASHBOARD\n\* `other` - OTHER'),
@@ -102,7 +380,12 @@ export const BriefingItemApi = zod.object({
.describe(
'\* `claimed_by_you` - CLAIMED_BY_YOU\n\* `waiting_for_you` - WAITING_FOR_YOU\n\* `suggested_reviewer` - SUGGESTED_REVIEWER\n\* `urgent_for_project` - URGENT_FOR_PROJECT\n\* `dashboard_you_viewed` - DASHBOARD_YOU_VIEWED\n\* `dashboard_you_starred` - DASHBOARD_YOU_STARRED\n\* `insight_you_viewed` - INSIGHT_YOU_VIEWED\n\* `insight_you_starred` - INSIGHT_YOU_STARRED\n\* `alert_firing` - ALERT_FIRING\n\* `assigned_ticket` - ASSIGNED_TICKET\n\* `assigned_error_issue` - ASSIGNED_ERROR_ISSUE\n\* `review_requested` - REVIEW_REQUESTED\n\* `your_pull_request` - YOUR_PULL_REQUEST'
),
- state: zod.enum(['open', 'done']).describe('\* `open` - OPEN\n\* `done` - DONE'),
+ state: zod
+ .enum(['open', 'done', 'dismissed'])
+ .describe('\* `open` - OPEN\n\* `done` - DONE\n\* `dismissed` - DISMISSED')
+ .describe(
+ '`done` when the item was resolved since the briefing was written, `dismissed` when it was dismissed or suppressed, else `open`. Pull requests always stay `open`.\n\n\* `open` - OPEN\n\* `done` - DONE\n\* `dismissed` - DISMISSED'
+ ),
})
export type BriefingItemApi = zod.input<typeof BriefingItemApi>
@@ -157,6 +440,113 @@ export const BriefingApi = zod.object({
.describe(
'For a report, the product its signals came from, for example error_tracking or session_replay. Null for every other item.'
),
+ report: zod
+ .union([
+ zod.object({
+ priority: zod
+ .string()
+ .nullable()
+ .describe("The report's priority, P0 to P4, or null if unset."),
+ summary: zod.string().describe("The report's summary, shortened to a few sentences."),
+ pull_request_state: zod
+ .union([
+ zod
+ .enum(['draft', 'open', 'closed', 'merged'])
+ .describe(
+ '\* `draft` - draft\n\* `open` - open\n\* `closed` - closed\n\* `merged` - merged'
+ ),
+ zod.null(),
+ ])
+ .describe(
+ "State of the report's implementation pull request, or null when it has none.\n\n\* `draft` - draft\n\* `open` - open\n\* `closed` - closed\n\* `merged` - merged"
+ ),
+ pull_request_url: zod
+ .string()
+ .nullable()
+ .describe("URL of the report's implementation pull request, or null when it has none."),
+ signal_count: zod.number().describe('How many signals the report groups.'),
+ updated_at: zod.iso.datetime({ offset: true }).describe('When the report last changed.'),
+ metrics: zod
+ .array(
+ zod.object({
+ metric_id: zod
+ .string()
+ .describe('Stable slug of the metric within its report.'),
+ title: zod.string().describe('Short label of what the metric measures.'),
+ kind: zod
+ .enum([
+ 'affected_users',
+ 'affected_sessions',
+ 'occurrences',
+ 'conversion_rate',
+ 'error_rate',
+ 'duration',
+ 'revenue',
+ 'custom',
+ ])
+ .describe(
+ '\* `affected_users` - affected_users\n\* `affected_sessions` - affected_sessions\n\* `occurrences` - occurrences\n\* `conversion_rate` - conversion_rate\n\* `error_rate` - error_rate\n\* `duration` - duration\n\* `revenue` - revenue\n\* `custom` - custom'
+ )
+ .describe(
+ 'What the value measures, for example affected_users.\n\n\* `affected_users` - affected_users\n\* `affected_sessions` - affected_sessions\n\* `occurrences` - occurrences\n\* `conversion_rate` - conversion_rate\n\* `error_rate` - error_rate\n\* `duration` - duration\n\* `revenue` - revenue\n\* `custom` - custom'
+ ),
+ role: zod
+ .enum(['primary', 'supporting'])
+ .describe('\* `primary` - primary\n\* `supporting` - supporting')
+ .describe(
+ "`primary` for the report's key observation, otherwise `supporting`.\n\n\* `primary` - primary\n\* `supporting` - supporting"
+ ),
+ value: zod.number().describe('The latest saved snapshot of the metric.'),
+ series: zod
+ .array(zod.number())
+ .nullable()
+ .describe(
+ 'Trailing per-bucket values saved with the snapshot, oldest first. Null when none were saved.'
+ ),
+ value_format: zod
+ .enum([
+ 'number',
+ 'count',
+ 'percentage',
+ 'percentage_scaled',
+ 'duration',
+ 'currency',
+ ])
+ .describe(
+ '\* `number` - number\n\* `count` - count\n\* `percentage` - percentage\n\* `percentage_scaled` - percentage_scaled\n\* `duration` - duration\n\* `currency` - currency'
+ )
+ .describe(
+ 'How to format the value, for example count.\n\n\* `number` - number\n\* `count` - count\n\* `percentage` - percentage\n\* `percentage_scaled` - percentage_scaled\n\* `duration` - duration\n\* `currency` - currency'
+ ),
+ unit: zod
+ .string()
+ .nullable()
+ .describe('Optional short suffix or currency code, such as USD.'),
+ query: zod
+ .unknown()
+ .describe(
+ "The metric's live InsightVizNode wrapping one TrendsQuery, as the report stores it."
+ ),
+ })
+ )
+ .describe("The report's metrics that have a saved snapshot, in the report's order."),
+ charts: zod
+ .array(
+ zod.object({
+ chart_id: zod.string().describe('Stable slug of the chart within its report.'),
+ title: zod.string().describe('Short heading of the chart.'),
+ query: zod
+ .unknown()
+ .describe('The query node the report body draws, as the report stores it.'),
+ })
+ )
+ .describe("The charts in the report body, in the report's order."),
+ }),
+ zod.null(),
+ ])
+ .describe(
+ 'For a report, its priority, summary, implementation pull request and the metric snapshots the viewer may read. Null for every other item and for a deleted report.'
+ ),
group: zod
.enum(['report', 'dashboard', 'other'])
.describe('\* `report` - REPORT\n\* `dashboard` - DASHBOARD\n\* `other` - OTHER'),
@@ -184,7 +574,12 @@ export const BriefingApi = zod.object({
.describe(
'\* `claimed_by_you` - CLAIMED_BY_YOU\n\* `waiting_for_you` - WAITING_FOR_YOU\n\* `suggested_reviewer` - SUGGESTED_REVIEWER\n\* `urgent_for_project` - URGENT_FOR_PROJECT\n\* `dashboard_you_viewed` - DASHBOARD_YOU_VIEWED\n\* `dashboard_you_starred` - DASHBOARD_YOU_STARRED\n\* `insight_you_viewed` - INSIGHT_YOU_VIEWED\n\* `insight_you_starred` - INSIGHT_YOU_STARRED\n\* `alert_firing` - ALERT_FIRING\n\* `assigned_ticket` - ASSIGNED_TICKET\n\* `assigned_error_issue` - ASSIGNED_ERROR_ISSUE\n\* `review_requested` - REVIEW_REQUESTED\n\* `your_pull_request` - YOUR_PULL_REQUEST'
),
- state: zod.enum(['open', 'done']).describe('\* `open` - OPEN\n\* `done` - DONE'),
+ state: zod
+ .enum(['open', 'done', 'dismissed'])
+ .describe('\* `open` - OPEN\n\* `done` - DONE\n\* `dismissed` - DISMISSED')
+ .describe(
+ '`done` when the item was resolved since the briefing was written, `dismissed` when it was dismissed or suppressed, else `open`. Pull requests always stay `open`.\n\n\* `open` - OPEN\n\* `done` - DONE\n\* `dismissed` - DISMISSED'
+ ),
})
)
.describe('The items the text names, in rank order: what the page and the left bar show.'),
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index 36c91ae9687e..0f4acaad53aa 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -17959,6 +17959,163 @@ export namespace Schemas {
highlight: boolean;
}
+ /**
+ * * `draft` - draft
+ * * `open` - open
+ * * `closed` - closed
+ * * `merged` - merged
+ */
+ export type PullRequestStateEnum = typeof PullRequestStateEnum[keyof typeof PullRequestStateEnum];
+
+
+ export const PullRequestStateEnum = {
+ Draft: 'draft',
+ Open: 'open',
+ Closed: 'closed',
+ Merged: 'merged',
+ } as const;
+
+ /**
+ * * `affected_users` - affected_users
+ * * `affected_sessions` - affected_sessions
+ * * `occurrences` - occurrences
+ * * `conversion_rate` - conversion_rate
+ * * `error_rate` - error_rate
+ * * `duration` - duration
+ * * `revenue` - revenue
+ * * `custom` - custom
+ */
+ export type ReportMetricKindEnum = typeof ReportMetricKindEnum[keyof typeof ReportMetricKindEnum];
+
+
+ export const ReportMetricKindEnum = {
+ AffectedUsers: 'affected_users',
+ AffectedSessions: 'affected_sessions',
+ Occurrences: 'occurrences',
+ ConversionRate: 'conversion_rate',
+ ErrorRate: 'error_rate',
+ Duration: 'duration',
+ Revenue: 'revenue',
+ Custom: 'custom',
+ } as const;
+
+ /**
+ * * `primary` - primary
+ * * `supporting` - supporting
+ */
+ export type RoleEnum = typeof RoleEnum[keyof typeof RoleEnum];
+
+
+ export const RoleEnum = {
+ Primary: 'primary',
+ Supporting: 'supporting',
+ } as const;
+
+ /**
+ * * `number` - number
+ * * `count` - count
+ * * `percentage` - percentage
+ * * `percentage_scaled` - percentage_scaled
+ * * `duration` - duration
+ * * `currency` - currency
+ */
+ export type ValueFormatEnum = typeof ValueFormatEnum[keyof typeof ValueFormatEnum];
+
+
+ export const ValueFormatEnum = {
+ Number: 'number',
+ Count: 'count',
+ Percentage: 'percentage',
+ PercentageScaled: 'percentage_scaled',
+ Duration: 'duration',
+ Currency: 'currency',
+ } as const;
+
+ export interface BriefingItemMetric {
+ /** Stable slug of the metric within its report. */
+ metric_id: string;
+ /** Short label of what the metric measures. */
+ title: string;
+ /** What the value measures, for example affected_users.
+ *
+ * * `affected_users` - affected_users
+ * * `affected_sessions` - affected_sessions
+ * * `occurrences` - occurrences
+ * * `conversion_rate` - conversion_rate
+ * * `error_rate` - error_rate
+ * * `duration` - duration
+ * * `revenue` - revenue
+ * * `custom` - custom */
+ kind: ReportMetricKindEnum;
+ /** `primary` for the report's key observation, otherwise `supporting`.
+ *
+ * * `primary` - primary
+ * * `supporting` - supporting */
+ role: RoleEnum;
+ /** The latest saved snapshot of the metric. */
+ value: number;
+ /**
+ * Trailing per-bucket values saved with the snapshot, oldest first. Null when none were saved.
+ * @nullable
+ */
+ series: number[] | null;
+ /** How to format the value, for example count.
+ *
+ * * `number` - number
+ * * `count` - count
+ * * `percentage` - percentage
+ * * `percentage_scaled` - percentage_scaled
+ * * `duration` - duration
+ * * `currency` - currency */
+ value_format: ValueFormatEnum;
+ /**
+ * Optional short suffix or currency code, such as USD.
+ * @nullable
+ */
+ unit: string | null;
+ /** The metric's live InsightVizNode wrapping one TrendsQuery, as the report stores it. */
+ query: unknown;
+ }
+
+ export interface BriefingItemChart {
+ /** Stable slug of the chart within its report. */
+ chart_id: string;
+ /** Short heading of the chart. */
+ title: string;
+ /** The query node the report body draws, as the report stores it. */
+ query: unknown;
+ }
+
+ export interface BriefingItemReport {
+ /**
+ * The report's priority, P0 to P4, or null if unset.
+ * @nullable
+ */
+ priority: string | null;
+ /** The report's summary, shortened to a few sentences. */
+ summary: string;
+ /** State of the report's implementation pull request, or null when it has none.
+ *
+ * * `draft` - draft
+ * * `open` - open
+ * * `closed` - closed
+ * * `merged` - merged */
+ pull_request_state: PullRequestStateEnum | null;
+ /**
+ * URL of the report's implementation pull request, or null when it has none.
+ * @nullable
+ */
+ pull_request_url: string | null;
+ /** How many signals the report groups. */
+ signal_count: number;
+ /** When the report last changed. */
+ updated_at: string;
+ /** The report's metrics that have a saved snapshot, in the report's order. */
+ metrics: BriefingItemMetric[];
+ /** The charts in the report body, in the report's order. */
+ charts: BriefingItemChart[];
+ }
+
/**
* * `report` - REPORT
* * `dashboard` - DASHBOARD
@@ -18030,6 +18187,7 @@ export namespace Schemas {
/**
* * `open` - OPEN
* * `done` - DONE
+ * * `dismissed` - DISMISSED
*/
export type BriefingItemStateEnum = typeof BriefingItemStateEnum[keyof typeof BriefingItemStateEnum];
@@ -18037,6 +18195,7 @@ export namespace Schemas {
export const BriefingItemStateEnum = {
Open: 'open',
Done: 'done',
+ Dismissed: 'dismissed',
} as const;
export interface BriefingItem {
@@ -18057,9 +18216,16 @@ export namespace Schemas {
* @nullable
*/
source_product: string | null;
+ /** For a report, its priority, summary, implementation pull request and the metric snapshots the viewer may read. Null for every other item and for a deleted report. */
+ report: BriefingItemReport | null;
group: TodayItemGroupEnum;
source: TodayItemSourceEnum;
reason: TodayItemReasonEnum;
+ /** `done` when the item was resolved since the briefing was written, `dismissed` when it was dismissed or suppressed, else `open`. Pull requests always stay `open`.
+ *
+ * * `open` - OPEN
+ * * `done` - DONE
+ * * `dismissed` - DISMISSED */
state: BriefingItemStateEnum;
}
@@ -36682,62 +36848,6 @@ export namespace Schemas {
size?: SizeEnum | null;
}
- /**
- * * `affected_users` - affected_users
- * * `affected_sessions` - affected_sessions
- * * `occurrences` - occurrences
- * * `conversion_rate` - conversion_rate
- * * `error_rate` - error_rate
- * * `duration` - duration
- * * `revenue` - revenue
- * * `custom` - custom
- */
- export type ReportMetricKindEnum = typeof ReportMetricKindEnum[keyof typeof ReportMetricKindEnum];
-
-
- export const ReportMetricKindEnum = {
- AffectedUsers: 'affected_users',
- AffectedSessions: 'affected_sessions',
- Occurrences: 'occurrences',
- ConversionRate: 'conversion_rate',
- ErrorRate: 'error_rate',
- Duration: 'duration',
- Revenue: 'revenue',
- Custom: 'custom',
- } as const;
-
- /**
- * * `primary` - primary
- * * `supporting` - supporting
- */
- export type RoleEnum = typeof RoleEnum[keyof typeof RoleEnum];
-
-
- export const RoleEnum = {
- Primary: 'primary',
- Supporting: 'supporting',
- } as const;
-
- /**
- * * `number` - number
- * * `count` - count
- * * `percentage` - percentage
- * * `percentage_scaled` - percentage_scaled
- * * `duration` - duration
- * * `currency` - currency
- */
- export type ValueFormatEnum = typeof ValueFormatEnum[keyof typeof ValueFormatEnum];
-
-
- export const ValueFormatEnum = {
- Number: 'number',
- Count: 'count',
- Percentage: 'percentage',
- PercentageScaled: 'percentage_scaled',
- Duration: 'duration',
- Currency: 'currency',
- } as const;
-
/**
* * `at_most` - at_most
* * `at_least` - at_least
@@ -69928,6 +70038,8 @@ export namespace Schemas {
readonly title: string | null;
/** @nullable */
readonly summary: string | null;
+ /** The opening of `summary` as plain text on one line: the text before its first section heading, with chart links removed and other links reduced to their text. At most 450 characters. */
+ readonly summary_lead: string;
readonly status: SignalReportStatusEnum;
readonly total_weight: number;
readonly signal_count: number;
@@ -89867,6 +89979,8 @@ export namespace Schemas {
readonly title: string | null;
/** @nullable */
readonly summary: string | null;
+ /** The opening of `summary` as plain text on one line: the text before its first section heading, with chart links removed and other links reduced to their text. At most 450 characters. */
+ readonly summary_lead: string;
readonly status: SignalReportStatusEnum;
readonly total_weight: number;
readonly signal_count: number;