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(eng-analytics): add ci explorer page (#111949)

Raúl Negrón-Otero5c070cdcef3e
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index 6e539d36c715..197e884a8216 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -9972,6 +9972,14 @@ snapshots:
hash: v1.k794b7964.92889e0db2ca295765d91586d19fdd5183d8b6af425237baf4c5e6d0273b4949.q-FafIaHo1UO3RKISmWRKJWxEtw8-pgrKYWP4q9DoR8
scenes-app-engineering-analytics-authors--author-friction-not-ready--light:
hash: v1.k794b7964.bf18cf3f51dd0436b64f4d6cb533b6a36a7811c161122355a08d40a5136db8be.uGZadwMtx40uqMkqplCKQP9fzEMLnYReDvNvfVsG6EU
+ scenes-app-engineering-analytics-ci-explorer--activity--dark:
+ hash: v1.k794b7964.005688d655bbf55094665d28f169ae2b22a3bcf0b6aa688edf97ba329b1110cd.EyYMn--lW0UFsRUy8i9m9veNkiSjIEz_JW1p7ovBoIk
+ scenes-app-engineering-analytics-ci-explorer--activity--light:
+ hash: v1.k794b7964.9abfe9faeff9146ab7982097647c1861907dd6f99afed3d54a29f1ade3f56062.A_zcy6RuaLTRxwNFyBPwf2F8rYxq4SVxEbplKLkAsc0
+ scenes-app-engineering-analytics-ci-explorer--overview--dark:
+ hash: v1.k794b7964.85d63d9371adec11a5a02cb06c37d3fb6deb18af7835034997d8689aa6c1eb79.kMPBPBRY6gs6uw8vOVvz1ODLndgPglp7DYy8eu7hXMc
+ scenes-app-engineering-analytics-ci-explorer--overview--light:
+ hash: v1.k794b7964.2f2ec0fff11b656fbf4aec4b169a2caad41121f5a6b16b90c7eec5a50da4f23d.qMvQqwHD1OLgyk4E_gFFa3OglRYmmG4ZbVmVTk7anhE
scenes-app-engineering-analytics-delivery-pipeline--all-stages--dark:
hash: v1.k794b7964.e6fc5778d62714ed6fd4174b65c767a850d116b902223aa6f2086ce967edcaed.HoZOw65AQI9tW_L6CG_9JN6y7lmyhzy_Q1PQL__zCsk
scenes-app-engineering-analytics-delivery-pipeline--all-stages--light:
diff --git a/frontend/src/productScenes.tsx b/frontend/src/productScenes.tsx
index 8b2ec53666aa..0ba60da2eb29 100644
--- a/frontend/src/productScenes.tsx
+++ b/frontend/src/productScenes.tsx
@@ -106,6 +106,8 @@ export const productScenes: Record<string, () => Promise<any>> = {
import('../../products/engineering_analytics/frontend/scenes/EngineeringAnalyticsScene'),
EngineeringAnalyticsPullRequest: () =>
import('../../products/engineering_analytics/frontend/scenes/PullRequestDetailScene'),
+ EngineeringAnalyticsCIExplorer: () =>
+ import('../../products/engineering_analytics/frontend/scenes/CIExplorerScene'),
EngineeringAnalyticsWorkflowRun: () =>
import('../../products/engineering_analytics/frontend/scenes/WorkflowRunDetailScene'),
EngineeringAnalyticsWorkflowRuns: () =>
diff --git a/frontend/src/products.tsx b/frontend/src/products.tsx
index b95f8ea20c81..46270c143606 100644
--- a/frontend/src/products.tsx
+++ b/frontend/src/products.tsx
@@ -189,6 +189,10 @@ export const productRoutes: Record<string, [string, string]> = {
'EngineeringAnalyticsPullRequest',
'engineeringAnalyticsPullRequest',
],
+ '/engineering-analytics/repos/:repoOwner/:repoName/pull-requests/:number/ci-explorer': [
+ 'EngineeringAnalyticsCIExplorer',
+ 'engineeringAnalyticsCIExplorer',
+ ],
'/engineering-analytics/repos/:repoOwner/:repoName/actions/runs/:runId': [
'EngineeringAnalyticsWorkflowRun',
'engineeringAnalyticsWorkflowRun',
@@ -846,6 +850,13 @@ export const productConfiguration: Record<string, any> = {
description: 'A single pull request: lifecycle milestones and CI runs on its head commit.',
iconType: 'health',
},
+ EngineeringAnalyticsCIExplorer: {
+ projectBased: true,
+ name: 'CI explorer',
+ layout: 'app-container',
+ description: "A pull request's CI on one zoomable canvas: workflows, jobs, and matrix shards.",
+ iconType: 'health',
+ },
EngineeringAnalyticsWorkflowRun: {
projectBased: true,
name: 'Workflow run',
@@ -1509,6 +1520,8 @@ export const productUrls = {
`/engineering-analytics/teams/${encodeURIComponent(ownerTeam)}`,
engineeringAnalyticsPullRequest: (repoOwner: string, repoName: string, number: number | string): string =>
`/engineering-analytics/repos/${encodeURIComponent(repoOwner)}/${encodeURIComponent(repoName)}/pull-requests/${number}`,
+ engineeringAnalyticsCIExplorer: (repoOwner: string, repoName: string, number: number | string): string =>
+ `/engineering-analytics/repos/${encodeURIComponent(repoOwner)}/${encodeURIComponent(repoName)}/pull-requests/${number}/ci-explorer`,
engineeringAnalyticsWorkflowRun: (
repoOwner: string,
repoName: string,
@@ -2504,6 +2517,7 @@ export const getTreeItemsProducts = (): FileSystemImport[] => [
sceneKeys: [
'EngineeringAnalytics',
'EngineeringAnalyticsPullRequest',
+ 'EngineeringAnalyticsCIExplorer',
'EngineeringAnalyticsWorkflowRun',
'EngineeringAnalyticsWorkflowRuns',
'EngineeringAnalyticsAuthor',
diff --git a/products/engineering_analytics/frontend/components/PullRequestJumpInput.tsx b/products/engineering_analytics/frontend/components/PullRequestJumpInput.tsx
new file mode 100644
index 000000000000..d19bc0cfc730
--- /dev/null
+++ b/products/engineering_analytics/frontend/components/PullRequestJumpInput.tsx
@@ -0,0 +1,45 @@
+import { useActions, useValues } from 'kea'
+
+import { IconPullRequest } from '@posthog/icons'
+import { LemonButton, LemonInput } from '@posthog/lemon-ui'
+
+import { LemonField } from 'lib/lemon-ui/LemonField'
+
+import { type PullRequestJumpFailure, engineeringAnalyticsLogic } from '../scenes/engineeringAnalyticsLogic'
+
+const FAILURE_MESSAGE: Record<PullRequestJumpFailure, string> = {
+ invalid: 'Enter a GitHub pull request link or number.',
+ needs_repository: 'Select a repository or paste the full link.',
+}
+
+/** Opens one pull request in the CI explorer from a link or a number, whether or not the list holds it. */
+export function PullRequestJumpInput(): JSX.Element {
+ const { pullRequestJumpText, pullRequestJumpFailure } = useValues(engineeringAnalyticsLogic)
+ const { setPullRequestJumpText, submitPullRequestJump } = useActions(engineeringAnalyticsLogic)
+
+ return (
+ <LemonField.Pure error={pullRequestJumpFailure && FAILURE_MESSAGE[pullRequestJumpFailure]} className="gap-1">
+ <div className="flex flex-wrap items-center gap-2">
+ <LemonInput
+ prefix={<IconPullRequest />}
+ placeholder="Pull request link or number"
+ aria-label="Pull request link or number"
+ value={pullRequestJumpText}
+ onChange={setPullRequestJumpText}
+ onPressEnter={() => submitPullRequestJump()}
+ status={pullRequestJumpFailure ? 'danger' : 'default'}
+ className="w-64"
+ data-attr="engineering-analytics-pull-request-jump-input"
+ />
+ <LemonButton
+ type="secondary"
+ size="small"
+ onClick={() => submitPullRequestJump()}
+ data-attr="engineering-analytics-pull-request-jump-submit"
+ >
+ View in CI explorer
+ </LemonButton>
+ </div>
+ </LemonField.Pure>
+ )
+}
diff --git a/products/engineering_analytics/frontend/components/ciExplorer/CIExplorerActivity.tsx b/products/engineering_analytics/frontend/components/ciExplorer/CIExplorerActivity.tsx
new file mode 100644
index 000000000000..1eab32cd14ec
--- /dev/null
+++ b/products/engineering_analytics/frontend/components/ciExplorer/CIExplorerActivity.tsx
@@ -0,0 +1,81 @@
+import { useValues } from 'kea'
+
+import { IconCommit, IconGitBranch, IconPullRequest, IconXCircle } from '@posthog/icons'
+
+import { dayjs } from 'lib/dayjs'
+import { capitalizeFirstLetter } from 'lib/utils/strings'
+
+import { CIActivityEventKind } from '../../lib/ciExplorerActivity'
+import { ciExplorerLogic } from '../../scenes/ciExplorerLogic'
+import { CIExplorerActivityCommit } from './CIExplorerActivityCommit'
+
+const EVENT: Record<CIActivityEventKind, { text: string; icon: JSX.Element }> = {
+ opened: { text: 'opened this pull request', icon: <IconPullRequest /> },
+ ready_for_review: { text: 'marked ready for review', icon: <IconPullRequest /> },
+ converted_to_draft: { text: 'returned to draft', icon: <IconPullRequest /> },
+ merged: { text: 'merged this pull request', icon: <IconPullRequest /> },
+ closed: { text: 'closed this pull request', icon: <IconXCircle /> },
+}
+
+/** A pull request's activity as a timeline, oldest first and grouped by day. A commit row opens that commit's CI. */
+export function CIExplorerActivity(): JSX.Element {
+ const { activity } = useValues(ciExplorerLogic)
+
+ if (!activity.length) {
+ return (
+ <div className="py-16 text-center text-sm text-secondary">
+ No activity is synced for this pull request yet. It appears here after the next sync.
+ </div>
+ )
+ }
+ return (
+ <div className="flex max-w-4xl flex-col gap-6">
+ {activity.map((day) => (
+ <section key={day.date}>
+ <h2 className="mb-2 ml-[5.25rem] text-xs font-medium text-secondary">
+ {dayjs(day.date).format('MMM D, YYYY')}
+ </h2>
+ {/* The line joins the rows of a day. It sits under the icons, at the middle of their column. */}
+ <ol className="relative m-0 list-none p-0 before:absolute before:bottom-5 before:left-[4.5rem] before:top-5 before:w-px before:bg-border-primary">
+ {day.rows.map((row) => (
+ <li
+ key={`${row.type}:${row.at}:${row.type === 'commit' ? row.headSha : row.kind}`}
+ className="grid min-h-10 grid-cols-[3rem_1.5rem_minmax(0,1fr)] items-center gap-3"
+ >
+ <time
+ dateTime={row.at}
+ title={dayjs(row.at).format('MMM D, YYYY HH:mm:ss')}
+ className="text-right font-mono text-xs text-secondary"
+ >
+ {dayjs(row.at).format('HH:mm')}
+ </time>
+ <span
+ className="relative flex justify-center bg-primary py-1 text-base text-secondary"
+ aria-hidden="true"
+ >
+ {row.type === 'commit' ? (
+ row.mergeQueue ? (
+ <IconGitBranch />
+ ) : (
+ <IconCommit />
+ )
+ ) : (
+ EVENT[row.kind].icon
+ )}
+ </span>
+ {row.type === 'commit' ? (
+ <CIExplorerActivityCommit commit={row} />
+ ) : (
+ <span className="px-3 text-sm text-secondary">
+ {row.actor && <b className="font-medium text-primary">{row.actor} </b>}
+ {row.actor ? EVENT[row.kind].text : capitalizeFirstLetter(EVENT[row.kind].text)}
+ </span>
+ )}
+ </li>
+ ))}
+ </ol>
+ </section>
+ ))}
+ </div>
+ )
+}
diff --git a/products/engineering_analytics/frontend/components/ciExplorer/CIExplorerActivityCommit.tsx b/products/engineering_analytics/frontend/components/ciExplorer/CIExplorerActivityCommit.tsx
new file mode 100644
index 000000000000..2e395fea90bf
--- /dev/null
+++ b/products/engineering_analytics/frontend/components/ciExplorer/CIExplorerActivityCommit.tsx
@@ -0,0 +1,48 @@
+import { useValues } from 'kea'
+
+import { LemonTag, Link, Tooltip } from '@posthog/lemon-ui'
+
+import { humanFriendlyDuration } from 'lib/utils/durations'
+import { pluralize } from 'lib/utils/strings'
+
+import { CIActivityCommit } from '../../lib/ciExplorerActivity'
+import { ciExplorerLogic } from '../../scenes/ciExplorerLogic'
+
+/** One commit of the activity timeline. The whole row is a link to that commit's CI. */
+export function CIExplorerActivityCommit({ commit }: { commit: CIActivityCommit }): JSX.Element {
+ const { locationUrl } = useValues(ciExplorerLogic)
+ return (
+ <Link
+ // The newest commit is the overview, so its link carries no commit.
+ to={locationUrl({ view: 'overview', headSha: commit.latest ? null : commit.headSha, nodeId: null })}
+ subtle
+ className="my-1 flex flex-wrap items-center justify-between gap-x-6 gap-y-1 rounded border border-primary bg-surface-primary p-3 hover:bg-surface-secondary"
+ data-attr="ci-explorer-activity-commit"
+ >
+ <span className="flex items-center gap-2 text-sm font-medium">
+ {commit.mergeQueue ? 'Merge queue' : 'Commit'}
+ <code className="font-mono text-xs">{commit.headSha.slice(0, 7)}</code>
+ {commit.latest && (
+ <LemonTag type="muted" size="small">
+ Current commit
+ </LemonTag>
+ )}
+ </span>
+ <span className="flex flex-wrap items-center gap-x-3 text-xs tabular-nums text-secondary">
+ <span>{pluralize(commit.runs, 'workflow run')}</span>
+ {commit.failed > 0 && (
+ <Tooltip title="Failed runs on this commit, including re-runs">
+ <span className="text-danger">{commit.failed} failed</span>
+ </Tooltip>
+ )}
+ {commit.elapsedSeconds !== null && (
+ <Tooltip title="First run start to last run update">
+ <span className="font-mono">
+ Elapsed {humanFriendlyDuration(commit.elapsedSeconds, { maxUnits: 2 })}
+ </span>
+ </Tooltip>
+ )}
+ </span>
+ </Link>
+ )
+}
diff --git a/products/engineering_analytics/frontend/components/ciExplorer/CIExplorerCanvas.tsx b/products/engineering_analytics/frontend/components/ciExplorer/CIExplorerCanvas.tsx
new file mode 100644
index 000000000000..6846d5a29188
--- /dev/null
+++ b/products/engineering_analytics/frontend/components/ciExplorer/CIExplorerCanvas.tsx
@@ -0,0 +1,530 @@
+import '@xyflow/react/dist/style.css'
+import './CIExplorerCanvas.scss'
+
+import {
+ type Edge,
+ type Node,
+ type OnMove,
+ Panel,
+ ReactFlow,
+ ReactFlowProvider,
+ type Viewport,
+ ViewportPortal,
+ useReactFlow,
+ useStore,
+ useStoreApi,
+} from '@xyflow/react'
+import { useActions, useValues } from 'kea'
+import { type KeyboardEvent, useCallback, useEffect, useMemo, useRef } from 'react'
+
+import { IconArrowLeft, IconMinus, IconPlus } from '@posthog/icons'
+import { LemonButton } from '@posthog/lemon-ui'
+
+import { themeLogic } from '~/layout/navigation-3000/themeLogic'
+
+import {
+ CIExplorerWorkflow,
+ INNER_SCALE,
+ OVERVIEW_MIN_ZOOM,
+ RAIL_LEFT,
+ RAIL_TOP,
+ TILE_COLUMN_GAP,
+ TILE_GAP,
+ TILE_HEIGHT,
+ TILE_WIDTH,
+ tileGridSize,
+ tileRows,
+} from '../../lib/ciExplorerGraph'
+import { ciExplorerLogic } from '../../scenes/ciExplorerLogic'
+import { CIExplorerDrawer } from './CIExplorerDrawer'
+import { CIExplorerLegend } from './CIExplorerLegend'
+import { CIExplorerTile } from './CIExplorerTile'
+import { CIExplorerTooltip } from './CIExplorerTooltip'
+
+const NO_NODES: Node[] = []
+const NO_EDGES: Edge[] = []
+// A large workflow is drawn small inside its tile, so reaching one of its shards takes a deep zoom.
+const MAX_ZOOM = 400
+const MIN_ZOOM = 0.1
+const OVERVIEW_ZOOM_FLOOR = 0.5
+const BUTTON_ZOOM = 1.6
+// Past this zoom a tile's graph is readable, so the tile fades and its jobs become reachable.
+const JOBS_ZOOM = 1.8
+const CAMERA_MOVE_MS = 280
+const BUTTON_ZOOM_MS = 200
+const FRAME_PADDING = 40
+const RAIL_Y = 52
+const RAIL_INSET = 24
+const RAIL_BEND = 12
+// The room the dock and the back button take from the overview.
+const OVERVIEW_MARGIN_X = 48
+const OVERVIEW_MARGIN_Y = 128
+// A job label is 13px at a zoom of 1. Entering a workflow never shows it smaller than 12px.
+const JOB_MIN_ZOOM = 12 / 13
+// A job or a shard is framed this wide at most. A tall one pans, so its text keeps its size.
+const FRAMED_NODE_WIDTH = 900
+const FRAMED_NODE_TOP = 64
+const PAN_STEP = 72
+// Matches the zoom at which the shard grid starts to fade in, in CIExplorerCanvas.scss.
+const SHARDS_SHOWN_ZOOM = 0.4
+const LEAVE_ZOOM_RATIO = 0.75
+const DRAWER_ROOM = 352
+// Below this width the drawer lies over the canvas and takes no room from the camera.
+const NARROW_STAGE = 1000
+
+interface PlacedTile {
+ workflow: CIExplorerWorkflow
+ x: number
+ y: number
+}
+
+function placeTiles(workflows: CIExplorerWorkflow[], rows: number): PlacedTile[] {
+ return workflows.map((workflow, index) => ({
+ workflow,
+ x: RAIL_LEFT + Math.floor(index / rows) * (TILE_WIDTH + TILE_COLUMN_GAP),
+ y: RAIL_TOP + (index % rows) * (TILE_HEIGHT + TILE_GAP),
+ }))
+}
+
+/** The line that runs along the top and drops down the left of each column to reach every tile. */
+function railPaths(count: number, rows: number): { paths: string[]; dots: [number, number][] } {
+ const columns = Math.ceil(count / rows)
+ const paths: string[] = []
+ const dots: [number, number][] = []
+ if (columns > 1) {
+ paths.push(
+ `M8,${RAIL_Y} H${RAIL_LEFT + (columns - 1) * (TILE_WIDTH + TILE_COLUMN_GAP) - RAIL_INSET - RAIL_BEND}`
+ )
+ }
+ for (let column = 0; column < columns; column++) {
+ const x = RAIL_LEFT + column * (TILE_WIDTH + TILE_COLUMN_GAP)
+ const railX = x - RAIL_INSET
+ const inColumn = Math.min(rows, count - column * rows)
+ const lastMiddle = RAIL_TOP + (inColumn - 1) * (TILE_HEIGHT + TILE_GAP) + TILE_HEIGHT / 2
+ if (column === 0) {
+ dots.push([railX, RAIL_Y])
+ } else {
+ paths.push(`M${railX - RAIL_BEND},${RAIL_Y} Q${railX},${RAIL_Y} ${railX},${RAIL_Y + RAIL_BEND}`)
+ }
+ paths.push(`M${railX},${column ? RAIL_Y + RAIL_BEND : RAIL_Y} V${lastMiddle - RAIL_BEND}`)
+ for (let row = 0; row < inColumn; row++) {
+ const middle = RAIL_TOP + row * (TILE_HEIGHT + TILE_GAP) + TILE_HEIGHT / 2
+ paths.push(`M${railX},${middle - RAIL_BEND} Q${railX},${middle} ${railX + RAIL_BEND},${middle} H${x}`)
+ dots.push([x, middle])
+ }
+ }
+ return { paths, dots }
+}
+
+/** What the camera frames for a node: a workflow by its graph, a job or a shard by itself. */
+function framedElement(node: HTMLElement): { element: HTMLElement; graphScale: number | null } {
+ const graph = node.querySelector<HTMLElement>(':scope > [data-graph]')
+ return { element: graph ?? node, graphScale: graph ? Number(node.dataset.graphScale) : null }
+}
+
+function CIExplorerCanvasContent(): JSX.Element {
+ const { workflows, layouts, layoutsLoading, focusedNodeId, focusLevels, activePush, cameraRequest, drawerOpen } =
+ useValues(ciExplorerLogic)
+ const { setFocus, fitView } = useActions(ciExplorerLogic)
+ const { isDarkModeOn } = useValues(themeLogic)
+ const { setViewport, getViewport } = useReactFlow()
+ const store = useStoreApi()
+ const stageWidth = useStore((state) => state.width)
+ const stageHeight = useStore((state) => state.height)
+ const stage = useRef<HTMLDivElement>(null)
+ const world = useRef<HTMLDivElement>(null)
+ // The zoom each level of the focus was framed at. A zoom out past the midpoint to the level above leaves the level.
+ const levelZooms = useRef(new Map<string, number>())
+ const handled = useRef<{ sequence: number; stage: string; layout: unknown }>({
+ sequence: -1,
+ stage: '',
+ layout: null,
+ })
+ // True once the person has moved the camera since the canvas last framed something.
+ const movedByPerson = useRef(false)
+
+ const rows = useMemo(
+ () => tileRows(workflows.length, stageWidth - OVERVIEW_MARGIN_X, stageHeight - OVERVIEW_MARGIN_Y),
+ [workflows.length, stageWidth, stageHeight]
+ )
+ const tiles = useMemo(() => placeTiles(workflows, rows), [workflows, rows])
+ const grid = tileGridSize(Math.ceil(workflows.length / rows), Math.min(rows, workflows.length))
+ const rail = useMemo(() => railPaths(workflows.length, rows), [workflows.length, rows])
+ const reducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches
+ const room = stageWidth - (drawerOpen && stageWidth > NARROW_STAGE ? DRAWER_ROOM : 0)
+
+ const fitZoom = Math.min(
+ 1.1,
+ (stageWidth - OVERVIEW_MARGIN_X) / grid.width,
+ (stageHeight - OVERVIEW_MARGIN_Y) / grid.height
+ )
+ const overviewZoom = Math.max(OVERVIEW_MIN_ZOOM, fitZoom)
+ const minZoom = Math.max(MIN_ZOOM, Math.min(overviewZoom * OVERVIEW_ZOOM_FLOOR, fitZoom))
+ // Each selector returns a boolean, so the canvas renders again only when the camera crosses its threshold.
+ const deep = useStore((state) => state.transform[2] >= JOBS_ZOOM)
+ const pastOverview = useStore((state) => state.transform[2] > overviewZoom * 1.05)
+
+ const findNode = useCallback(
+ (nodeId: string): HTMLElement | null =>
+ world.current?.querySelector<HTMLElement>(`[data-node-id="${CSS.escape(nodeId)}"]`) ?? null,
+ []
+ )
+
+ const overviewCamera = useCallback(
+ (fit: boolean): Viewport => {
+ const zoom = fit ? Math.max(MIN_ZOOM, fitZoom) : overviewZoom
+ return {
+ zoom,
+ x: Math.max(24, (stageWidth - grid.width * zoom) / 2),
+ y: Math.max(24, (stageHeight - 80 - grid.height * zoom) / 2),
+ }
+ },
+ [fitZoom, overviewZoom, stageWidth, stageHeight, grid.width, grid.height]
+ )
+
+ const nodeCamera = useCallback(
+ (node: HTMLElement, fit: boolean): Viewport | null => {
+ const stageElement = stage.current
+ const worldElement = world.current
+ if (!stageElement || !worldElement) {
+ return null
+ }
+ const { element, graphScale } = framedElement(node)
+ const measure = (): { x: number; y: number; width: number; height: number } => {
+ const outer = worldElement.getBoundingClientRect()
+ // The zoom the page is drawn at now. During a camera move it trails the zoom the store already holds.
+ const current = outer.width / worldElement.offsetWidth
+ const inner = element.getBoundingClientRect()
+ return {
+ x: (inner.left - outer.left) / current,
+ y: (inner.top - outer.top) / current,
+ width: inner.width / current,
+ height: inner.height / current,
+ }
+ }
+ const zoomFor = (box: { width: number; height: number }): number => {
+ const fitWidth = (room - 2 * FRAME_PADDING) / box.width
+ const fitHeight = (stageHeight - 2 * FRAME_PADDING) / box.height
+ if (graphScale !== null) {
+ const fitted = Math.min(1 / graphScale, fitWidth, fitHeight)
+ return fit ? fitted : Math.max(JOB_MIN_ZOOM / graphScale, fitted)
+ }
+ return fit
+ ? Math.min(fitWidth, fitHeight, MAX_ZOOM)
+ : Math.min(Math.min(room - 2 * FRAME_PADDING, FRAMED_NODE_WIDTH) / box.width, MAX_ZOOM)
+ }
+ // Titles keep their size on screen, so a node's layout depends on the zoom. The node is measured
+ // again as it will be drawn at the zoom the camera is going to.
+ const shownZoom = stageElement.style.getPropertyValue('--k')
+ stageElement.style.setProperty('--k', String(zoomFor(measure())))
+ const box = measure()
+ stageElement.style.setProperty('--k', shownZoom)
+ const zoom = zoomFor(box)
+ const top = graphScale !== null ? FRAME_PADDING : FRAMED_NODE_TOP
+ return {
+ zoom,
+ x: Math.max(FRAME_PADDING, (room - box.width * zoom) / 2) - box.x * zoom,
+ y: Math.max(top, (stageHeight - box.height * zoom) / 2) - box.y * zoom,
+ }
+ },
+ [room, stageHeight]
+ )
+
+ // The zoom reaches the styles as a custom property, without a render on every frame of a camera move.
+ useEffect(() => {
+ const showZoom = (zoom: number): void => {
+ stage.current?.style.setProperty('--k', String(zoom))
+ stage.current?.setAttribute('data-deep', String(zoom >= JOBS_ZOOM))
+ // A tile's shards show once they are large enough, which depends on how far its graph was shrunk.
+ for (const card of world.current?.querySelectorAll<HTMLElement>('.CIExplorer__card') ?? []) {
+ const shown = zoom * Number(card.dataset.graphScale) * INNER_SCALE > SHARDS_SHOWN_ZOOM
+ card.setAttribute('data-shards', String(shown))
+ }
+ }
+ showZoom(store.getState().transform[2])
+ return store.subscribe((state, previous) => {
+ if (state.transform[2] !== previous.transform[2]) {
+ showZoom(state.transform[2])
+ }
+ })
+ // A new layout changes how far a tile's graph is shrunk.
+ }, [store, layouts])
+
+ // The camera moves when it is asked to, and when the stage changes size. A focus change that came from the
+ // camera itself asks for nothing, so a zoom out is never pulled back.
+ useEffect(() => {
+ // A focus change can resize a node, so the camera waits for the new layout before it frames anything.
+ if (!stageWidth || !stageHeight || !world.current || layoutsLoading) {
+ return
+ }
+ const stageKey = `${stageWidth}x${stageHeight}/${room}/${rows}`
+ const first = handled.current.sequence === -1
+ // A framed node can still grow, for example when its log adds step rows. The frame follows it until
+ // the person takes the camera.
+ const focusLayout = focusLevels.length ? layouts[focusLevels[0].id] : null
+ const regrown = handled.current.layout !== focusLayout && !movedByPerson.current
+ if (handled.current.sequence === cameraRequest.sequence && handled.current.stage === stageKey && !regrown) {
+ return
+ }
+ const duration = reducedMotion || first ? 0 : CAMERA_MOVE_MS
+ const node = focusedNodeId ? findNode(focusedNodeId) : null
+ const workflowPlaced = focusLevels.length > 0 && focusLevels[0].id in layouts
+ if (focusedNodeId && !(node && workflowPlaced)) {
+ // A node from a link is not drawn until its workflow's jobs are placed. The overview shows until then.
+ if (first && handled.current.stage !== stageKey) {
+ handled.current = { sequence: -1, stage: stageKey, layout: null }
+ void setViewport(overviewCamera(false))
+ }
+ return
+ }
+ const camera = node ? nodeCamera(node, cameraRequest.fit) : overviewCamera(cameraRequest.fit)
+ if (!camera) {
+ return
+ }
+ levelZooms.current = new Map(
+ focusLevels.flatMap((level): [string, number][] => {
+ // The focused node was measured for this camera already, unless the camera is a fit.
+ if (level.id === focusedNodeId && !cameraRequest.fit) {
+ return [[level.id, camera.zoom]]
+ }
+ const element = findNode(level.id)
+ const zoom = element ? nodeCamera(element, false)?.zoom : undefined
+ return zoom === undefined ? [] : [[level.id, zoom]]
+ })
+ )
+ handled.current = { sequence: cameraRequest.sequence, stage: stageKey, layout: focusLayout }
+ movedByPerson.current = false
+ void setViewport(camera, { duration })
+ }, [
+ cameraRequest,
+ focusedNodeId,
+ focusLevels,
+ layouts,
+ layoutsLoading,
+ rows,
+ room,
+ stageWidth,
+ stageHeight,
+ reducedMotion,
+ findNode,
+ nodeCamera,
+ overviewCamera,
+ setViewport,
+ ])
+
+ /** Leaves each level of the focus that the camera has zoomed out of, or panned away from. */
+ const followCamera = useCallback(
+ (viewport: Viewport): void => {
+ movedByPerson.current = true
+ if (!stage.current || !focusLevels.length) {
+ return
+ }
+ const bounds = stage.current.getBoundingClientRect()
+ const onStage = (nodeId: string): boolean => {
+ const node = findNode(nodeId)
+ if (!node) {
+ return false
+ }
+ const seen = framedElement(node).element.getBoundingClientRect()
+ return (
+ seen.right > bounds.left &&
+ seen.left < bounds.right &&
+ seen.bottom > bounds.top &&
+ seen.top < bounds.bottom
+ )
+ }
+ let depth = focusLevels.length
+ while (depth > 0) {
+ const levelZoom = levelZooms.current.get(focusLevels[depth - 1].id) ?? viewport.zoom
+ const aboveZoom =
+ depth > 1 ? (levelZooms.current.get(focusLevels[depth - 2].id) ?? overviewZoom) : overviewZoom
+ // A shard is framed at almost the zoom of its matrix, so the midpoint alone would leave it on the
+ // smallest zoom out. Leaving also takes a clear step back from the level's own zoom.
+ const zoomedOut =
+ viewport.zoom <= Math.min(Math.sqrt(levelZoom * aboveZoom), levelZoom * LEAVE_ZOOM_RATIO)
+ // This runs on every frame of a gesture. The zoom test is arithmetic, and only a level that
+ // passes it pays for a measurement.
+ if (!zoomedOut && onStage(focusLevels[depth - 1].id)) {
+ break
+ }
+ depth--
+ }
+ if (depth !== focusLevels.length) {
+ setFocus(depth ? focusLevels[depth - 1].id : null, false)
+ }
+ },
+ [focusLevels, findNode, overviewZoom, setFocus]
+ )
+
+ // React Flow passes the gesture's event, and passes null for a move the canvas made itself.
+ const onMove: OnMove = (event, viewport) => {
+ if (event) {
+ followCamera(viewport)
+ }
+ }
+
+ const zoomBy = (factor: number): void => {
+ const { x, y, zoom } = getViewport()
+ const next = Math.max(minZoom, Math.min(MAX_ZOOM, zoom * factor))
+ const centerX = room / 2
+ const centerY = stageHeight / 2
+ const viewport = {
+ zoom: next,
+ x: centerX - (centerX - x) * (next / zoom),
+ y: centerY - (centerY - y) * (next / zoom),
+ }
+ followCamera(viewport)
+ void setViewport(viewport, { duration: reducedMotion ? 0 : BUTTON_ZOOM_MS })
+ }
+
+ const zoomOutLevel = (): void => {
+ if (focusLevels.length) {
+ setFocus(focusLevels[focusLevels.length - 2]?.id ?? null)
+ } else {
+ void setViewport(overviewCamera(false), { duration: reducedMotion ? 0 : CAMERA_MOVE_MS })
+ }
+ }
+
+ const onKeyDown = (event: KeyboardEvent): void => {
+ // The drawer and the dock keep their own keys.
+ if ((event.target as HTMLElement).closest('[data-ci-explorer-controls]') || event.metaKey || event.ctrlKey) {
+ return
+ }
+ if (event.key === 'Escape' && focusLevels.length) {
+ zoomOutLevel()
+ } else if (event.key === '+' || event.key === '=' || event.key === '-') {
+ event.preventDefault()
+ zoomBy(event.key === '-' ? 1 / BUTTON_ZOOM : BUTTON_ZOOM)
+ } else if (['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown'].includes(event.key)) {
+ event.preventDefault()
+ const { x, y, zoom } = getViewport()
+ const viewport = {
+ zoom,
+ x: x + (event.key === 'ArrowLeft' ? PAN_STEP : event.key === 'ArrowRight' ? -PAN_STEP : 0),
+ y: y + (event.key === 'ArrowUp' ? PAN_STEP : event.key === 'ArrowDown' ? -PAN_STEP : 0),
+ }
+ void setViewport(viewport)
+ followCamera(viewport)
+ }
+ }
+ const above = focusLevels[focusLevels.length - 2]?.name ?? 'Workflows'
+
+ return (
+ // The stage takes the keyboard so the arrow keys can pan it, as a map does.
+ // eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
+ <div
+ className="CIExplorer"
+ ref={stage}
+ onKeyDown={onKeyDown}
+ // eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
+ tabIndex={0}
+ role="group"
+ aria-label="CI workflows"
+ aria-description="Arrow keys pan. Plus and minus zoom. Escape goes back one level."
+ >
+ <ReactFlow
+ colorMode={isDarkModeOn ? 'dark' : 'light'}
+ nodes={NO_NODES}
+ edges={NO_EDGES}
+ minZoom={minZoom}
+ maxZoom={MAX_ZOOM}
+ // A scroll pans and a pinch zooms, as on a map.
+ panOnScroll
+ zoomOnDoubleClick={false}
+ // The stage handles the arrow keys itself, for a canvas that has no React Flow nodes.
+ disableKeyboardA11y
+ onMove={onMove}
+ proOptions={{ hideAttribution: true }}
+ >
+ <ViewportPortal>
+ {/* eslint-disable-next-line react/forbid-dom-props */}
+ <div className="CIExplorer__world" ref={world} style={{ width: grid.width, height: grid.height }}>
+ <svg className="CIExplorer__rail" aria-hidden="true">
+ {rail.paths.map((d, index) => (
+ <path key={index} d={d} />
+ ))}
+ {rail.dots.map(([cx, cy], index) => (
+ <circle key={index} cx={cx} cy={cy} r={3} />
+ ))}
+ </svg>
+ {activePush && (
+ // eslint-disable-next-line react/forbid-dom-props
+ <div className="CIExplorer__origin" style={{ left: RAIL_LEFT - RAIL_INSET - 8 }}>
+ Commit {activePush.headSha.slice(0, 7)}
+ </div>
+ )}
+ {tiles.map(({ workflow, x, y }) => (
+ <CIExplorerTile
+ key={workflow.id}
+ workflow={workflow}
+ layout={layouts[workflow.id]}
+ x={x}
+ y={y}
+ graphReachable={deep}
+ />
+ ))}
+ </div>
+ </ViewportPortal>
+ <CIExplorerTooltip stage={stage} />
+ {(focusLevels.length > 0 || pastOverview) && (
+ <Panel position="top-left" data-ci-explorer-controls>
+ <LemonButton
+ type="secondary"
+ size="small"
+ icon={<IconArrowLeft />}
+ onClick={zoomOutLevel}
+ aria-label={`Back to ${above}`}
+ data-attr="ci-explorer-zoom-out-level"
+ >
+ {above}
+ </LemonButton>
+ </Panel>
+ )}
+ <Panel position="top-right" data-ci-explorer-controls>
+ <CIExplorerDrawer maxHeight={Math.max(0, stageHeight - 32)} />
+ </Panel>
+ <Panel position="bottom-left" className="flex flex-wrap items-center gap-3" data-ci-explorer-controls>
+ <div className="flex gap-1">
+ <LemonButton
+ type="secondary"
+ size="small"
+ icon={<IconMinus />}
+ aria-label="Zoom out"
+ tooltip="Zoom out"
+ onClick={() => zoomBy(1 / BUTTON_ZOOM)}
+ data-attr="ci-explorer-zoom-out"
+ />
+ <LemonButton
+ type="secondary"
+ size="small"
+ icon={<IconPlus />}
+ aria-label="Zoom in"
+ tooltip="Zoom in"
+ onClick={() => zoomBy(BUTTON_ZOOM)}
+ data-attr="ci-explorer-zoom-in"
+ />
+ <LemonButton
+ type="secondary"
+ size="small"
+ tooltip={focusLevels.length ? 'Fit the selection in view' : 'Fit every workflow in view'}
+ onClick={fitView}
+ data-attr="ci-explorer-fit"
+ >
+ Fit
+ </LemonButton>
+ </div>
+ {deep && <CIExplorerLegend />}
+ </Panel>
+ </ReactFlow>
+ </div>
+ )
+}
+
+/** One pan and zoom canvas for a push: workflow tiles on a rail, each holding its job graph. */
+export function CIExplorerCanvas(): JSX.Element {
+ return (
+ <ReactFlowProvider>
+ <CIExplorerCanvasContent />
+ </ReactFlowProvider>
+ )
+}
diff --git a/products/engineering_analytics/frontend/components/ciExplorer/CIExplorerContext.tsx b/products/engineering_analytics/frontend/components/ciExplorer/CIExplorerContext.tsx
new file mode 100644
index 000000000000..b7c671178857
--- /dev/null
+++ b/products/engineering_analytics/frontend/components/ciExplorer/CIExplorerContext.tsx
@@ -0,0 +1,46 @@
+import { useActions, useValues } from 'kea'
+
+import { LemonButton, Spinner } from '@posthog/lemon-ui'
+
+import { CONTEXT_KIND_NAME } from '../../lib/ciExplorerContext'
+import { providerName } from '../../lib/ciExplorerDetails'
+import { ciExplorerContextLogic } from '../../scenes/ciExplorerContextLogic'
+import { CIExplorerContextComparison } from './CIExplorerContextComparison'
+import { CIExplorerProviderMark } from './CIExplorerProviderMark'
+
+/** The selected workflow, matrix, job, or step against its recent runs on the default branch. */
+export function CIExplorerContext(): JSX.Element {
+ const { selection, context, answerLoading, failed } = useValues(ciExplorerContextLogic)
+ const { retry } = useActions(ciExplorerContextLogic)
+
+ if (!selection) {
+ return <p className="m-0 text-xs text-secondary">Select a workflow or job</p>
+ }
+ return (
+ <>
+ <div>
+ <h3 className="m-0 break-words text-sm font-semibold">{selection.label}</h3>
+ <p className="m-0 mt-1 flex items-center gap-1.5 text-xs text-secondary">
+ {CONTEXT_KIND_NAME[selection.kind]}
+ <span aria-hidden="true">·</span>
+ <CIExplorerProviderMark engine={selection.engine} />
+ {providerName(selection.engine)}
+ </p>
+ </div>
+ {context ? (
+ <CIExplorerContextComparison selection={selection} context={context} />
+ ) : failed && !answerLoading ? (
+ <div className="flex flex-col items-start gap-2">
+ <p className="m-0 text-xs text-secondary">Couldn't load timings.</p>
+ <LemonButton type="secondary" size="small" onClick={retry} data-attr="ci-explorer-context-retry">
+ Retry
+ </LemonButton>
+ </div>
+ ) : (
+ <p className="m-0 flex items-center gap-2 text-xs text-secondary" role="status">
+ <Spinner /> Loading timings
+ </p>
+ )}
+ </>
+ )
+}
diff --git a/products/engineering_analytics/frontend/components/ciExplorer/CIExplorerContextComparison.tsx b/products/engineering_analytics/frontend/components/ciExplorer/CIExplorerContextComparison.tsx
new file mode 100644
index 000000000000..4d0d97e3ccda
--- /dev/null
+++ b/products/engineering_analytics/frontend/components/ciExplorer/CIExplorerContextComparison.tsx
@@ -0,0 +1,141 @@
+import { useValues } from 'kea'
+
+import { IconCheckCircle, IconExternal, IconWarning } from '@posthog/icons'
+import { Link, Tooltip } from '@posthog/lemon-ui'
+
+import { TZLabel } from 'lib/components/TZLabel'
+import { humanFriendlyDuration } from 'lib/utils/durations'
+
+import type { CITimingContextApi } from '../../generated/api.schemas'
+import { CIContextSelection, deltaPercent, sampleUrl } from '../../lib/ciExplorerContext'
+import { oldestSync, providerName } from '../../lib/ciExplorerDetails'
+import { ciExplorerLogic } from '../../scenes/ciExplorerLogic'
+
+const MATCH_RULES =
+ 'Runs of the same workflow and jobs on the same runners. Pull request and merge queue runs are excluded.'
+
+const UNAVAILABLE: Record<NonNullable<CITimingContextApi['unavailable_reason']>, string> = {
+ default_branch_unknown: 'Default branch unknown',
+ jobs_not_synced: 'Job data not synced',
+ not_executed: 'Did not run',
+}
+
+function seconds(value: number): string {
+ return humanFriendlyDuration(Math.round(value), { maxUnits: 2 })
+}
+
+function Fact({ label, children }: { label: string; children: React.ReactNode }): JSX.Element {
+ return (
+ <div className="flex items-baseline justify-between gap-4 text-xs">
+ <dt className="text-secondary">{label}</dt>
+ <dd className="m-0 text-right tabular-nums">{children}</dd>
+ </div>
+ )
+}
+
+/** The answer of the Context tab: the selection's duration beside its average, and the runs behind the average. */
+export function CIExplorerContextComparison({
+ selection,
+ context,
+}: {
+ selection: CIContextSelection
+ context: CITimingContextApi
+}): JSX.Element {
+ const { repoOwner, repoName, workflowRunUrl } = useValues(ciExplorerLogic)
+ const delta = deltaPercent(selection, context)
+ const synced = oldestSync(context.runs_synced_at, context.jobs_synced_at)
+
+ if (context.unavailable_reason) {
+ return <p className="m-0 text-xs text-secondary">{UNAVAILABLE[context.unavailable_reason]}</p>
+ }
+ return (
+ <>
+ <dl className="m-0 grid grid-cols-2 gap-4">
+ <div>
+ <dt className="text-xs text-secondary">This run</dt>
+ <dd className="m-0 mt-1 font-mono text-lg">
+ {selection.currentSeconds === null ? selection.statusText : seconds(selection.currentSeconds)}
+ </dd>
+ {selection.currentSeconds !== null && (
+ <dd className="m-0 text-xs text-secondary">{selection.statusText}</dd>
+ )}
+ </div>
+ {context.average_seconds !== null && (
+ <div>
+ <dt className="text-xs text-secondary">{context.window_days}-day average</dt>
+ <dd className="m-0 mt-1 font-mono text-lg">{seconds(context.average_seconds)}</dd>
+ {delta !== null && (
+ <dd className="m-0 text-xs text-secondary">
+ {delta === 0 ? 'Same' : `${Math.abs(delta)}% ${delta < 0 ? 'faster' : 'slower'}`}
+ </dd>
+ )}
+ </div>
+ )}
+ </dl>
+ {context.recent.length === 0 ? (
+ <p className="m-0 text-xs text-secondary">
+ No comparable runs on {context.default_branch} in the last {context.window_days} days
+ </p>
+ ) : (
+ <>
+ <dl className="m-0 flex flex-col gap-1.5">
+ <Fact label="Branch">{context.default_branch}</Fact>
+ <Fact label="Passed runs">
+ <Tooltip title={MATCH_RULES}>
+ <span>
+ {context.sample_count}
+ {context.sampled ? ` of latest ${context.runs_scanned}` : ''}
+ </span>
+ </Tooltip>
+ </Fact>
+ {context.identity === 'workflow_name' && <Fact label="Workflow matched by">Name</Fact>}
+ </dl>
+ <h4 className="m-0 text-xs font-semibold">Recent runs</h4>
+ <ul className="m-0 flex list-none flex-col p-0">
+ {context.recent.map((sample) => {
+ const { url, external } = sampleUrl(
+ repoOwner,
+ repoName,
+ sample,
+ workflowRunUrl(sample.run_id, sample.ci_engine)
+ )
+ return (
+ <li key={`${sample.run_id}:${sample.run_attempt}`} className="border-b border-primary">
+ <Link
+ to={url}
+ target={external ? '_blank' : undefined}
+ targetBlankIcon={false}
+ subtle
+ className="flex min-h-9 items-center gap-2 text-xs"
+ title={
+ external
+ ? `Open on ${providerName(sample.ci_engine)} in a new tab`
+ : undefined
+ }
+ data-attr="ci-explorer-context-run"
+ >
+ {sample.status === 'success' ? (
+ <IconCheckCircle className="text-success" aria-label="Passed" />
+ ) : (
+ <IconWarning className="text-danger" aria-label="Failed" />
+ )}
+ <span className="flex-1">
+ <TZLabel time={sample.completed_at} />
+ </span>
+ <b className="font-mono font-normal">{seconds(sample.duration_seconds)}</b>
+ {external && <IconExternal className="text-tertiary" />}
+ </Link>
+ </li>
+ )
+ })}
+ </ul>
+ </>
+ )}
+ {synced && (
+ <p className="m-0 text-xs text-tertiary">
+ Synced <TZLabel time={synced} />
+ </p>
+ )}
+ </>
+ )
+}
diff --git a/products/engineering_analytics/frontend/components/ciExplorer/CIExplorerDrawer.tsx b/products/engineering_analytics/frontend/components/ciExplorer/CIExplorerDrawer.tsx
new file mode 100644
index 000000000000..ecf064205076
--- /dev/null
+++ b/products/engineering_analytics/frontend/components/ciExplorer/CIExplorerDrawer.tsx
@@ -0,0 +1,77 @@
+import { useActions, useValues } from 'kea'
+
+import { IconX } from '@posthog/icons'
+import { LemonButton, LemonTabs } from '@posthog/lemon-ui'
+
+import { CIExplorerDrawerTab, ciExplorerLogic } from '../../scenes/ciExplorerLogic'
+import { CIExplorerContext } from './CIExplorerContext'
+import { CIExplorerJobDetails } from './CIExplorerJobDetails'
+
+const TABS: { key: CIExplorerDrawerTab; label: string }[] = [
+ { key: 'details', label: 'Details' },
+ { key: 'context', label: 'Context' },
+]
+
+/**
+ * The one drawer of the canvas. Closed, it is two buttons. Open, it shows what the selection is (Details) or how
+ * it compares with recent runs (Context). The choice is remembered.
+ */
+export function CIExplorerDrawer({ maxHeight }: { maxHeight: number }): JSX.Element {
+ const { drawerOpen, drawerTab, focusedJob } = useValues(ciExplorerLogic)
+ const { openDrawer, closeDrawer } = useActions(ciExplorerLogic)
+
+ if (!drawerOpen) {
+ return (
+ <div className="flex gap-1">
+ {TABS.map((tab) => (
+ <LemonButton
+ key={tab.key}
+ type="secondary"
+ size="small"
+ onClick={() => openDrawer(tab.key)}
+ aria-expanded={false}
+ data-attr={`ci-explorer-drawer-open-${tab.key}`}
+ >
+ {tab.label}
+ </LemonButton>
+ ))}
+ </div>
+ )
+ }
+ return (
+ <aside
+ className="flex w-80 max-w-[calc(100vw-4rem)] flex-col overflow-hidden rounded-lg border border-primary bg-surface-primary shadow-md"
+ aria-label={drawerTab === 'context' ? 'Timing context' : 'Job details'}
+ // The height follows the canvas, which only the canvas knows.
+ // eslint-disable-next-line react/forbid-dom-props
+ style={{ maxHeight }}
+ >
+ <div className="flex items-center justify-between gap-2 border-b border-primary pl-3 pr-2">
+ <LemonTabs
+ activeKey={drawerTab}
+ onChange={openDrawer}
+ tabs={TABS}
+ size="small"
+ barClassName="mb-0"
+ data-attr="ci-explorer-drawer-tabs"
+ />
+ <LemonButton
+ size="xsmall"
+ icon={<IconX />}
+ aria-label="Close"
+ onClick={closeDrawer}
+ data-attr="ci-explorer-drawer-close"
+ />
+ </div>
+ <div className="flex min-h-0 flex-col gap-3 overflow-y-auto overscroll-contain p-3">
+ {drawerTab === 'context' ? (
+ <CIExplorerContext />
+ ) : focusedJob ? (
+ <CIExplorerJobDetails job={focusedJob.job} run={focusedJob.run} />
+ ) : (
+ <p className="m-0 text-xs text-secondary">Select a job</p>
+ )}
+ </div>
+ </aside>
+ )
+}
diff --git a/products/engineering_analytics/frontend/components/ciExplorer/CIExplorerFailureLog.tsx b/products/engineering_analytics/frontend/components/ciExplorer/CIExplorerFailureLog.tsx
new file mode 100644
index 000000000000..185f7a944762
--- /dev/null
+++ b/products/engineering_analytics/frontend/components/ciExplorer/CIExplorerFailureLog.tsx
@@ -0,0 +1,42 @@
+import { useValues } from 'kea'
+
+import { Spinner } from '@posthog/lemon-ui'
+
+import { failureExcerpt } from '../../lib/ciExplorerDetails'
+import { ciExplorerLogic } from '../../scenes/ciExplorerLogic'
+
+const LOG_CLASS =
+ 'm-0 max-h-60 shrink-0 overflow-auto whitespace-pre-wrap break-words rounded bg-fill-error-tertiary p-3 font-mono text-xs text-danger'
+
+/** Why the focused job failed: the end of its stored failure log, with the lines before it on request. */
+export function CIExplorerFailureLog(): JSX.Element {
+ const { focusedJobFailure, failureLogs, failureLogsLoading, failureLogsFailed } = useValues(ciExplorerLogic)
+ if (failureLogsFailed) {
+ return <p className="m-0 text-xs text-secondary">Log unavailable</p>
+ }
+ if (failureLogs === null || failureLogsLoading) {
+ return (
+ <p className="m-0 flex items-center gap-2 text-xs text-secondary" role="status">
+ <Spinner /> Loading log
+ </p>
+ )
+ }
+ const excerpt = focusedJobFailure ? failureExcerpt(focusedJobFailure.lines) : null
+ if (!excerpt) {
+ return <p className="m-0 text-xs text-secondary">No error excerpt</p>
+ }
+ return (
+ <>
+ {/* The column is reversed so the box opens scrolled to its end, where the error is. */}
+ <pre className={`${LOG_CLASS} flex flex-col-reverse`} aria-label="Failure excerpt">
+ <span>{excerpt.tail}</span>
+ </pre>
+ {excerpt.context !== null && (
+ <details className="text-xs">
+ <summary className="cursor-pointer text-secondary">Log context</summary>
+ <pre className={`${LOG_CLASS} mt-2`}>{excerpt.context}</pre>
+ </details>
+ )}
+ </>
+ )
+}
diff --git a/products/engineering_analytics/frontend/components/ciExplorer/CIExplorerJobDetails.tsx b/products/engineering_analytics/frontend/components/ciExplorer/CIExplorerJobDetails.tsx
new file mode 100644
index 000000000000..913c212d4708
--- /dev/null
+++ b/products/engineering_analytics/frontend/components/ciExplorer/CIExplorerJobDetails.tsx
@@ -0,0 +1,83 @@
+import { useValues } from 'kea'
+
+import { LemonButton } from '@posthog/lemon-ui'
+
+import { TZLabel } from 'lib/components/TZLabel'
+
+import type { WorkflowJobApi } from '../../generated/api.schemas'
+import { elapsedLabel, providerName, statusLabel } from '../../lib/ciExplorerDetails'
+import { compactUsd } from '../../lib/format'
+import { githubJobUrl } from '../../lib/github'
+import { WorkflowRun, isDecisiveFailure } from '../../lib/lifecycle'
+import { ciExplorerLogic } from '../../scenes/ciExplorerLogic'
+import { CIExplorerChips } from './CIExplorerChips'
+import { CIExplorerFailureLog } from './CIExplorerFailureLog'
+import { CIExplorerProviderMark } from './CIExplorerProviderMark'
+
+function Row({ label, children }: { label: string; children: React.ReactNode }): JSX.Element {
+ return (
+ <div className="flex items-baseline justify-between gap-4 text-xs">
+ <dt className="text-secondary">{label}</dt>
+ <dd className="m-0 text-right tabular-nums">{children}</dd>
+ </div>
+ )
+}
+
+/** What is known about the selected job: how it ended, where it ran, what it cost, and why it failed. */
+export function CIExplorerJobDetails({ job, run }: { job: WorkflowJobApi; run: WorkflowRun }): JSX.Element {
+ const { repoOwner, repoName, focusedJobInsights, workflowRunUrl } = useValues(ciExplorerLogic)
+
+ return (
+ <>
+ <h3 className="m-0 break-words text-sm font-semibold">{job.name}</h3>
+ <dl className="m-0 flex flex-col gap-1.5">
+ <Row label="Status">{statusLabel(job.conclusion, job.status)}</Row>
+ <Row label="Elapsed">{elapsedLabel(job.duration_seconds, job.status)}</Row>
+ {job.started_at && (
+ <Row label="Started">
+ <TZLabel time={job.started_at} />
+ </Row>
+ )}
+ <Row label="Provider">
+ <span className="inline-flex items-center gap-1.5">
+ <CIExplorerProviderMark engine={job.ci_engine} />
+ {providerName(job.ci_engine)}
+ </span>
+ </Row>
+ <Row label="Runner">{job.runner_label || 'Unknown'}</Row>
+ {job.estimated_cost_usd !== null && (
+ <Row label="Estimated cost">{compactUsd(job.estimated_cost_usd)}</Row>
+ )}
+ </dl>
+ {isDecisiveFailure(job.conclusion) && <CIExplorerFailureLog />}
+ {focusedJobInsights && focusedJobInsights.job.length > 0 && (
+ <div className="flex flex-wrap gap-1.5">
+ <CIExplorerChips badges={focusedJobInsights.job} />
+ </div>
+ )}
+ {run.runId !== null && (
+ <div className="flex flex-wrap gap-2">
+ <LemonButton
+ type="secondary"
+ size="small"
+ to={workflowRunUrl(run.runId, run.ciEngine)}
+ data-attr="ci-explorer-open-run"
+ >
+ Open workflow run
+ </LemonButton>
+ {run.ciEngine !== 'depot_ci' && (
+ <LemonButton
+ type="secondary"
+ size="small"
+ to={githubJobUrl(repoOwner, repoName, run.runId, job.id)}
+ targetBlank
+ data-attr="ci-explorer-open-job-github"
+ >
+ Open job on GitHub
+ </LemonButton>
+ )}
+ </div>
+ )}
+ </>
+ )
+}
diff --git a/products/engineering_analytics/frontend/components/ciExplorer/CIExplorerOverview.tsx b/products/engineering_analytics/frontend/components/ciExplorer/CIExplorerOverview.tsx
new file mode 100644
index 000000000000..c703f56e1436
--- /dev/null
+++ b/products/engineering_analytics/frontend/components/ciExplorer/CIExplorerOverview.tsx
@@ -0,0 +1,69 @@
+import { BindLogic, useActions, useValues } from 'kea'
+
+import { LemonBanner, LemonButton } from '@posthog/lemon-ui'
+
+import { pluralize } from 'lib/utils/strings'
+
+import { ciExplorerContextLogic } from '../../scenes/ciExplorerContextLogic'
+import { ciExplorerLogic } from '../../scenes/ciExplorerLogic'
+import { CIExplorerCanvas } from './CIExplorerCanvas'
+import { CIExplorerShare } from './CIExplorerShare'
+import { CIExplorerTrail } from './CIExplorerTrail'
+
+/** The CI of one commit: where the camera is, its share of the job time on request, and the canvas. */
+export function CIExplorerOverview(): JSX.Element {
+ const { activePush, selectedHeadSha, logicProps, jobTimeOpen, failedJobRuns, jobsByRunLoading } =
+ useValues(ciExplorerLogic)
+ const { toggleJobTime, retryFailedJobs } = useActions(ciExplorerLogic)
+ if (!activePush) {
+ return (
+ <div className="py-16 text-center text-sm text-secondary">
+ {selectedHeadSha === null
+ ? 'No CI runs are synced for this pull request yet. Runs appear here after the next sync.'
+ : 'No CI runs are synced for this commit. Open Activity to choose another commit.'}
+ </div>
+ )
+ }
+ return (
+ <BindLogic logic={ciExplorerContextLogic} props={logicProps}>
+ <div className="flex flex-wrap items-center justify-between gap-x-4 gap-y-1">
+ <CIExplorerTrail />
+ <LemonButton
+ size="xsmall"
+ type="tertiary"
+ active={jobTimeOpen}
+ aria-expanded={jobTimeOpen}
+ onClick={toggleJobTime}
+ data-attr="ci-explorer-job-time-toggle"
+ >
+ Job time
+ </LemonButton>
+ </div>
+ {failedJobRuns.length > 0 && (
+ <LemonBanner
+ type="warning"
+ action={{
+ children: 'Retry',
+ onClick: retryFailedJobs,
+ loading: jobsByRunLoading,
+ disabledReason: jobsByRunLoading ? 'Loading' : undefined,
+ 'data-attr': 'ci-explorer-retry-jobs',
+ }}
+ >
+ Couldn't load jobs for {pluralize(failedJobRuns.length, 'workflow')}
+ </LemonBanner>
+ )}
+ {jobTimeOpen && <CIExplorerShare />}
+ {/* The canvas takes the height the header leaves, and no less than a readable minimum. */}
+ <div
+ className={
+ jobTimeOpen
+ ? 'h-[calc(100vh-24rem)] min-h-96 overflow-hidden rounded-lg border border-primary'
+ : 'h-[calc(100vh-20rem)] min-h-96 overflow-hidden rounded-lg border border-primary'
+ }
+ >
+ <CIExplorerCanvas />
+ </div>
+ </BindLogic>
+ )
+}
diff --git a/products/engineering_analytics/frontend/components/ciExplorer/CIExplorerShare.tsx b/products/engineering_analytics/frontend/components/ciExplorer/CIExplorerShare.tsx
new file mode 100644
index 000000000000..5a114173e703
--- /dev/null
+++ b/products/engineering_analytics/frontend/components/ciExplorer/CIExplorerShare.tsx
@@ -0,0 +1,69 @@
+import { useValues } from 'kea'
+
+import { Tooltip } from '@posthog/lemon-ui'
+
+import { cn } from 'lib/utils/css-classes'
+import { humanFriendlyDuration } from 'lib/utils/durations'
+
+import { ciExplorerLogic } from '../../scenes/ciExplorerLogic'
+
+// Each deeper level is a darker bar nested inside the level around it.
+const LEVEL_CLASS = [
+ 'bg-[color-mix(in_oklab,var(--color-text-primary)_30%,var(--color-bg-surface-primary))]',
+ 'bg-[color-mix(in_oklab,var(--color-text-primary)_58%,var(--color-bg-surface-primary))]',
+ 'bg-[var(--color-text-primary)]',
+]
+const LEVEL_INSET_PX = 3
+
+/** How much of the push's job time the current zoom level accounts for. */
+export function CIExplorerShare(): JSX.Element {
+ const { totalJobSeconds: total, shareLevels: levels } = useValues(ciExplorerLogic)
+
+ return (
+ <section aria-label="Share of job time" className="flex flex-col gap-2">
+ <div className="flex items-center gap-3">
+ <Tooltip title="Sum of all job durations. Not elapsed time, and not billed time.">
+ <div className="relative h-5 flex-1 overflow-hidden rounded bg-fill-secondary">
+ {levels.map((level, index) => (
+ <i
+ key={level.id}
+ className={cn(
+ 'absolute min-w-1 rounded-sm transition-[width] duration-300 motion-reduce:transition-none',
+ LEVEL_CLASS[index]
+ )}
+ // eslint-disable-next-line react/forbid-dom-props
+ style={{
+ inset: `${index * LEVEL_INSET_PX}px auto ${index * LEVEL_INSET_PX}px ${index * LEVEL_INSET_PX}px`,
+ width: `calc(${level.share}% - ${index * LEVEL_INSET_PX * 2}px)`,
+ }}
+ />
+ ))}
+ </div>
+ </Tooltip>
+ <span className="whitespace-nowrap font-mono text-xs text-secondary">
+ {humanFriendlyDuration(total, { maxUnits: 2 })} job time
+ </span>
+ </div>
+ <div className="flex min-h-5 flex-wrap gap-x-5 gap-y-1 text-xs text-secondary">
+ {levels.map((level, index) => (
+ <Tooltip
+ key={level.id}
+ title={`${humanFriendlyDuration(level.jobSeconds)} of job time${
+ level.elapsedSeconds === null
+ ? ''
+ : `, ${humanFriendlyDuration(level.elapsedSeconds)} elapsed`
+ }`}
+ >
+ <span className="inline-flex items-center gap-1.5">
+ <i className={cn('size-2 rounded-sm', LEVEL_CLASS[index])} />
+ {level.name}
+ <b className="font-semibold text-primary">
+ {level.share < 1 ? '<1' : Math.round(level.share)}%
+ </b>
+ </span>
+ </Tooltip>
+ ))}
+ </div>
+ </section>
+ )
+}
diff --git a/products/engineering_analytics/frontend/components/ciExplorer/CIExplorerSummaryCounts.tsx b/products/engineering_analytics/frontend/components/ciExplorer/CIExplorerSummaryCounts.tsx
new file mode 100644
index 000000000000..04ff5887019e
--- /dev/null
+++ b/products/engineering_analytics/frontend/components/ciExplorer/CIExplorerSummaryCounts.tsx
@@ -0,0 +1,32 @@
+import { useValues } from 'kea'
+
+import { Tooltip } from '@posthog/lemon-ui'
+
+import { ciExplorerLogic } from '../../scenes/ciExplorerLogic'
+
+/**
+ * How the commit's workflows ended, as counts. It names no verdict, because the repository's required checks are
+ * not synced: a failed count can be an optional workflow, and a clean count can miss a required one.
+ */
+export function CIExplorerSummaryCounts(): JSX.Element {
+ const { summary } = useValues(ciExplorerLogic)
+ const counts: [number, string, string][] = [
+ [summary.failed, 'failed', 'text-danger'],
+ [summary.running, 'running', 'text-warning'],
+ [summary.passed, 'passed', 'text-success'],
+ [summary.other, 'cancelled or skipped', 'text-secondary'],
+ ]
+ return (
+ <Tooltip title="Latest run of each workflow. Not a merge verdict: required checks are not synced.">
+ <span className="flex flex-wrap gap-x-3 text-xs font-medium tabular-nums" data-attr="ci-explorer-summary">
+ {counts
+ .filter(([count]) => count > 0)
+ .map(([count, label, className]) => (
+ <span key={label} className={className}>
+ {count} {label}
+ </span>
+ ))}
+ </span>
+ </Tooltip>
+ )
+}
diff --git a/products/engineering_analytics/frontend/components/ciExplorer/CIExplorerTooltip.tsx b/products/engineering_analytics/frontend/components/ciExplorer/CIExplorerTooltip.tsx
new file mode 100644
index 000000000000..cd0fa32883c9
--- /dev/null
+++ b/products/engineering_analytics/frontend/components/ciExplorer/CIExplorerTooltip.tsx
@@ -0,0 +1,145 @@
+import { useValues } from 'kea'
+import { type RefObject, useEffect, useRef, useState } from 'react'
+
+import { CIExplorerTip, nodeTip } from '../../lib/ciExplorerDetails'
+import { ciExplorerLogic } from '../../scenes/ciExplorerLogic'
+
+// The tooltip waits for the pointer to settle on a node. Moving to a neighbor then shows the next one at once.
+const DELAY_MS = 600
+const WARM_MS = 400
+// A node drawn smaller than this cannot be read, so it is not what the pointer is on.
+const MIN_NODE_HEIGHT = 20
+const POINTER_GAP = 16
+const EDGE_MARGIN = 8
+
+interface ShownTip {
+ tip: CIExplorerTip
+ x: number
+ y: number
+}
+
+/** A tooltip for whichever node the pointer rests on. One listener serves every node on the canvas. */
+export function CIExplorerTooltip({ stage }: { stage: RefObject<HTMLElement> }): JSX.Element | null {
+ const { workflows } = useValues(ciExplorerLogic)
+ const [shown, setShown] = useState<ShownTip | null>(null)
+ const box = useRef<HTMLDivElement>(null)
+
+ useEffect(() => {
+ const element = stage.current
+ if (!element) {
+ return
+ }
+ let target: HTMLElement | null = null
+ let timer: ReturnType<typeof setTimeout> | undefined
+ let visible = false
+ let hiddenAt = 0
+
+ const hide = (): void => {
+ clearTimeout(timer)
+ if (visible) {
+ hiddenAt = performance.now()
+ }
+ visible = false
+ target = null
+ setShown(null)
+ }
+ const onMove = (event: MouseEvent): void => {
+ const node = (event.target as HTMLElement).closest<HTMLElement>('[data-node-id]')
+ // A tile that is zoomed into shows its jobs, and those have their own tooltips.
+ const zoomedIntoTile = node?.matches('.CIExplorer__card') && element.dataset.deep === 'true'
+ const tip = node?.dataset.nodeId ? nodeTip(workflows, node.dataset.nodeId) : null
+ if (
+ !node ||
+ !tip ||
+ zoomedIntoTile ||
+ event.buttons ||
+ node.getBoundingClientRect().height < MIN_NODE_HEIGHT
+ ) {
+ hide()
+ return
+ }
+ if (node === target) {
+ return
+ }
+ const warm = visible || performance.now() - hiddenAt < WARM_MS
+ hide()
+ target = node
+ const show = (): void => {
+ visible = true
+ setShown({ tip, x: event.clientX, y: event.clientY })
+ }
+ if (warm) {
+ show()
+ } else {
+ timer = setTimeout(show, DELAY_MS)
+ }
+ }
+ // A node reached with the keyboard shows its tooltip at once, beside the node.
+ const onFocus = (event: FocusEvent): void => {
+ const focused = event.target as HTMLElement
+ const node = focused.closest<HTMLElement>('[data-node-id]')
+ const tip = node?.dataset.nodeId ? nodeTip(workflows, node.dataset.nodeId) : null
+ if (!node || !tip || !focused.matches(':focus-visible')) {
+ return
+ }
+ hide()
+ target = node
+ visible = true
+ const box = node.getBoundingClientRect()
+ setShown({ tip, x: Math.min(box.right, window.innerWidth - 2 * POINTER_GAP), y: Math.max(0, box.top) })
+ }
+ element.addEventListener('mousemove', onMove)
+ element.addEventListener('mouseleave', hide)
+ element.addEventListener('focusin', onFocus)
+ element.addEventListener('focusout', hide)
+ for (const type of ['pointerdown', 'wheel', 'keydown']) {
+ element.addEventListener(type, hide, { capture: true, passive: true })
+ }
+ return () => {
+ clearTimeout(timer)
+ element.removeEventListener('mousemove', onMove)
+ element.removeEventListener('mouseleave', hide)
+ element.removeEventListener('focusin', onFocus)
+ element.removeEventListener('focusout', hide)
+ for (const type of ['pointerdown', 'wheel', 'keydown']) {
+ element.removeEventListener(type, hide, { capture: true })
+ }
+ }
+ }, [stage, workflows])
+
+ // The box is placed after it renders, when its size is known, so it never leaves the window.
+ useEffect(() => {
+ if (!shown || !box.current) {
+ return
+ }
+ const { offsetWidth: width, offsetHeight: height } = box.current
+ const below = shown.y + POINTER_GAP + height <= window.innerHeight
+ box.current.style.left = `${Math.max(EDGE_MARGIN, Math.min(shown.x + POINTER_GAP, window.innerWidth - width - EDGE_MARGIN))}px`
+ box.current.style.top = `${below ? shown.y + POINTER_GAP : Math.max(EDGE_MARGIN, shown.y - height - POINTER_GAP)}px`
+ box.current.style.visibility = 'visible'
+ }, [shown])
+
+ if (!shown) {
+ return null
+ }
+ return (
+ <div
+ ref={box}
+ role="tooltip"
+ className="pointer-events-none fixed z-[var(--z-tooltip)] max-w-80 rounded-md bg-[var(--color-text-primary)] px-3 py-2 text-xs text-[var(--color-bg-primary)]"
+ // Hidden until the effect above has placed it. A utility class cannot do this, because utilities are `!important`.
+ // eslint-disable-next-line react/forbid-dom-props
+ style={{ visibility: 'hidden' }}
+ >
+ <b className="mb-1 block break-words font-semibold">{shown.tip.name}</b>
+ <dl className="m-0 grid grid-cols-[auto_minmax(0,1fr)] gap-x-3 gap-y-0.5">
+ {shown.tip.rows.map(([label, value]) => (
+ <div key={label} className="contents">
+ <dt className="opacity-65">{label}</dt>
+ <dd className="m-0 break-words font-mono">{value}</dd>
+ </div>
+ ))}
+ </dl>
+ </div>
+ )
+}
diff --git a/products/engineering_analytics/frontend/components/ciExplorer/CIExplorerTrail.tsx b/products/engineering_analytics/frontend/components/ciExplorer/CIExplorerTrail.tsx
new file mode 100644
index 000000000000..86a42ee6bd81
--- /dev/null
+++ b/products/engineering_analytics/frontend/components/ciExplorer/CIExplorerTrail.tsx
@@ -0,0 +1,76 @@
+import { useActions, useValues } from 'kea'
+import { Fragment } from 'react'
+
+import { Link, Tooltip } from '@posthog/lemon-ui'
+
+import { humanFriendlyDuration } from 'lib/utils/durations'
+
+import { ciExplorerLogic } from '../../scenes/ciExplorerLogic'
+
+function Elapsed({ seconds, title }: { seconds: number | null; title: string }): JSX.Element | null {
+ return seconds === null ? null : (
+ <Tooltip title={title}>
+ <span className="font-mono text-xs text-secondary">
+ {humanFriendlyDuration(seconds, { maxUnits: 2 })} elapsed
+ </span>
+ </Tooltip>
+ )
+}
+
+function Separator(): JSX.Element {
+ return (
+ <span className="text-tertiary" aria-hidden="true">
+ ›
+ </span>
+ )
+}
+
+/** Where the camera is: the commit's workflows, then each node it has zoomed into. The last one carries its elapsed time. */
+export function CIExplorerTrail(): JSX.Element {
+ const { focusLevels, pushDurationSeconds, activePush, onOlderCommit } = useValues(ciExplorerLogic)
+ const { setFocus, setView } = useActions(ciExplorerLogic)
+ const last = focusLevels[focusLevels.length - 1]
+ // An older commit was reached from the activity, so the trail starts there.
+ const root = onOlderCommit && activePush ? `Commit ${activePush.headSha.slice(0, 7)}` : 'Workflows'
+
+ return (
+ <nav aria-label="Zoom level" className="flex flex-wrap items-baseline gap-x-2 gap-y-1 text-sm">
+ {onOlderCommit && (
+ <>
+ <Link onClick={() => setView('activity')} subtle data-attr="ci-explorer-trail-activity">
+ Activity
+ </Link>
+ <Separator />
+ </>
+ )}
+ {last ? (
+ <Link onClick={() => setFocus(null)} subtle data-attr="ci-explorer-trail-overview">
+ {root}
+ </Link>
+ ) : (
+ <>
+ <strong>{root}</strong>
+ <Elapsed
+ seconds={pushDurationSeconds}
+ title="First workflow start to last workflow finish on this commit"
+ />
+ </>
+ )}
+ {focusLevels.map((level) => (
+ <Fragment key={level.id}>
+ <Separator />
+ {level === last ? (
+ <>
+ <strong>{level.name}</strong>
+ <Elapsed seconds={level.durationSeconds} title="First start to last finish" />
+ </>
+ ) : (
+ <Link onClick={() => setFocus(level.id)} subtle data-attr="ci-explorer-trail-level">
+ {level.name}
+ </Link>
+ )}
+ </Fragment>
+ ))}
+ </nav>
+ )
+}
diff --git a/products/engineering_analytics/frontend/lib/pullRequestReference.test.ts b/products/engineering_analytics/frontend/lib/pullRequestReference.test.ts
new file mode 100644
index 000000000000..1018db506aa9
--- /dev/null
+++ b/products/engineering_analytics/frontend/lib/pullRequestReference.test.ts
@@ -0,0 +1,87 @@
+import type { GitHubSourceApi } from '../generated/api.schemas'
+import {
+ type PullRequestReference,
+ type PullRequestTarget,
+ parsePullRequestReference,
+ resolvePullRequestTarget,
+} from './pullRequestReference'
+
+const LINK: PullRequestReference = { kind: 'link', owner: 'PostHog', repo: 'posthog', number: 123 }
+const NUMBER: PullRequestReference = { kind: 'number', number: 123 }
+
+const POSTHOG: GitHubSourceApi = { id: 'src-posthog', repo: 'PostHog/posthog', prefix: '', synced: true }
+const WEBSITE: GitHubSourceApi = { id: 'src-website', repo: 'PostHog/posthog.com', prefix: '', synced: true }
+
+describe('pullRequestReference', () => {
+ it.each<[string, string, PullRequestReference | null]>([
+ ['a link', 'https://github.com/PostHog/posthog/pull/123', LINK],
+ ['a link with no scheme', 'github.com/PostHog/posthog/pull/123', LINK],
+ ['a link with a www host in capitals', 'HTTP://WWW.GitHub.com/PostHog/posthog/pull/123', LINK],
+ ['a link to the files tab', 'https://github.com/PostHog/posthog/pull/123/files', LINK],
+ ['a link with a query', 'https://github.com/PostHog/posthog/pull/123?diff=split', LINK],
+ ['a link to a review comment', 'https://github.com/PostHog/posthog/pull/123#discussion_r42', LINK],
+ ['a link inside other text', 'see https://github.com/PostHog/posthog/pull/123, please', LINK],
+ [
+ 'a link to a repository with a dot in its name',
+ 'https://github.com/PostHog/posthog.com/pull/7',
+ { kind: 'link', owner: 'PostHog', repo: 'posthog.com', number: 7 },
+ ],
+ ['owner/repo#n', 'PostHog/posthog#123', { ...LINK, kind: 'repo_number' }],
+ ['#n', '#123', NUMBER],
+ ['digits', '123', NUMBER],
+ ['digits in whitespace', ' 123\n', NUMBER],
+ ['a link on another host', 'https://gitlab.com/PostHog/posthog/pull/123', null],
+ ['a host that only ends in github.com', 'https://notgithub.com/PostHog/posthog/pull/123', null],
+ ['a GitHub address in the path of another site', 'https://example.com/github.com/a/b/pull/123', null],
+ ['an issue link', 'https://github.com/PostHog/posthog/issues/123', null],
+ ['a commit link', 'https://github.com/PostHog/posthog/commit/123', null],
+ ['a link to pull request zero', 'https://github.com/PostHog/posthog/pull/0', null],
+ ['zero', '#0', null],
+ ['digits with a suffix', '123abc', null],
+ ['words', 'not a pr', null],
+ ['nothing', ' ', null],
+ ])('parses %s', (_label, text, expected) => {
+ expect(parsePullRequestReference(text)).toEqual(expected)
+ })
+
+ it.each<[string, PullRequestReference, GitHubSourceApi[], GitHubSourceApi | null, PullRequestTarget | null]>([
+ [
+ 'a bare number to the picked repository',
+ NUMBER,
+ [POSTHOG, WEBSITE],
+ WEBSITE,
+ { owner: 'PostHog', repo: 'posthog.com', number: 123, sourceId: 'src-website' },
+ ],
+ [
+ 'a bare number to the only connected repository',
+ NUMBER,
+ [POSTHOG],
+ null,
+ { owner: 'PostHog', repo: 'posthog', number: 123, sourceId: 'src-posthog' },
+ ],
+ ['a bare number to nothing when several repositories are connected', NUMBER, [POSTHOG, WEBSITE], null, null],
+ [
+ 'a bare number to nothing when the only source reports no repository',
+ NUMBER,
+ [{ ...POSTHOG, repo: '' }],
+ null,
+ null,
+ ],
+ [
+ 'a link to its own repository, in the casing of the source, when another is picked',
+ { kind: 'link', owner: 'posthog', repo: 'POSTHOG', number: 123 },
+ [POSTHOG, WEBSITE],
+ WEBSITE,
+ { owner: 'PostHog', repo: 'posthog', number: 123, sourceId: 'src-posthog' },
+ ],
+ [
+ 'a link to a repository with no connected source as typed',
+ { kind: 'link', owner: 'keajs', repo: 'kea', number: 123 },
+ [POSTHOG],
+ POSTHOG,
+ { owner: 'keajs', repo: 'kea', number: 123, sourceId: null },
+ ],
+ ])('resolves %s', (_label, reference, sources, pickedSource, expected) => {
+ expect(resolvePullRequestTarget(reference, sources, pickedSource)).toEqual(expected)
+ })
+})
diff --git a/products/engineering_analytics/frontend/lib/pullRequestReference.ts b/products/engineering_analytics/frontend/lib/pullRequestReference.ts
new file mode 100644
index 000000000000..6316f144f0fd
--- /dev/null
+++ b/products/engineering_analytics/frontend/lib/pullRequestReference.ts
@@ -0,0 +1,54 @@
+import type { GitHubSourceApi } from '../generated/api.schemas'
+
+/** A pull request that free text names. A bare number names no repository. */
+export type PullRequestReference =
+ | { kind: 'link' | 'repo_number'; owner: string; repo: string; number: number }
+ | { kind: 'number'; number: number }
+
+export interface PullRequestTarget {
+ owner: string
+ repo: string
+ number: number
+ /** The connected source that syncs the repository. Null when no connected source does. */
+ sourceId: string | null
+}
+
+// The host must start the text or follow a character that a host name or a path cannot contain. Without
+// that guard `notgithub.com`, `gist.github.com`, and a GitHub address in the path of another site all match.
+const LINK = /(?:^|[^\w./-])(?:https?:\/\/)?(?:www\.)?github\.com\/([\w-]+)\/([\w.-]+)\/pull\/(\d+)\b/i
+const REPO_NUMBER = /^([\w-]+)\/([\w.-]+)#(\d+)$/
+const NUMBER = /^#?(\d+)$/
+
+export function parsePullRequestReference(text: string): PullRequestReference | null {
+ const trimmed = text.trim()
+ const link = LINK.exec(trimmed)
+ const named = link ?? REPO_NUMBER.exec(trimmed)
+ const digits = named?.[3] ?? NUMBER.exec(trimmed)?.[1]
+ const number = digits ? Number(digits) : 0
+ // Past the safe integer range a number prints in exponent form, which is not a pull request number.
+ if (!Number.isSafeInteger(number) || number < 1) {
+ return null
+ }
+ return named
+ ? { kind: link ? 'link' : 'repo_number', owner: named[1], repo: named[2], number }
+ : { kind: 'number', number }
+}
+
+/** Where a reference opens. A bare number takes the repository of `pickedSource`, else of the only connected
+ * source. The result is null when a bare number has neither. */
+export function resolvePullRequestTarget(
+ reference: PullRequestReference,
+ sources: GitHubSourceApi[],
+ pickedSource: GitHubSourceApi | null
+): PullRequestTarget | null {
+ if (reference.kind === 'number') {
+ const source = pickedSource ?? (sources.length === 1 ? sources[0] : null)
+ const [owner, repo] = source?.repo.split('/') ?? []
+ return source && owner && repo ? { owner, repo, number: reference.number, sourceId: source.id } : null
+ }
+ // GitHub ignores case in repository names, so match that way and keep the casing the source reports.
+ const fullName = `${reference.owner}/${reference.repo}`.toLowerCase()
+ const source = sources.find(({ repo }) => repo.toLowerCase() === fullName)
+ const [owner, repo] = source ? source.repo.split('/') : [reference.owner, reference.repo]
+ return { owner, repo, number: reference.number, sourceId: source?.id ?? null }
+}
diff --git a/products/engineering_analytics/frontend/scenes/CIExplorerScene.stories.tsx b/products/engineering_analytics/frontend/scenes/CIExplorerScene.stories.tsx
new file mode 100644
index 000000000000..3f5a6696ac9a
--- /dev/null
+++ b/products/engineering_analytics/frontend/scenes/CIExplorerScene.stories.tsx
@@ -0,0 +1,140 @@
+import { Meta, StoryObj } from '@storybook/react'
+
+import { FEATURE_FLAGS } from 'lib/constants'
+import { App } from 'scenes/App'
+import { urls } from 'scenes/urls'
+
+import { mswDecorator } from '~/mocks/browser'
+
+import type { CIDataFreshnessApi, PRLifecycleApi, WorkflowJobApi, WorkflowRunDetailApi } from '../generated/api.schemas'
+
+const REPO = { provider: 'github', owner: 'PostHog', name: 'posthog' }
+const NUMBER = 4820
+const PUSHED_AT = '2026-07-01T11:12:00Z'
+
+function run(
+ id: number,
+ workflow: string,
+ conclusion: string | null,
+ minutes: number,
+ overrides: Partial<WorkflowRunDetailApi> = {}
+): WorkflowRunDetailApi {
+ return {
+ repo: REPO,
+ id,
+ ci_engine: 'github_actions',
+ workflow_name: workflow,
+ workflow_id: id,
+ event: 'pull_request',
+ head_sha: 'c0ffee4820aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
+ head_branch: 'feat/run-scope-groups',
+ status: conclusion === null ? 'in_progress' : 'completed',
+ conclusion,
+ run_started_at: PUSHED_AT,
+ updated_at: new Date(Date.parse(PUSHED_AT) + minutes * 60_000).toISOString(),
+ duration_seconds: conclusion === null ? null : minutes * 60,
+ run_attempt: 1,
+ pr_number: NUMBER,
+ commit_pr_number: null,
+ is_merge_queue: false,
+ ...overrides,
+ }
+}
+
+// A failed workflow, a running one, a Depot CI one, and an earlier commit with a failure in its history.
+const RUNS: WorkflowRunDetailApi[] = [
+ run(1, 'Backend CI', 'failure', 28),
+ run(2, 'Frontend CI', 'success', 17),
+ run(3, 'Backend CI on Depot', 'success', 22, { ci_engine: 'depot_ci', workflow_id: null, event: null }),
+ run(4, 'Storybook', null, 9),
+ run(5, 'Backend CI', 'failure', 25, {
+ head_sha: 'badc0de4820bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',
+ run_started_at: '2026-06-30T16:40:00Z',
+ updated_at: '2026-06-30T17:05:00Z',
+ }),
+]
+
+const JOBS: WorkflowJobApi[] = [1, 2, 3].map((shard) => ({
+ id: shard,
+ run_id: 1,
+ ci_engine: 'github_actions',
+ steps: [],
+ name: `Python tests (${shard}/3)`,
+ status: 'completed',
+ conclusion: shard === 2 ? 'failure' : 'success',
+ started_at: PUSHED_AT,
+ completed_at: new Date(Date.parse(PUSHED_AT) + (16 + shard) * 60_000).toISOString(),
+ duration_seconds: (16 + shard) * 60,
+ runner_provider: 'self_hosted',
+ runner_label: 'depot-ubuntu-16',
+ estimated_cost_usd: 0.5,
+}))
+
+const LIFECYCLE: PRLifecycleApi = {
+ pull_request: {
+ author: { handle: 'octocat', display_name: 'octocat', avatar_url: '', is_bot: false },
+ repo: REPO,
+ id: 90000 + NUMBER,
+ number: NUMBER,
+ title: 'Group runs by scope',
+ state: 'open',
+ is_draft: false,
+ created_at: '2026-06-30T16:38:00Z',
+ merged_at: null,
+ closed_at: null,
+ },
+ events: [
+ { kind: 'opened', at: '2026-06-30T16:38:00Z' },
+ { kind: 'converted_to_draft', at: '2026-06-30T18:00:00Z', detail: 'octocat' },
+ { kind: 'ready_for_review', at: '2026-07-01T11:00:00Z', detail: 'octocat' },
+ ],
+ metric_quality: 'partial',
+}
+
+const FRESHNESS: CIDataFreshnessApi = {
+ runs_synced_at: '2026-07-01T23:40:00Z',
+ jobs_synced_at: '2026-07-01T23:35:00Z',
+}
+
+const meta: Meta = {
+ component: App,
+ title: 'Scenes-App/Engineering Analytics/CI Explorer',
+ parameters: {
+ layout: 'fullscreen',
+ viewMode: 'story',
+ mockDate: '2026-07-02',
+ featureFlags: [FEATURE_FLAGS.ENGINEERING_ANALYTICS],
+ pageUrl: urls.engineeringAnalyticsCIExplorer('PostHog', 'posthog', NUMBER),
+ testOptions: { waitForSelector: '.CIExplorer__card' },
+ },
+ decorators: [
+ mswDecorator({
+ get: {
+ 'api/projects/:team_id/engineering_analytics/pr_lifecycle/': LIFECYCLE,
+ 'api/projects/:team_id/engineering_analytics/pr_runs/': RUNS,
+ 'api/projects/:team_id/engineering_analytics/workflow_jobs/': JOBS,
+ 'api/projects/:team_id/engineering_analytics/ci_data_freshness/': FRESHNESS,
+ 'api/projects/:team_id/engineering_analytics/ci_failure_logs/': {
+ repo: REPO,
+ pr_number: NUMBER,
+ jobs: [],
+ },
+ },
+ }),
+ ],
+}
+export default meta
+
+type Story = StoryObj<typeof meta>
+
+export const Overview: Story = {
+ render: () => <App />,
+}
+
+export const Activity: Story = {
+ render: () => <App />,
+ parameters: {
+ pageUrl: `${urls.engineeringAnalyticsCIExplorer('PostHog', 'posthog', NUMBER)}?view=activity`,
+ testOptions: { waitForSelector: '[data-attr="ci-explorer-activity-commit"]' },
+ },
+}
diff --git a/products/engineering_analytics/frontend/scenes/CIExplorerScene.tsx b/products/engineering_analytics/frontend/scenes/CIExplorerScene.tsx
new file mode 100644
index 000000000000..4a33b5d7cc55
--- /dev/null
+++ b/products/engineering_analytics/frontend/scenes/CIExplorerScene.tsx
@@ -0,0 +1,140 @@
+import { useActions, useValues } from 'kea'
+
+import { IconPullRequest, IconRefresh } from '@posthog/icons'
+import { LemonButton, LemonSkeleton, LemonTabs, Link, Tooltip } from '@posthog/lemon-ui'
+
+import { TZLabel } from 'lib/components/TZLabel'
+import { SceneExport } from 'scenes/sceneTypes'
+
+import { SceneContent } from '~/layout/scenes/components/SceneContent'
+import { SceneTitleSection } from '~/layout/scenes/components/SceneTitleSection'
+
+import { CIAnalyticsLoadError } from '../components/CIAnalyticsLoadError'
+import { CIExplorerActivity } from '../components/ciExplorer/CIExplorerActivity'
+import { CIExplorerOverview } from '../components/ciExplorer/CIExplorerOverview'
+import { CIExplorerSummaryCounts } from '../components/ciExplorer/CIExplorerSummaryCounts'
+import { EntityHeader } from '../components/EntityHeader'
+import { PullRequestStateTag } from '../components/PullRequestStateTag'
+import { CIExplorerLogicProps, CIExplorerView, ciExplorerLogic } from './ciExplorerLogic'
+
+export const scene: SceneExport<CIExplorerLogicProps> = {
+ component: CIExplorerScene,
+ logic: ciExplorerLogic,
+ paramsToProps: ({ params: { repoOwner, repoName, number }, searchParams: { source } }) => ({
+ repoOwner: decodeURIComponent(repoOwner),
+ repoName: decodeURIComponent(repoName),
+ number: parseInt(number, 10),
+ sourceId: source ?? null,
+ }),
+}
+
+export function CIExplorerScene(): JSX.Element {
+ const {
+ lifecycle,
+ prRuns,
+ prRunsLoading,
+ loadFailed,
+ view,
+ currentView,
+ activePush,
+ pullRequestUrl,
+ locationUrl,
+ syncedAt,
+ freshnessLoading,
+ refreshing,
+ } = useValues(ciExplorerLogic)
+ const { loadPrRuns, refresh } = useActions(ciExplorerLogic)
+
+ const pullRequest = lifecycle?.pull_request
+ const viewUrl = (target: CIExplorerView): string => locationUrl({ view: target, headSha: null, nodeId: null })
+ const busy = refreshing || prRunsLoading
+
+ return (
+ <SceneContent className="pb-4">
+ <SceneTitleSection
+ name="CI explorer"
+ resourceType={{ type: 'health' }}
+ actions={
+ <LemonButton
+ type="secondary"
+ size="small"
+ to={pullRequestUrl}
+ data-attr="ci-explorer-open-pull-request"
+ >
+ Open pull request
+ </LemonButton>
+ }
+ />
+
+ {pullRequest && (
+ <EntityHeader
+ icon={<IconPullRequest />}
+ title={pullRequest.title}
+ slug={
+ <>
+ <PullRequestStateTag state={pullRequest.state} isDraft={pullRequest.is_draft} />
+ <Link to={pullRequestUrl}>
+ {pullRequest.repo.owner}/{pullRequest.repo.name} #{pullRequest.number}
+ </Link>
+ </>
+ }
+ right={view === 'overview' && activePush ? <CIExplorerSummaryCounts /> : undefined}
+ />
+ )}
+
+ <div className="flex flex-wrap items-center justify-between gap-x-4 gap-y-1 border-b border-primary">
+ <LemonTabs
+ activeKey={currentView}
+ // Each tab is a link, so the router makes the change and Back undoes it.
+ onChange={() => {}}
+ tabs={[
+ { key: 'overview', label: 'Overview', link: viewUrl('overview') },
+ { key: 'activity', label: 'Activity', link: viewUrl('activity') },
+ ]}
+ barClassName="mb-0 border-b-0"
+ data-attr="ci-explorer-views"
+ />
+ <div className="flex items-center gap-2 pb-1 text-xs text-secondary">
+ <Tooltip title="Last sync of the stored CI data. Refresh reloads it and does not start a sync.">
+ <span>
+ {syncedAt ? (
+ <>
+ Synced <TZLabel time={syncedAt} />
+ </>
+ ) : freshnessLoading ? (
+ 'Checking sync time'
+ ) : (
+ 'Sync time unknown'
+ )}
+ </span>
+ </Tooltip>
+ <LemonButton
+ type="secondary"
+ size="xsmall"
+ icon={<IconRefresh />}
+ onClick={refresh}
+ loading={busy}
+ disabledReason={busy ? 'Loading' : undefined}
+ data-attr="ci-explorer-refresh"
+ >
+ Refresh
+ </LemonButton>
+ </div>
+ </div>
+
+ {loadFailed ? (
+ <CIAnalyticsLoadError
+ onRetry={loadPrRuns}
+ loading={prRunsLoading}
+ title="Couldn't load this pull request's CI runs"
+ />
+ ) : prRuns === null ? (
+ <LemonSkeleton className="h-96 w-full" />
+ ) : view === 'activity' ? (
+ <CIExplorerActivity />
+ ) : (
+ <CIExplorerOverview />
+ )}
+ </SceneContent>
+ )
+}
diff --git a/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsPullRequests.tsx b/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsPullRequests.tsx
index 282f5614ffad..c1630bb983b3 100644
--- a/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsPullRequests.tsx
+++ b/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsPullRequests.tsx
@@ -6,6 +6,7 @@ import { CIAnalyticsLoadError } from '../components/CIAnalyticsLoadError'
import { ConnectGitHubSource } from '../components/ConnectGitHubSource'
import { DeliveryPipeline } from '../components/DeliveryPipeline'
import { RepoEntityHeader } from '../components/EntityHeader'
+import { PullRequestJumpInput } from '../components/PullRequestJumpInput'
import { PullRequestTable } from '../components/PullRequestTable'
import { ScopePanel } from '../components/ScopePanel'
import { Section } from '../components/Section'
@@ -85,7 +86,10 @@ export function EngineeringAnalyticsPullRequests(): JSX.Element {
return (
<div className="flex flex-col gap-4">
- <RepoEntityHeader repoFullName={activeSource?.repo || ''} />
+ <div className="flex flex-wrap items-start justify-between gap-x-4 gap-y-2">
+ <RepoEntityHeader repoFullName={activeSource?.repo || ''} />
+ <PullRequestJumpInput />
+ </div>
{/* The panel is the scope. Everything below it is the current open backlog, not windowed. */}
<ScopePanel busy={timingLoading || doraLoading}>
diff --git a/products/engineering_analytics/frontend/scenes/PullRequestDetailScene.tsx b/products/engineering_analytics/frontend/scenes/PullRequestDetailScene.tsx
index 8c9c3e18a7f1..a57c7af3e6b7 100644
--- a/products/engineering_analytics/frontend/scenes/PullRequestDetailScene.tsx
+++ b/products/engineering_analytics/frontend/scenes/PullRequestDetailScene.tsx
@@ -485,16 +485,29 @@ export function PullRequestDetailScene(): JSX.Element {
name="Pull request"
resourceType={{ type: 'health' }}
actions={
- githubUrl ? (
- <LemonButton
- type="secondary"
- size="small"
- to={githubUrl}
- targetBlank
- sideIcon={<IconExternal />}
- >
- View on GitHub
- </LemonButton>
+ githubUrl && pullRequest ? (
+ <>
+ <LemonButton
+ type="secondary"
+ size="small"
+ to={withCurrentScope(
+ urls.engineeringAnalyticsCIExplorer(repoOwner, repoName, pullRequest.number),
+ sourceId
+ )}
+ data-attr="pull-request-open-ci-explorer"
+ >
+ View in CI explorer
+ </LemonButton>
+ <LemonButton
+ type="secondary"
+ size="small"
+ to={githubUrl}
+ targetBlank
+ sideIcon={<IconExternal />}
+ >
+ View on GitHub
+ </LemonButton>
+ </>
) : undefined
}
/>
diff --git a/products/engineering_analytics/frontend/scenes/engineeringAnalyticsLogic.test.ts b/products/engineering_analytics/frontend/scenes/engineeringAnalyticsLogic.test.ts
index 2948642a13b4..94c5e40f5acc 100644
--- a/products/engineering_analytics/frontend/scenes/engineeringAnalyticsLogic.test.ts
+++ b/products/engineering_analytics/frontend/scenes/engineeringAnalyticsLogic.test.ts
@@ -1,8 +1,10 @@
import { router } from 'kea-router'
import { expectLogic } from 'kea-test-utils'
+import posthog from 'posthog-js'
import { ApiConfig, ApiError } from 'lib/api'
import { dayjs } from 'lib/dayjs'
+import { removeProjectIdIfPresent } from 'lib/utils/kea-router'
import { urls } from 'scenes/urls'
import { resumeKeaLoadersErrors, silenceKeaLoadersErrors } from '~/initKea'
@@ -487,6 +489,68 @@ describe('engineeringAnalyticsLogic', () => {
expect(mockCiCards.mock.calls[0][1]).toMatchObject({ source_id: 'src-newer' })
})
+ const openPullRequestList = async (searchParams: Record<string, string>): Promise<jest.SpyInstance> => {
+ mockSources.mockResolvedValue(SOURCES)
+ router.actions.push(urls.engineeringAnalyticsPullRequestList(), searchParams)
+ logic = engineeringAnalyticsLogic()
+ logic.mount()
+ await expectLogic(logic).toDispatchActions(['loadGithubSourcesSuccess'])
+ return jest.spyOn(posthog, 'capture').mockImplementation(() => undefined)
+ }
+ const jumpEvents = (capture: jest.SpyInstance): unknown[] =>
+ capture.mock.calls
+ .filter(([event]) => event === 'ci explorer opened from pull request jump')
+ .map(([, properties]) => properties)
+ const routedPath = (): string => removeProjectIdIfPresent(router.values.location.pathname)
+
+ it.each([
+ [
+ 'a link in the repository it names, not the one in scope',
+ 'https://github.com/PostHog/posthog.com/pull/42/files',
+ urls.engineeringAnalyticsCIExplorer('posthog', 'posthog.com', 42),
+ { source: 'src-newer', repo: 'posthog/posthog.com' },
+ 'link',
+ ],
+ [
+ 'a bare number in the picked repository',
+ '#42',
+ urls.engineeringAnalyticsCIExplorer('posthog', 'posthog', 42),
+ { source: 'src-older', repo: 'posthog/posthog' },
+ 'number',
+ ],
+ ])('the pull request jump opens %s once', async (_label, text, pathname, scope, inputKind) => {
+ const capture = await openPullRequestList({ source: 'src-older', repo: 'posthog/posthog', date_from: '-30d' })
+
+ logic.actions.setPullRequestJumpText(text)
+ logic.actions.submitPullRequestJump()
+ logic.actions.submitPullRequestJump()
+
+ expect(routedPath()).toBe(pathname)
+ expect(router.values.searchParams).toEqual({ date_from: '-30d', ...scope })
+ expect(jumpEvents(capture)).toEqual([{ input_kind: inputKind }])
+ expect(logic.values.pullRequestJumpFailure).toBeNull()
+ })
+
+ it('the pull request jump says why it cannot open, until the cause is fixed', async () => {
+ const capture = await openPullRequestList({})
+
+ logic.actions.setPullRequestJumpText('not a pr')
+ logic.actions.submitPullRequestJump()
+ expect(logic.values.pullRequestJumpFailure).toBe('invalid')
+
+ logic.actions.setPullRequestJumpText('42')
+ expect(logic.values.pullRequestJumpFailure).toBeNull()
+ logic.actions.submitPullRequestJump()
+ expect(logic.values.pullRequestJumpFailure).toBe('needs_repository')
+ expect(routedPath()).toBe(urls.engineeringAnalyticsPullRequestList())
+ expect(jumpEvents(capture)).toEqual([])
+
+ logic.actions.setScope('src-newer', 'posthog/posthog.com')
+ expect(logic.values.pullRequestJumpFailure).toBeNull()
+ logic.actions.submitPullRequestJump()
+ expect(routedPath()).toBe(urls.engineeringAnalyticsCIExplorer('posthog', 'posthog.com', 42))
+ })
+
it.each([
[
'pull request',
diff --git a/products/engineering_analytics/frontend/scenes/engineeringAnalyticsLogic.ts b/products/engineering_analytics/frontend/scenes/engineeringAnalyticsLogic.ts
index 20331ee08958..a544fccf9909 100644
--- a/products/engineering_analytics/frontend/scenes/engineeringAnalyticsLogic.ts
+++ b/products/engineering_analytics/frontend/scenes/engineeringAnalyticsLogic.ts
@@ -12,6 +12,7 @@ import {
} from 'kea'
import { loaders } from 'kea-loaders'
import { actionToUrl, router, urlToAction } from 'kea-router'
+import posthog from 'posthog-js'
import { ApiConfig, ApiError } from 'lib/api'
import { dayjs } from 'lib/dayjs'
@@ -29,11 +30,15 @@ import {
} from '../generated/api'
import type { GitHubSourceApi, PullRequestListItemApi, PushCISampleApi } from '../generated/api.schemas'
import { CIStatus, ciStatusOf } from '../lib/ci'
+import { parsePullRequestReference, resolvePullRequestTarget } from '../lib/pullRequestReference'
import { type FleetSummary, computeFleetSummary } from '../lib/runHealth'
-import { scopeToValue } from '../lib/scope'
+import { scopeToValue, withScope } from '../lib/scope'
import { engineeringAnalyticsFiltersLogic } from './engineeringAnalyticsFiltersLogic'
import type { RunScopeParams } from './engineeringAnalyticsFiltersLogic'
+// pinned: analytics event name. Renaming it breaks the insights built on it.
+const EVENT_PULL_REQUEST_JUMP_OPENED = 'ci explorer opened from pull request jump'
+
// Mirrors the endpoint's server-side limit.
export const PR_TABLE_LIMIT = 1000
@@ -248,6 +253,10 @@ export const DEFAULT_FILTERS: PullRequestFilters = {
thrashOnly: false,
}
+/** Why the jump box could not open what it holds: the text names no pull request, or it is a bare number
+ * with no repository to open in. */
+export type PullRequestJumpFailure = 'invalid' | 'needs_repository'
+
export function isStuck(row: PullRequestRow, stuckCutoffMs: number): boolean {
return row.state === 'open' && !row.isDraft && !row.isBot && Date.parse(row.createdAt) < stuckCutoffMs
}
@@ -418,6 +427,8 @@ export interface engineeringAnalyticsLogicValues {
hasActiveWorkflowFilters: boolean
hasMultipleSources: boolean
notConnected: boolean
+ pullRequestJumpFailure: PullRequestJumpFailure | null
+ pullRequestJumpText: string
pullRequests: PullRequestRow[]
pullRequestsLoadError: boolean
pullRequestsLoading: boolean
@@ -459,6 +470,9 @@ export interface engineeringAnalyticsLogicActions {
applyCardFilter: (card: CardFilter) => {
card: CardFilter
}
+ failPullRequestJump: (failure: PullRequestJumpFailure) => {
+ failure: PullRequestJumpFailure
+ }
loadCards: () => any
loadCardsFailure: (
error: string,
@@ -564,6 +578,9 @@ export interface engineeringAnalyticsLogicActions {
setCiStatusFilter: (ciStatus: CIStatusFilter) => {
ciStatus: CIStatusFilter
}
+ setPullRequestJumpText: (text: string) => {
+ text: string
+ }
setReadyOnly: (ready: boolean) => {
ready: boolean
}
@@ -598,6 +615,9 @@ export interface engineeringAnalyticsLogicActions {
setWorkflowStatusFilter: (status: WorkflowStatusFilter) => {
status: WorkflowStatusFilter
}
+ submitPullRequestJump: () => {
+ value: true
+ }
toggleTrunkQuarantineTeam: (team: string) => {
team: string
}
@@ -702,6 +722,9 @@ export const engineeringAnalyticsLogic: LogicWrapper<engineeringAnalyticsLogicTy
setSourceId: (sourceId: string | null) => ({ sourceId }),
// The picker selects a (source, repo) pair in one action, so both land before a single refresh.
setScope: (sourceId: string | null, scopeRepo: string | null) => ({ sourceId, scopeRepo }),
+ setPullRequestJumpText: (text: string) => ({ text }),
+ submitPullRequestJump: true,
+ failPullRequestJump: (failure: PullRequestJumpFailure) => ({ failure }),
resetFilters: true,
toggleTrunkQuarantineTeam: (team: string) => ({ team }),
refresh: true,
@@ -927,6 +950,16 @@ export const engineeringAnalyticsLogic: LogicWrapper<engineeringAnalyticsLogicTy
// Repo scope of a multi-repo source. Cleared when the source changes on its own (the old repo
// belongs to the old source); the picker uses setScope to set both together.
scopeRepo: [null as string | null, { setScope: (_, { scopeRepo }) => scopeRepo, setSourceId: () => null }],
+ pullRequestJumpText: ['', { setPullRequestJumpText: (_, { text }) => text }],
+ // A scope change clears the message because picking a repository is one of the fixes it asks for.
+ pullRequestJumpFailure: [
+ null as PullRequestJumpFailure | null,
+ {
+ failPullRequestJump: (_, { failure }) => failure,
+ setPullRequestJumpText: () => null,
+ setScope: () => null,
+ },
+ ],
cardsStatus: [
'ok' as LoaderStatus,
{
@@ -1222,6 +1255,35 @@ export const engineeringAnalyticsLogic: LogicWrapper<engineeringAnalyticsLogicTy
actions.setReadyOnly(target === 'ready')
actions.setThrashOnly(target === 'thrash')
},
+ submitPullRequestJump: () => {
+ // A bare number needs the sources to find its repository, so do nothing until they load.
+ if (!values.pullRequestJumpText.trim() || values.githubSourcesLoading) {
+ return
+ }
+ const reference = parsePullRequestReference(values.pullRequestJumpText)
+ const pickedSource =
+ values.githubSources.find(
+ (source) => scopeToValue(source.id, source.repo) === values.selectedScope
+ ) ?? null
+ const target = reference && resolvePullRequestTarget(reference, values.githubSources, pickedSource)
+ if (!reference || !target) {
+ actions.failPullRequestJump(reference ? 'needs_repository' : 'invalid')
+ return
+ }
+ const { owner, repo, number, sourceId } = target
+ posthog.capture(EVENT_PULL_REQUEST_JUMP_OPENED, { input_kind: reference.kind })
+ // The next scene can take a moment to load. An empty box makes a second submit do nothing.
+ actions.setPullRequestJumpText('')
+ router.actions.push(
+ withScope(
+ urls.engineeringAnalyticsCIExplorer(owner, repo, number),
+ // The `repo` param of this page names the repository in scope here, which can
+ // differ from the repository of a pasted link.
+ { ...router.values.searchParams, repo: sourceId ? `${owner}/${repo}` : undefined },
+ sourceId
+ )
+ )
+ },
})),
actionToUrl(() => {
diff --git a/products/engineering_analytics/manifest.tsx b/products/engineering_analytics/manifest.tsx
index 751e645386c5..c382b7899423 100644
--- a/products/engineering_analytics/manifest.tsx
+++ b/products/engineering_analytics/manifest.tsx
@@ -27,6 +27,14 @@ export const manifest: ProductManifest = {
description: 'A single pull request: lifecycle milestones and CI runs on its head commit.',
iconType: 'health',
},
+ EngineeringAnalyticsCIExplorer: {
+ import: () => import('./frontend/scenes/CIExplorerScene'),
+ projectBased: true,
+ name: 'CI explorer',
+ layout: 'app-container',
+ description: "A pull request's CI on one zoomable canvas: workflows, jobs, and matrix shards.",
+ iconType: 'health',
+ },
EngineeringAnalyticsWorkflowRun: {
import: () => import('./frontend/scenes/WorkflowRunDetailScene'),
projectBased: true,
@@ -77,6 +85,10 @@ export const manifest: ProductManifest = {
'EngineeringAnalyticsPullRequest',
'engineeringAnalyticsPullRequest',
],
+ '/engineering-analytics/repos/:repoOwner/:repoName/pull-requests/:number/ci-explorer': [
+ 'EngineeringAnalyticsCIExplorer',
+ 'engineeringAnalyticsCIExplorer',
+ ],
'/engineering-analytics/repos/:repoOwner/:repoName/actions/runs/:runId': [
'EngineeringAnalyticsWorkflowRun',
'engineeringAnalyticsWorkflowRun',
@@ -108,6 +120,8 @@ export const manifest: ProductManifest = {
`/engineering-analytics/teams/${encodeURIComponent(ownerTeam)}`,
engineeringAnalyticsPullRequest: (repoOwner: string, repoName: string, number: number | string): string =>
`/engineering-analytics/repos/${encodeURIComponent(repoOwner)}/${encodeURIComponent(repoName)}/pull-requests/${number}`,
+ engineeringAnalyticsCIExplorer: (repoOwner: string, repoName: string, number: number | string): string =>
+ `/engineering-analytics/repos/${encodeURIComponent(repoOwner)}/${encodeURIComponent(repoName)}/pull-requests/${number}/ci-explorer`,
engineeringAnalyticsWorkflowRun: (
repoOwner: string,
repoName: string,
diff --git a/services/mcp/src/tools/links/app-url-manifest.json b/services/mcp/src/tools/links/app-url-manifest.json
index 3dc33877f8fb..09e9838d9677 100644
--- a/services/mcp/src/tools/links/app-url-manifest.json
+++ b/services/mcp/src/tools/links/app-url-manifest.json
@@ -679,6 +679,11 @@
"params": [],
"scope": "project"
},
+ "engineeringAnalyticsCIExplorer": {
+ "template": "/engineering-analytics/repos/{repoOwner}/{repoName}/pull-requests/{number}/ci-explorer",
+ "params": ["repoOwner", "repoName", "number"],
+ "scope": "project"
+ },
"engineeringAnalyticsDeploys": {
"template": "/engineering-analytics/deploys",
"params": [],
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/generate-app-url.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/generate-app-url.json
index 0b0572f9980f..a98c9c1e8d4c 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/generate-app-url.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/generate-app-url.json
@@ -13,7 +13,7 @@
"type": "object"
},
"url": {
- "description": "A path template copied verbatim from the catalog below (e.g. `/persons/{uuid}`). Its `{placeholders}` are filled from `params`. These slugs come from PostHog's canonical route table, so they are always correct — never pass a path that is not in this list.\n\n/account-connected/{kind}\n/account/credential-review\n/account/social-connected\n/activity-logs\n/activity/{tab}\n/agentic/account-mismatch\n/agentic/authorize\n/ai\n/ai-enrichment\n/ai-evals/datasets\n/ai-evals/datasets/{id}\n/ai-evals/evaluations\n/ai-evals/evaluations/offline/experiments\n/ai-evals/evaluations/offline/experiments/{experimentId}\n/ai-evals/evaluations/scorers\n/ai-evals/evaluations/scorers/{scorerId}\n/ai-evals/evaluations/scorers/{scorerId}/offline\n/ai-evals/evaluations/templates\n/ai-evals/evaluations/{id}\n/ai-evals/taggers\n/ai-evals/taggers/{id}\n/ai-observability/clusters\n/ai-observability/clusters/{runId}/{clusterId}\n/ai-observability/dashboard\n/ai-observability/errors\n/ai-observability/generations\n/ai-observability/playground\n/ai-observability/reviews\n/ai-observability/self-driving\n/ai-observability/sentiment\n/ai-observability/sessions\n/ai-observability/sessions/{id}\n/ai-observability/tools\n/ai-observability/traces\n/ai-observability/traces/{id}\n/ai-observability/users\n/ai/history\n/alerts\n/approvals/{id}\n/autoresearch\n/autoresearch/new\n/autoresearch/{id}\n/bi\n/bi/new\n/bi/{insightShortId}\n/billing/authorization_status\n/broadcasts\n/broadcasts/new\n/broadcasts/{id}\n/business-knowledge\n/business-knowledge/playground\n/business-knowledge/settings\n/business-knowledge/{id}\n/canvas\n/canvases\n/canvases/new\n/canvases/{id}\n/cli/authorize\n/cli/live\n/code-review\n/code/canvas/{channelId}/{dashboardId}\n/code/channel/{channelId}\n/code/loop/{loopId}\n/code/task/{taskId}\n/cohorts\n/cohorts/{id}\n/cohorts/{id}/calculation-history\n/connect/vercel/link\n/coupons/{campaign}\n/create-organization\n/cross-project-dashboards\n/cross-project-dashboards/{id}\n/customer_analytics\n/customer_analytics/accounts\n/customer_analytics/accounts/by-external-id/{externalId}\n/customer_analytics/accounts/{accountId}\n/customer_analytics/announcements\n/customer_analytics/configuration\n/customer_analytics/dashboard\n/customer_analytics/feature-requests\n/customer_analytics/feed\n/customer_analytics/journeys\n/customer_analytics/journeys/new\n/customer_analytics/journeys/templates\n/customer_analytics/journeys/{id}/edit\n/customer_analytics/notes\n/customer_analytics/tasks\n/dashboard\n/dashboard/templates/{templateId}/copy-to-project\n/dashboard/{id}\n/dashboard/{id}/sharing\n/dashboard/{id}/subscriptions\n/dashboard/{id}/subscriptions/{subscriptionId}\n/dashboard/{id}/tiles/{tileId}\n/data-catalog\n/data-catalog/metrics/{name}\n/data-management/actions\n/data-management/actions/new\n/data-management/actions/new/\n/data-management/actions/{id}\n/data-management/annotations\n/data-management/annotations/{id}\n/data-management/core-events\n/data-management/database\n/data-management/destinations\n/data-management/event-filtering\n/data-management/events\n/data-management/events/{id}\n/data-management/events/{id}/edit\n/data-management/history\n/data-management/ingestion-warnings\n/data-management/ingestion-warnings-v2\n/data-management/managed-viewsets\n/data-management/materialized-columns\n/data-management/properties\n/data-management/properties/{id}\n/data-management/properties/{id}/edit\n/data-management/revenue\n/data-management/schema\n/data-management/sources\n/data-management/sources/{id}/schemas\n/data-management/sources/{sourceId}/schemas/{schemaId}\n/data-management/transformations\n/data-management/variables\n/data-management/variables/{id}\n/data-management/variables/{id}/edit\n/data-management/warehouse-destinations\n/data-management/warehouse-properties\n/data-ops\n/data-warehouse/connect\n/data-warehouse/new-source\n/debug\n/debug/hog\n/debug/precompute\n/early_access_features\n/early_access_features/{id}\n/embedded/{token}\n/endpoints\n/endpoints/{name}\n/engineering-analytics/authors\n/engineering-analytics/authors/{handle}\n/engineering-analytics/deploys\n/engineering-analytics/overview\n/engineering-analytics/pull-requests\n/engineering-analytics/repos/{repoOwner}/{repoName}/actions/runs/{runId}\n/engineering-analytics/repos/{repoOwner}/{repoName}/actions/workflows/{workflowName}\n/engineering-analytics/repos/{repoOwner}/{repoName}/pull-requests/{number}\n/engineering-analytics/teams\n/engineering-analytics/teams/{ownerTeam}\n/engineering-analytics/tests\n/engineering-analytics/workflows\n/error_tracking\n/error_tracking/alerts/new/{templateId}\n/error_tracking/alerts/{id}\n/error_tracking/fingerprint/{fingerprint}\n/error_tracking/{id}\n/etl\n/events/{id}/{timestamp}\n/experiments\n/experiments/shared-metrics\n/experiments/shared-metrics/{id}\n/experiments/staff\n/experiments/{id}\n/exports\n/feature_flags\n/feature_flags/new\n/feature_flags/staff\n/feature_flags/staff/cohorts\n/feature_flags/templates\n/feature_flags/{id}\n/files\n/functions/new/{templateId}\n/functions/{id}\n/games/368hedgehogs\n/games/flappyhog\n/games/shipit\n/groups/{groupTypeIndex}\n/groups/{groupTypeIndex}/new\n/groups/{groupTypeIndex}/{groupKey}\n/health\n/health/alerts\n/health/pipeline-status\n/health/sdk-health\n/health/{category}\n/heatmaps\n/heatmaps/new\n/heatmaps/recording\n/heatmaps/{id}\n/home\n/identity-matching\n/inbox\n/inbox/reports/triage\n/inbox/scout-trials\n/inbox/scouts/findings\n/inbox/scouts/runs\n/inbox/scouts/scratchpad\n/inbox/scouts/{skillName}\n/inbox/{tab}/{reportId}\n/insights\n/insights/new\n/insights/quick-start\n/insights/{id}\n/insights/{id}/edit\n/insights/{id}/sharing\n/insights/{id}/subscriptions\n/insights/{id}/subscriptions/{subscriptionId}\n/insights/{insightShortId}/alerts\n/instance/async_migrations\n/instance/async_migrations/future\n/instance/async_migrations/settings\n/instance/dead_letter_queue\n/instance/kafka_inspector\n/instance/metrics\n/instance/settings\n/instance/staff_users\n/instance/status\n/integrations/stripe/confirm-install\n/integrations/vercel/link-error\n/integrations/{kind}/callback\n/integrations/{slug}\n/legal\n/legal/new/{type}\n/login\n/login/2fa\n/login/2fa_setup\n/logs\n/logs/alerts/{alertId}/notifications/{hogFunctionId}\n/logs/alerts/{id}\n/logs/drop-rules/new\n/logs/drop-rules/{id}\n/logs/retention-rules/new\n/logs/retention-rules/{id}\n/managed_migrations\n/managed_migrations/new\n/marketing\n/mcp-analytics\n/mcp-analytics/activity\n/mcp-analytics/dashboard\n/mcp-analytics/intent-clustering\n/mcp-analytics/missing-capabilities\n/mcp-analytics/notifications\n/mcp-analytics/sessions\n/mcp-analytics/tool-quality\n/mcp-analytics/tool-quality/{toolName}\n/mcp-registry\n/mcp-servers\n/mcp-servers/agent/{id}\n/mcp-servers/member/{id}\n/mcp-servers/server/{id}\n/mcp-servers/{tab}\n/metrics\n/models\n/models/{id}\n/move-to-cloud\n/my-tickets\n/notebooks\n/notebooks/widgets/{widgetId}\n/notebooks/{shortId}\n/oauth/authorize\n/onboarding\n/organization-deactivated\n/organization-pending-deletion\n/organization/billing\n/organization/billing/overview\n/organization/billing/real-time-usage\n/organization/confirm-creation\n/organization/create-project\n/person/{id}\n/persons\n/persons/{uuid}\n/pipeline/batch-exports/new/{service}\n/pipeline/batch-exports/{id}\n/pipeline/new/\n/pipeline/plugins/{id}\n/platform-alerts\n/platform-alerts/{id}\n/preflight\n/product_tours\n/product_tours/{id}\n/project-pending-deletion\n/prompt-management/prompts\n/prompt-management/prompts/{name}\n/pulse\n/replay-vision\n/replay-vision/new/template\n/replay-vision/observations/{observationId}\n/replay-vision/{id}/budget\n/replay-vision/{id}/configure\n/replay-vision/{id}/details\n/replay-vision/{id}/overview\n/replay-vision/{id}/template\n/replay-vision/{id}/triggers\n/replay/file-playback\n/replay/home\n/replay/kiosk\n/replay/playlists/{id}\n/replay/settings\n/replay/{id}\n/reset\n/reset/{userUuid}/{token}\n/reset_2fa/{userUuid}/{token}\n/resource-transfer/{resourceKind}/{resourceId}\n/sessions/{id}\n/settings/environment-approvals\n/settings/organization-authentication/{feature}/{configId}\n/settings/project\n/settings/user-feature-previews\n/shared/{token}\n/shared_dashboard/{shareToken}\n/signup\n/signup/{id}\n/site/{url}\n/skills\n/skills/community\n/skills/{categoryTab}\n/skills/{name}\n/slack-task-context\n/spaces\n/spaces/new\n/spaces/{id}\n/spaces/{id}/canvases\n/spaces/{id}/new\n/spaces/{id}/settings\n/sql\n/stamphog\n/stamphog/digests\n/stamphog/install/callback\n/stamphog/runs\n/startups\n/streamlit-apps\n/streamlit-apps/new\n/streamlit-apps/{id}\n/streamlit-apps/{id}/edit\n/subscriptions\n/subscriptions/new\n/subscriptions/{id}\n/subscriptions/{id}/edit\n/support\n/support/settings\n/support/tickets\n/support/tickets/{ticketId}\n/surveys\n/surveys/form/new\n/surveys/guided/new\n/surveys/{id}\n/tasks\n/tasks/new\n/tasks/{taskId}\n/terminal\n/themes/custom-css\n/toolbar\n/tools\n/tracing\n/tracing/retention-rules/new\n/tracing/retention-rules/{id}\n/unsubscribe\n/verify_email\n/views\n/views/new\n/visual_review\n/visual_review/repos/{repoId}/flakiness\n/visual_review/repos/{repoId}/runs\n/visual_review/repos/{repoId}/snapshots\n/visual_review/repos/{repoId}/{runType}/snapshots/{identifier}\n/visual_review/runs/{runId}\n/visual_review/settings\n/web\n/web-scripts\n/web-scripts/new\n/web/agents\n/web/bots\n/web/content-autopilot\n/web/health\n/web/live\n/web/marketing\n/web/page-performance\n/web/page-reports\n/web/recap\n/web/session-attribution-explorer\n/web/web-vitals\n/wizard/runs\n/workflows\n/workflows/library/messages/{id}\n/workflows/library/templates/new\n/workflows/library/templates/{id}\n/workflows/new/workflow\n/workflows/{id}/{tab}",
+ "description": "A path template copied verbatim from the catalog below (e.g. `/persons/{uuid}`). Its `{placeholders}` are filled from `params`. These slugs come from PostHog's canonical route table, so they are always correct — never pass a path that is not in this list.\n\n/account-connected/{kind}\n/account/credential-review\n/account/social-connected\n/activity-logs\n/activity/{tab}\n/agentic/account-mismatch\n/agentic/authorize\n/ai\n/ai-enrichment\n/ai-evals/datasets\n/ai-evals/datasets/{id}\n/ai-evals/evaluations\n/ai-evals/evaluations/offline/experiments\n/ai-evals/evaluations/offline/experiments/{experimentId}\n/ai-evals/evaluations/scorers\n/ai-evals/evaluations/scorers/{scorerId}\n/ai-evals/evaluations/scorers/{scorerId}/offline\n/ai-evals/evaluations/templates\n/ai-evals/evaluations/{id}\n/ai-evals/taggers\n/ai-evals/taggers/{id}\n/ai-observability/clusters\n/ai-observability/clusters/{runId}/{clusterId}\n/ai-observability/dashboard\n/ai-observability/errors\n/ai-observability/generations\n/ai-observability/playground\n/ai-observability/reviews\n/ai-observability/self-driving\n/ai-observability/sentiment\n/ai-observability/sessions\n/ai-observability/sessions/{id}\n/ai-observability/tools\n/ai-observability/traces\n/ai-observability/traces/{id}\n/ai-observability/users\n/ai/history\n/alerts\n/approvals/{id}\n/autoresearch\n/autoresearch/new\n/autoresearch/{id}\n/bi\n/bi/new\n/bi/{insightShortId}\n/billing/authorization_status\n/broadcasts\n/broadcasts/new\n/broadcasts/{id}\n/business-knowledge\n/business-knowledge/playground\n/business-knowledge/settings\n/business-knowledge/{id}\n/canvas\n/canvases\n/canvases/new\n/canvases/{id}\n/cli/authorize\n/cli/live\n/code-review\n/code/canvas/{channelId}/{dashboardId}\n/code/channel/{channelId}\n/code/loop/{loopId}\n/code/task/{taskId}\n/cohorts\n/cohorts/{id}\n/cohorts/{id}/calculation-history\n/connect/vercel/link\n/coupons/{campaign}\n/create-organization\n/cross-project-dashboards\n/cross-project-dashboards/{id}\n/customer_analytics\n/customer_analytics/accounts\n/customer_analytics/accounts/by-external-id/{externalId}\n/customer_analytics/accounts/{accountId}\n/customer_analytics/announcements\n/customer_analytics/configuration\n/customer_analytics/dashboard\n/customer_analytics/feature-requests\n/customer_analytics/feed\n/customer_analytics/journeys\n/customer_analytics/journeys/new\n/customer_analytics/journeys/templates\n/customer_analytics/journeys/{id}/edit\n/customer_analytics/notes\n/customer_analytics/tasks\n/dashboard\n/dashboard/templates/{templateId}/copy-to-project\n/dashboard/{id}\n/dashboard/{id}/sharing\n/dashboard/{id}/subscriptions\n/dashboard/{id}/subscriptions/{subscriptionId}\n/dashboard/{id}/tiles/{tileId}\n/data-catalog\n/data-catalog/metrics/{name}\n/data-management/actions\n/data-management/actions/new\n/data-management/actions/new/\n/data-management/actions/{id}\n/data-management/annotations\n/data-management/annotations/{id}\n/data-management/core-events\n/data-management/database\n/data-management/destinations\n/data-management/event-filtering\n/data-management/events\n/data-management/events/{id}\n/data-management/events/{id}/edit\n/data-management/history\n/data-management/ingestion-warnings\n/data-management/ingestion-warnings-v2\n/data-management/managed-viewsets\n/data-management/materialized-columns\n/data-management/properties\n/data-management/properties/{id}\n/data-management/properties/{id}/edit\n/data-management/revenue\n/data-management/schema\n/data-management/sources\n/data-management/sources/{id}/schemas\n/data-management/sources/{sourceId}/schemas/{schemaId}\n/data-management/transformations\n/data-management/variables\n/data-management/variables/{id}\n/data-management/variables/{id}/edit\n/data-management/warehouse-destinations\n/data-management/warehouse-properties\n/data-ops\n/data-warehouse/connect\n/data-warehouse/new-source\n/debug\n/debug/hog\n/debug/precompute\n/early_access_features\n/early_access_features/{id}\n/embedded/{token}\n/endpoints\n/endpoints/{name}\n/engineering-analytics/authors\n/engineering-analytics/authors/{handle}\n/engineering-analytics/deploys\n/engineering-analytics/overview\n/engineering-analytics/pull-requests\n/engineering-analytics/repos/{repoOwner}/{repoName}/actions/runs/{runId}\n/engineering-analytics/repos/{repoOwner}/{repoName}/actions/workflows/{workflowName}\n/engineering-analytics/repos/{repoOwner}/{repoName}/pull-requests/{number}\n/engineering-analytics/repos/{repoOwner}/{repoName}/pull-requests/{number}/ci-explorer\n/engineering-analytics/teams\n/engineering-analytics/teams/{ownerTeam}\n/engineering-analytics/tests\n/engineering-analytics/workflows\n/error_tracking\n/error_tracking/alerts/new/{templateId}\n/error_tracking/alerts/{id}\n/error_tracking/fingerprint/{fingerprint}\n/error_tracking/{id}\n/etl\n/events/{id}/{timestamp}\n/experiments\n/experiments/shared-metrics\n/experiments/shared-metrics/{id}\n/experiments/staff\n/experiments/{id}\n/exports\n/feature_flags\n/feature_flags/new\n/feature_flags/staff\n/feature_flags/staff/cohorts\n/feature_flags/templates\n/feature_flags/{id}\n/files\n/functions/new/{templateId}\n/functions/{id}\n/games/368hedgehogs\n/games/flappyhog\n/games/shipit\n/groups/{groupTypeIndex}\n/groups/{groupTypeIndex}/new\n/groups/{groupTypeIndex}/{groupKey}\n/health\n/health/alerts\n/health/pipeline-status\n/health/sdk-health\n/health/{category}\n/heatmaps\n/heatmaps/new\n/heatmaps/recording\n/heatmaps/{id}\n/home\n/identity-matching\n/inbox\n/inbox/reports/triage\n/inbox/scout-trials\n/inbox/scouts/findings\n/inbox/scouts/runs\n/inbox/scouts/scratchpad\n/inbox/scouts/{skillName}\n/inbox/{tab}/{reportId}\n/insights\n/insights/new\n/insights/quick-start\n/insights/{id}\n/insights/{id}/edit\n/insights/{id}/sharing\n/insights/{id}/subscriptions\n/insights/{id}/subscriptions/{subscriptionId}\n/insights/{insightShortId}/alerts\n/instance/async_migrations\n/instance/async_migrations/future\n/instance/async_migrations/settings\n/instance/dead_letter_queue\n/instance/kafka_inspector\n/instance/metrics\n/instance/settings\n/instance/staff_users\n/instance/status\n/integrations/stripe/confirm-install\n/integrations/vercel/link-error\n/integrations/{kind}/callback\n/integrations/{slug}\n/legal\n/legal/new/{type}\n/login\n/login/2fa\n/login/2fa_setup\n/logs\n/logs/alerts/{alertId}/notifications/{hogFunctionId}\n/logs/alerts/{id}\n/logs/drop-rules/new\n/logs/drop-rules/{id}\n/logs/retention-rules/new\n/logs/retention-rules/{id}\n/managed_migrations\n/managed_migrations/new\n/marketing\n/mcp-analytics\n/mcp-analytics/activity\n/mcp-analytics/dashboard\n/mcp-analytics/intent-clustering\n/mcp-analytics/missing-capabilities\n/mcp-analytics/notifications\n/mcp-analytics/sessions\n/mcp-analytics/tool-quality\n/mcp-analytics/tool-quality/{toolName}\n/mcp-registry\n/mcp-servers\n/mcp-servers/agent/{id}\n/mcp-servers/member/{id}\n/mcp-servers/server/{id}\n/mcp-servers/{tab}\n/metrics\n/models\n/models/{id}\n/move-to-cloud\n/my-tickets\n/notebooks\n/notebooks/widgets/{widgetId}\n/notebooks/{shortId}\n/oauth/authorize\n/onboarding\n/organization-deactivated\n/organization-pending-deletion\n/organization/billing\n/organization/billing/overview\n/organization/billing/real-time-usage\n/organization/confirm-creation\n/organization/create-project\n/person/{id}\n/persons\n/persons/{uuid}\n/pipeline/batch-exports/new/{service}\n/pipeline/batch-exports/{id}\n/pipeline/new/\n/pipeline/plugins/{id}\n/platform-alerts\n/platform-alerts/{id}\n/preflight\n/product_tours\n/product_tours/{id}\n/project-pending-deletion\n/prompt-management/prompts\n/prompt-management/prompts/{name}\n/pulse\n/replay-vision\n/replay-vision/new/template\n/replay-vision/observations/{observationId}\n/replay-vision/{id}/budget\n/replay-vision/{id}/configure\n/replay-vision/{id}/details\n/replay-vision/{id}/overview\n/replay-vision/{id}/template\n/replay-vision/{id}/triggers\n/replay/file-playback\n/replay/home\n/replay/kiosk\n/replay/playlists/{id}\n/replay/settings\n/replay/{id}\n/reset\n/reset/{userUuid}/{token}\n/reset_2fa/{userUuid}/{token}\n/resource-transfer/{resourceKind}/{resourceId}\n/sessions/{id}\n/settings/environment-approvals\n/settings/organization-authentication/{feature}/{configId}\n/settings/project\n/settings/user-feature-previews\n/shared/{token}\n/shared_dashboard/{shareToken}\n/signup\n/signup/{id}\n/site/{url}\n/skills\n/skills/community\n/skills/{categoryTab}\n/skills/{name}\n/slack-task-context\n/spaces\n/spaces/new\n/spaces/{id}\n/spaces/{id}/canvases\n/spaces/{id}/new\n/spaces/{id}/settings\n/sql\n/stamphog\n/stamphog/digests\n/stamphog/install/callback\n/stamphog/runs\n/startups\n/streamlit-apps\n/streamlit-apps/new\n/streamlit-apps/{id}\n/streamlit-apps/{id}/edit\n/subscriptions\n/subscriptions/new\n/subscriptions/{id}\n/subscriptions/{id}/edit\n/support\n/support/settings\n/support/tickets\n/support/tickets/{ticketId}\n/surveys\n/surveys/form/new\n/surveys/guided/new\n/surveys/{id}\n/tasks\n/tasks/new\n/tasks/{taskId}\n/terminal\n/themes/custom-css\n/toolbar\n/tools\n/tracing\n/tracing/retention-rules/new\n/tracing/retention-rules/{id}\n/unsubscribe\n/verify_email\n/views\n/views/new\n/visual_review\n/visual_review/repos/{repoId}/flakiness\n/visual_review/repos/{repoId}/runs\n/visual_review/repos/{repoId}/snapshots\n/visual_review/repos/{repoId}/{runType}/snapshots/{identifier}\n/visual_review/runs/{runId}\n/visual_review/settings\n/web\n/web-scripts\n/web-scripts/new\n/web/agents\n/web/bots\n/web/content-autopilot\n/web/health\n/web/live\n/web/marketing\n/web/page-performance\n/web/page-reports\n/web/recap\n/web/session-attribution-explorer\n/web/web-vitals\n/wizard/runs\n/workflows\n/workflows/library/messages/{id}\n/workflows/library/templates/new\n/workflows/library/templates/{id}\n/workflows/new/workflow\n/workflows/{id}/{tab}",
"type": "string"
}
},