Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(inbox): prevent CI check summary overflow (#104150)

Mikayla Thompson28091ffad6db
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index 5bb0b531899c..05c7a143c77c 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -8677,9 +8677,9 @@ snapshots:
scenes-app-inbox-detail--pull-request-inline-review--light:
hash: v1.k794b7964.6e46ac95ee344c52fdb7114912898ff27879a61a5a068dc80c9b02c2c54cc68e.unkgZ1A8k6R9A6i-hqf5_Xr0lwtSjCAEBGUoFmvfnCI
scenes-app-inbox-detail--pull-request-legacy--dark:
- hash: v1.k794b7964.074de45c6f5baa4f8ce3a7237779f0969c7acd488a1114af4e3c383b3c20e036.ErG9aNxIG_IJWm6P-ksAXAOiIpYByMjGJvZDOzsxn1s
+ hash: v1.k794b7964.470d1e88df2f518ab6db75d63dc4a5cbf3bc8962076aeba3c01e93da44357ef7.485Oh2tV5VutyloOAvDqsY7z322l9SWXvG3R43uDiPE
scenes-app-inbox-detail--pull-request-legacy--light:
- hash: v1.k794b7964.c886f64ba1f93abb4afdd8b6876b1e47c03989331e453b747b33639f96750cce.-fi2-L7vVcAwNg5SuSaMzSkrMh3CP1fKkdP95hOiBnQ
+ hash: v1.k794b7964.e2563bae04716f58b513cc944966d3123ffdef5812faefc4ddb95e994848772b.ZflxTMGmVKGRk-drVOw2lVl0zeTY4zHWkd0G9zlPfrc
scenes-app-inbox-detail--pull-request-stack--dark:
hash: v1.k794b7964.800c7ccd57a65ea0a62bece200ce4eb0f65f87cf4b593fc04f6a935fcfdf7c74.jAKYqCaW8lWokIDp080uSMwk3lJYUQ7d2l75FsU9xIE
scenes-app-inbox-detail--pull-request-stack--light:
diff --git a/products/signals/frontend/inbox/components/detail/DetailSection.test.tsx b/products/signals/frontend/inbox/components/detail/DetailSection.test.tsx
new file mode 100644
index 000000000000..afec8e9a1fee
--- /dev/null
+++ b/products/signals/frontend/inbox/components/detail/DetailSection.test.tsx
@@ -0,0 +1,42 @@
+import '@testing-library/jest-dom'
+
+import { render, screen } from '@testing-library/react'
+import userEvent from '@testing-library/user-event'
+
+import { DetailSection } from './DetailSection'
+
+describe('DetailSection', () => {
+ it('renders a summary for the current open state', async () => {
+ const user = userEvent.setup()
+
+ render(
+ <DetailSection
+ icon={<span />}
+ title="Example section"
+ collapsible
+ defaultCollapsed
+ meta={(open) => (open ? null : 'Closed summary')}
+ summary={(open) => (open ? 'Open summary' : null)}
+ >
+ Section body
+ </DetailSection>
+ )
+
+ const toggle = screen.getByText('Example section').closest('button')
+ if (!toggle) {
+ throw new Error('Expected section title to be inside a button')
+ }
+
+ expect(screen.getByText('Closed summary')).toBeInTheDocument()
+ expect(toggle).toHaveTextContent('Closed summary')
+ expect(screen.queryByText('Open summary')).not.toBeInTheDocument()
+ expect(screen.queryByText('Section body')).not.toBeInTheDocument()
+
+ await user.click(toggle)
+
+ expect(screen.getByText('Open summary')).toBeInTheDocument()
+ expect(screen.queryByText('Closed summary')).not.toBeInTheDocument()
+ expect(toggle).not.toHaveTextContent('Open summary')
+ expect(screen.getByText('Section body')).toBeInTheDocument()
+ })
+})
diff --git a/products/signals/frontend/inbox/components/detail/DetailSection.tsx b/products/signals/frontend/inbox/components/detail/DetailSection.tsx
index 5582f570bd12..bba3028c8a46 100644
--- a/products/signals/frontend/inbox/components/detail/DetailSection.tsx
+++ b/products/signals/frontend/inbox/components/detail/DetailSection.tsx
@@ -13,7 +13,9 @@ interface DetailSectionProps {
* comment count). Part of the toggle when the section is collapsible — use `rightSlot` for
* anything with its own click behavior.
*/
- meta?: ReactNode
+ meta?: ReactNode | ((open: boolean) => ReactNode)
+ /** Summary below the header. A render function can adapt the summary to the section state. */
+ summary?: ReactNode | ((open: boolean) => ReactNode)
/** Interactive controls rendered outside the collapse toggle so they stay independently clickable. */
rightSlot?: ReactNode
children: ReactNode
@@ -37,6 +39,7 @@ export function DetailSection({
title,
afterTitle,
meta,
+ summary,
rightSlot,
children,
collapsible = false,
@@ -45,6 +48,8 @@ export function DetailSection({
}: DetailSectionProps): JSX.Element {
const [collapsed, setCollapsed] = useState(defaultCollapsed)
const open = !collapsible || !collapsed
+ const renderedMeta = typeof meta === 'function' ? meta(open) : meta
+ const renderedSummary = typeof summary === 'function' ? summary(open) : summary
const toggle = (): void => {
const next = !collapsed
@@ -60,7 +65,7 @@ export function DetailSection({
{afterTitle && <div className="shrink-0">{afterTitle}</div>}
</div>
<div className="h-px min-w-4 flex-1 bg-border-light" />
- {meta && <div className="shrink-0">{meta}</div>}
+ {renderedMeta && <div className="shrink-0">{renderedMeta}</div>}
</div>
)
@@ -92,6 +97,7 @@ export function DetailSection({
)}
{rightSlot && <div className="shrink-0">{rightSlot}</div>}
</div>
+ {renderedSummary && <div className="min-w-0">{renderedSummary}</div>}
{open && <div>{children}</div>}
</div>
)
diff --git a/products/signals/frontend/inbox/components/detail/PrChecksSection.tsx b/products/signals/frontend/inbox/components/detail/PrChecksSection.tsx
index 1d5ec5453754..1ebfa7b797ee 100644
--- a/products/signals/frontend/inbox/components/detail/PrChecksSection.tsx
+++ b/products/signals/frontend/inbox/components/detail/PrChecksSection.tsx
@@ -87,17 +87,53 @@ const VARIANT_META: Record<
// Failed first, then in-flight, then the rest — the buckets worth a human's attention lead.
const VARIANT_ORDER: CheckVariant[] = ['failure', 'pending', 'cancelled', 'stale', 'success', 'neutral']
-function CheckSummary({ variant, count }: { variant: CheckVariant; count: number }): JSX.Element | null {
+function CheckSummary({
+ variant,
+ count,
+ compact,
+}: {
+ variant: CheckVariant
+ count: number
+ compact: boolean
+}): JSX.Element | null {
if (count === 0) {
return null
}
const meta = VARIANT_META[variant]
+ const label = `${count} ${meta.label.toLowerCase()}`
return (
- <span className={`inline-flex items-center gap-1 whitespace-nowrap ${meta.summaryClassName}`}>
- <span className={`flex items-center [&_svg]:size-3 ${meta.iconClassName}`}>{meta.icon}</span>
+ <span
+ className={`inline-flex items-center gap-1 whitespace-nowrap ${meta.summaryClassName}`}
+ title={compact ? label : undefined}
+ >
+ <span aria-hidden className={`flex items-center [&_svg]:size-3 ${meta.iconClassName}`}>
+ {meta.icon}
+ </span>
<span className="font-medium tabular-nums">{count}</span>
- <span>{meta.label.toLowerCase()}</span>
+ <span className={compact ? 'sr-only' : undefined}>{meta.label.toLowerCase()}</span>
+ </span>
+ )
+}
+
+function CheckSummaryList({
+ counts,
+ compact,
+}: {
+ counts: Record<CheckVariant, number>
+ compact: boolean
+}): JSX.Element {
+ return (
+ <span
+ className={
+ compact
+ ? 'inline-flex items-center gap-x-2.5 text-[0.6875rem]'
+ : 'flex w-full flex-wrap items-center gap-x-2.5 gap-y-1 text-[0.6875rem]'
+ }
+ >
+ {VARIANT_ORDER.map((variant) => (
+ <CheckSummary key={variant} variant={variant} count={counts[variant]} compact={compact} />
+ ))}
</span>
)
}
@@ -148,13 +184,12 @@ export function PrChecksSection({ report }: { report: SignalReport }): JSX.Eleme
collapsible
defaultCollapsed={sorted.length > 0 && !hasChecksNeedingAttention}
meta={
- sorted.length > 0 ? (
- <span className="flex items-center justify-end gap-x-2.5 gap-y-1 flex-wrap text-[0.6875rem]">
- {VARIANT_ORDER.map((variant) => (
- <CheckSummary key={variant} variant={variant} count={counts[variant]} />
- ))}
- </span>
- ) : undefined
+ sorted.length > 0 ? (open) => (open ? null : <CheckSummaryList counts={counts} compact />) : undefined
+ }
+ summary={
+ sorted.length > 0
+ ? (open) => (open ? <CheckSummaryList counts={counts} compact={false} /> : null)
+ : undefined
}
>
{prChecksError ? (