Skip to content

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

fix(eng-analytics): align detail page breadcrumbs (#104802)

Raúl Negrón-Oteroe654dda9e80d
diff --git a/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsAuthorScene.tsx b/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsAuthorScene.tsx
index fecdd96ac796..57d7bbd3b0a0 100644
--- a/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsAuthorScene.tsx
+++ b/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsAuthorScene.tsx
@@ -21,6 +21,7 @@ import { DELIVERY_DATE_OPTIONS, RepoScopeChip, ScopeBar, ScopeDateFilter } from
import { ScopePanel } from '../components/ScopePanel'
import { Section } from '../components/Section'
import { ShareRow } from '../components/ShareRow'
+import { withCurrentScope } from '../lib/scope'
import { AuthorLogicProps, authorLogic } from './authorLogic'
import { deliveryComparisonLogic } from './deliveryComparisonLogic'
import { DeliverySections } from './DeliverySections'
@@ -57,7 +58,8 @@ export function EngineeringAnalyticsAuthorScene(): JSX.Element {
} = useValues(timelinesLogic)
const { loadTimelines, setDayViewAlignment } = useActions(timelinesLogic)
- const hubUrl = combineUrl(urls.engineeringAnalytics(), sourceId ? { source: sourceId } : {}).url
+ const hubUrl = withCurrentScope(urls.engineeringAnalytics(), sourceId)
+ const pullRequestsUrl = withCurrentScope(urls.engineeringAnalyticsPullRequestList(), sourceId)
const avatarUrl = timelines?.items[0]?.author.avatar_url
const workflowCostsTotal = workflowCosts.reduce((sum, c) => sum + (c.estimated_cost_usd ?? 0), 0)
// Ranked, biggest spend first; the bar length is each workflow's share of the window's total.
@@ -77,7 +79,7 @@ export function EngineeringAnalyticsAuthorScene(): JSX.Element {
to={hubUrl}
/>
}
- lensFilter={{ label: `author: ${handle}`, to: hubUrl }}
+ lensFilter={{ label: `author: ${handle}`, to: pullRequestsUrl }}
showDate={false}
/>
<EntityHeader
diff --git a/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsScene.tsx b/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsScene.tsx
index a9c2e97fff83..61842caa0f1a 100644
--- a/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsScene.tsx
+++ b/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsScene.tsx
@@ -63,7 +63,7 @@ export function EngineeringAnalyticsScene(): JSX.Element {
const { searchParams: linkParams } = useValues(router)
const { activeView } = useValues(engineeringAnalyticsSceneLogic)
- // The general areas of the product. Drill-down pages (workflow, run, PR) live below the Overview.
+ // The general areas of the product. A drill-down page sits below the tab it opens from.
const tabs: LemonTab<EngineeringAnalyticsView>[] = [
{
key: 'hub',
diff --git a/products/engineering_analytics/frontend/scenes/PullRequestDetailScene.tsx b/products/engineering_analytics/frontend/scenes/PullRequestDetailScene.tsx
index 140b747fb5a8..6499771ff8e6 100644
--- a/products/engineering_analytics/frontend/scenes/PullRequestDetailScene.tsx
+++ b/products/engineering_analytics/frontend/scenes/PullRequestDetailScene.tsx
@@ -476,7 +476,7 @@ export function PullRequestDetailScene(): JSX.Element {
}
lensFilter={{
label: `pr: #${pullRequest?.number ?? ''}`,
- to: withCurrentScope(urls.engineeringAnalytics(), sourceId),
+ to: withCurrentScope(urls.engineeringAnalyticsPullRequestList(), sourceId),
}}
showDate={false}
/>
diff --git a/products/engineering_analytics/frontend/scenes/authorLogic.test.ts b/products/engineering_analytics/frontend/scenes/authorLogic.test.ts
new file mode 100644
index 000000000000..348d7b09dddf
--- /dev/null
+++ b/products/engineering_analytics/frontend/scenes/authorLogic.test.ts
@@ -0,0 +1,51 @@
+import { router } from 'kea-router'
+
+import { ApiConfig } from 'lib/api'
+import { urls } from 'scenes/urls'
+
+import { initKeaTests } from '~/test/init'
+
+import { engineeringAnalyticsAuthorWorkflowCosts } from '../generated/api'
+import { authorLogic } from './authorLogic'
+
+jest.mock('../generated/api', () => ({
+ engineeringAnalyticsAuthorWorkflowCosts: jest.fn(),
+}))
+
+const mockWorkflowCosts = engineeringAnalyticsAuthorWorkflowCosts as jest.MockedFunction<
+ typeof engineeringAnalyticsAuthorWorkflowCosts
+>
+
+describe('authorLogic', () => {
+ let logic: ReturnType<typeof authorLogic.build>
+
+ beforeEach(() => {
+ initKeaTests()
+ ApiConfig.setCurrentProjectId(1)
+ mockWorkflowCosts.mockResolvedValue([])
+ })
+
+ afterEach(() => logic?.unmount())
+
+ it('keeps the scope on the breadcrumbs back to the pull requests list', () => {
+ router.actions.push(urls.engineeringAnalyticsAuthor('jane-dev'), {
+ source: 'source-2',
+ repo: 'PostHog/posthog-js',
+ date_from: '-30d',
+ })
+ logic = authorLogic({ handle: 'jane-dev', sourceId: 'source-2' })
+ logic.mount()
+
+ const [hub, pullRequests] = logic.values.breadcrumbs.map(({ path }) => new URL(path!, 'https://example.com'))
+ expect(pullRequests.pathname).toBe(
+ new URL(urls.engineeringAnalyticsPullRequestList(), 'https://example.com').pathname
+ )
+ for (const destination of [hub, pullRequests]) {
+ expect(Object.fromEntries(destination.searchParams)).toEqual({
+ date_from: '-30d',
+ source: 'source-2',
+ repo: 'PostHog/posthog-js',
+ })
+ }
+ })
+})
diff --git a/products/engineering_analytics/frontend/scenes/authorLogic.ts b/products/engineering_analytics/frontend/scenes/authorLogic.ts
index 1560d79ff4c6..5acd438c2d85 100644
--- a/products/engineering_analytics/frontend/scenes/authorLogic.ts
+++ b/products/engineering_analytics/frontend/scenes/authorLogic.ts
@@ -1,5 +1,6 @@
import { MakeLogicType, afterMount, connect, kea, key, listeners, path, props, reducers, selectors } from 'kea'
import { loaders } from 'kea-loaders'
+import { router } from 'kea-router'
import { ApiConfig } from 'lib/api'
import { urls } from 'scenes/urls'
@@ -9,6 +10,7 @@ import { Breadcrumb } from '~/types'
import { engineeringAnalyticsAuthorWorkflowCosts } from '../generated/api'
import type { WorkflowCostApi } from '../generated/api.schemas'
import { DeliveryScope } from '../lib/deliveryScope'
+import { withScope } from '../lib/scope'
import { engineeringAnalyticsFiltersLogic } from './engineeringAnalyticsFiltersLogic'
export interface AuthorLogicProps {
@@ -47,7 +49,7 @@ export interface authorLogicMeta {
sourceId: (arg: string | null) => string | null
handle: (arg: string) => string
deliveryScope: (handle: string) => DeliveryScope
- breadcrumbs: (handle: string) => Breadcrumb[]
+ breadcrumbs: (handle: string, sourceId: string | null, searchParams: Record<string, any>) => Breadcrumb[]
}
}
@@ -98,18 +100,22 @@ export const authorLogic = kea<authorLogicType>([
// Memoized, so the delivery logics keyed by this scope see one stable object per author.
deliveryScope: [(s) => [s.handle], (handle: string): DeliveryScope => ({ kind: 'author', author: handle })],
breadcrumbs: [
- (_, p) => [p.handle],
- (handle: string): Breadcrumb[] => [
+ (s) => [s.handle, s.sourceId, router.selectors.searchParams],
+ (
+ handle: string,
+ sourceId: string | null,
+ searchParams: Record<string, string | undefined>
+ ): Breadcrumb[] => [
{
key: 'EngineeringAnalytics',
name: 'Engineering analytics',
- path: urls.engineeringAnalytics(),
+ path: withScope(urls.engineeringAnalytics(), searchParams, sourceId),
iconType: 'health',
},
{
key: 'EngineeringAnalyticsPullRequests',
name: 'Pull requests',
- path: urls.engineeringAnalyticsPullRequestList(),
+ path: withScope(urls.engineeringAnalyticsPullRequestList(), searchParams, sourceId),
iconType: 'health',
},
{ key: ['EngineeringAnalyticsAuthor', handle], name: handle, iconType: 'health' },
diff --git a/products/engineering_analytics/frontend/scenes/pullRequestDetailLogic.ts b/products/engineering_analytics/frontend/scenes/pullRequestDetailLogic.ts
index 1e47d5de01f0..27c1caad959e 100644
--- a/products/engineering_analytics/frontend/scenes/pullRequestDetailLogic.ts
+++ b/products/engineering_analytics/frontend/scenes/pullRequestDetailLogic.ts
@@ -1,5 +1,6 @@
import { MakeLogicType, actions, afterMount, kea, key, listeners, path, props, reducers, selectors } from 'kea'
import { loaders } from 'kea-loaders'
+import { router } from 'kea-router'
import { ApiConfig } from 'lib/api'
import { urls } from 'scenes/urls'
@@ -26,6 +27,7 @@ import type {
import { failedShardsLabel, groupJobs } from '../lib/jobGroups'
import { jobCacheKey } from '../lib/jobs'
import { WorkflowRun, isDecisiveFailure, isPassingConclusion } from '../lib/lifecycle'
+import { withScope } from '../lib/scope'
const projectId = (): string => String(ApiConfig.getCurrentProjectId())
@@ -350,7 +352,13 @@ export interface pullRequestDetailLogicMeta {
pushes: (authoredRuns: WorkflowRunDetailApi[]) => number
rerunCycles: (authoredRuns: WorkflowRunDetailApi[]) => number
timeline: (timelines: PullRequestTimelinesApi | null) => PRTimelineApi | null
- breadcrumbs: (repoOwner: string, repoName: string, number: number) => Breadcrumb[]
+ breadcrumbs: (
+ repoOwner: string,
+ repoName: string,
+ number: number,
+ sourceId: string | null,
+ searchParams: Record<string, any>
+ ) => Breadcrumb[]
}
}
@@ -667,18 +675,24 @@ export const pullRequestDetailLogic = kea<pullRequestDetailLogicType>([
timelines?.items.find((item) => item.segments.length > 0) ?? null,
],
breadcrumbs: [
- (_, p) => [p.repoOwner, p.repoName, p.number],
- (repoOwner: string, repoName: string, number: number): Breadcrumb[] => [
+ (s, p) => [p.repoOwner, p.repoName, p.number, s.sourceId, router.selectors.searchParams],
+ (
+ repoOwner: string,
+ repoName: string,
+ number: number,
+ sourceId: string | null,
+ searchParams: Record<string, string | undefined>
+ ): Breadcrumb[] => [
{
key: 'EngineeringAnalytics',
name: 'Engineering analytics',
- path: urls.engineeringAnalytics(),
+ path: withScope(urls.engineeringAnalytics(), searchParams, sourceId),
iconType: 'health',
},
{
key: 'EngineeringAnalyticsPullRequests',
name: 'Pull requests',
- path: urls.engineeringAnalyticsPullRequestList(),
+ path: withScope(urls.engineeringAnalyticsPullRequestList(), searchParams, sourceId),
iconType: 'health',
},
{
diff --git a/products/engineering_analytics/frontend/scenes/workflowRunDetailLogic.test.ts b/products/engineering_analytics/frontend/scenes/workflowRunDetailLogic.test.ts
new file mode 100644
index 000000000000..9ba9317e2c75
--- /dev/null
+++ b/products/engineering_analytics/frontend/scenes/workflowRunDetailLogic.test.ts
@@ -0,0 +1,100 @@
+import { router } from 'kea-router'
+import { expectLogic } from 'kea-test-utils'
+
+import { ApiConfig } from 'lib/api'
+import { urls } from 'scenes/urls'
+
+import { initKeaTests } from '~/test/init'
+
+import { engineeringAnalyticsWorkflowJobs, engineeringAnalyticsWorkflowRun } from '../generated/api'
+import type { WorkflowRunDetailApi } from '../generated/api.schemas'
+import { workflowRunDetailLogic } from './workflowRunDetailLogic'
+
+jest.mock('../generated/api', () => ({
+ engineeringAnalyticsRunFailureLogs: jest.fn(),
+ engineeringAnalyticsWorkflowJobs: jest.fn(),
+ engineeringAnalyticsWorkflowRun: jest.fn(),
+}))
+
+const mockRun = engineeringAnalyticsWorkflowRun as jest.MockedFunction<typeof engineeringAnalyticsWorkflowRun>
+const mockJobs = engineeringAnalyticsWorkflowJobs as jest.MockedFunction<typeof engineeringAnalyticsWorkflowJobs>
+
+const RUN: WorkflowRunDetailApi = {
+ repo: { provider: 'github', owner: 'PostHog', name: 'posthog' },
+ id: 42,
+ workflow_name: 'CI',
+ head_sha: 'abc123',
+ head_branch: 'main',
+ status: 'completed',
+ conclusion: 'success',
+ run_started_at: '2026-06-01T00:00:00Z',
+ updated_at: '2026-06-01T00:05:00Z',
+ duration_seconds: 300,
+ run_attempt: 1,
+ pr_number: 10,
+ commit_pr_number: null,
+ is_merge_queue: false,
+}
+
+describe('workflowRunDetailLogic', () => {
+ let logic: ReturnType<typeof workflowRunDetailLogic.build>
+
+ beforeEach(() => {
+ initKeaTests()
+ ApiConfig.setCurrentProjectId(1)
+ jest.clearAllMocks()
+ mockRun.mockResolvedValue(RUN)
+ mockJobs.mockResolvedValue([])
+ })
+
+ afterEach(() => logic?.unmount())
+
+ it('links the loaded workflow breadcrumb back with the current scope', async () => {
+ router.actions.push(urls.engineeringAnalyticsWorkflowRun('PostHog', 'posthog', 42), {
+ source: 'source-1',
+ repo: 'PostHog/posthog',
+ date_from: '2026-06-01',
+ date_to: '2026-06-30',
+ run_scope: 'merge_queue',
+ })
+ logic = workflowRunDetailLogic({
+ repoOwner: 'PostHog',
+ repoName: 'posthog',
+ runId: 42,
+ sourceId: 'source-1',
+ })
+ logic.mount()
+
+ await expectLogic(logic).toDispatchActionsInAnyOrder(['loadRunSuccess', 'loadJobsSuccess'])
+
+ expect(logic.values.breadcrumbs.map(({ name }) => name)).toEqual([
+ 'Engineering analytics',
+ 'Workflows',
+ 'PostHog/posthog · CI',
+ 'run #42',
+ ])
+ const workflowDestination = new URL(logic.values.breadcrumbs[2].path!, 'https://example.com')
+ expect(workflowDestination.pathname).toBe(
+ new URL(urls.engineeringAnalyticsWorkflowRuns('PostHog', 'posthog', 'CI'), 'https://example.com').pathname
+ )
+ expect(Object.fromEntries(workflowDestination.searchParams)).toEqual({
+ date_from: '2026-06-01',
+ date_to: '2026-06-30',
+ run_scope: 'merge_queue',
+ source: 'source-1',
+ repo: 'PostHog/posthog',
+ })
+
+ router.actions.replace(urls.engineeringAnalyticsWorkflowRun('PostHog', 'posthog', 42), {
+ source: 'source-1',
+ repo: 'PostHog/posthog',
+ date_from: '-30d',
+ })
+ const hubDestination = new URL(logic.values.breadcrumbs[0].path!, 'https://example.com')
+ expect(Object.fromEntries(hubDestination.searchParams)).toEqual({
+ date_from: '-30d',
+ source: 'source-1',
+ repo: 'PostHog/posthog',
+ })
+ })
+})
diff --git a/products/engineering_analytics/frontend/scenes/workflowRunDetailLogic.ts b/products/engineering_analytics/frontend/scenes/workflowRunDetailLogic.ts
index 9d58743a20bc..eb1a7644cf1a 100644
--- a/products/engineering_analytics/frontend/scenes/workflowRunDetailLogic.ts
+++ b/products/engineering_analytics/frontend/scenes/workflowRunDetailLogic.ts
@@ -1,5 +1,6 @@
import { MakeLogicType, afterMount, kea, key, listeners, path, props, reducers, selectors } from 'kea'
import { loaders } from 'kea-loaders'
+import { router } from 'kea-router'
import { ApiConfig } from 'lib/api'
import { urls } from 'scenes/urls'
@@ -14,6 +15,7 @@ import {
import type { RunFailureLogsApi, WorkflowJobApi, WorkflowRunDetailApi } from '../generated/api.schemas'
import { isDecisiveFailure } from '../lib/lifecycle'
import { RunCostSummary, summarizeRunCost } from '../lib/runHealth'
+import { withScope } from '../lib/scope'
const projectId = (): string => String(ApiConfig.getCurrentProjectId())
@@ -97,7 +99,14 @@ export interface workflowRunDetailLogicMeta {
sourceId: (arg: string | null) => string | null
runCost: (jobs: WorkflowJobApi[] | null) => RunCostSummary | null
isValidRunId: (arg: number) => boolean
- breadcrumbs: (repoOwner: string, repoName: string, runId: number) => Breadcrumb[]
+ breadcrumbs: (
+ repoOwner: string,
+ repoName: string,
+ runId: number,
+ run: WorkflowRunDetailApi | null,
+ sourceId: string | null,
+ searchParams: Record<string, any>
+ ) => Breadcrumb[]
}
}
@@ -194,26 +203,51 @@ export const workflowRunDetailLogic = kea<workflowRunDetailLogicType>([
(runId: number): boolean => Number.isFinite(runId),
],
breadcrumbs: [
- (_, p) => [p.repoOwner, p.repoName, p.runId],
- (repoOwner: string, repoName: string, runId: number): Breadcrumb[] => [
- {
- key: 'EngineeringAnalytics',
- name: 'Engineering analytics',
- path: urls.engineeringAnalytics(),
- iconType: 'health',
- },
- {
- key: 'EngineeringAnalyticsWorkflows',
- name: 'Workflows',
- path: urls.engineeringAnalyticsWorkflows(),
- iconType: 'health',
- },
- {
+ (s, p) => [p.repoOwner, p.repoName, p.runId, s.run, s.sourceId, router.selectors.searchParams],
+ (
+ repoOwner: string,
+ repoName: string,
+ runId: number,
+ run: WorkflowRunDetailApi | null,
+ sourceId: string | null,
+ searchParams: Record<string, string | undefined>
+ ): Breadcrumb[] => {
+ const breadcrumbs: Breadcrumb[] = [
+ {
+ key: 'EngineeringAnalytics',
+ name: 'Engineering analytics',
+ path: withScope(urls.engineeringAnalytics(), searchParams, sourceId),
+ iconType: 'health',
+ },
+ {
+ key: 'EngineeringAnalyticsWorkflows',
+ name: 'Workflows',
+ path: withScope(urls.engineeringAnalyticsWorkflows(), searchParams, sourceId),
+ iconType: 'health',
+ },
+ ]
+
+ if (run) {
+ const loadedRepo = `${run.repo.owner}/${run.repo.name}`
+ breadcrumbs.push({
+ key: ['EngineeringAnalyticsWorkflowRuns', `${loadedRepo}/${run.workflow_name}`],
+ name: `${loadedRepo} · ${run.workflow_name}`,
+ path: withScope(
+ urls.engineeringAnalyticsWorkflowRuns(run.repo.owner, run.repo.name, run.workflow_name),
+ searchParams,
+ sourceId
+ ),
+ iconType: 'health',
+ })
+ }
+
+ breadcrumbs.push({
key: ['EngineeringAnalyticsWorkflowRun', `${repoOwner}/${repoName}/runs/${runId}`],
- name: `${repoOwner}/${repoName} · run #${runId}`,
+ name: run ? `run #${runId}` : `${repoOwner}/${repoName} · run #${runId}`,
iconType: 'health',
- },
- ],
+ })
+ return breadcrumbs
+ },
],
}),
diff --git a/products/engineering_analytics/frontend/scenes/workflowRunsLogic.ts b/products/engineering_analytics/frontend/scenes/workflowRunsLogic.ts
index bb09b9bdcc86..37bb99e37f12 100644
--- a/products/engineering_analytics/frontend/scenes/workflowRunsLogic.ts
+++ b/products/engineering_analytics/frontend/scenes/workflowRunsLogic.ts
@@ -1,5 +1,6 @@
import { MakeLogicType, actions, afterMount, connect, kea, key, listeners, path, props, reducers, selectors } from 'kea'
import { loaders } from 'kea-loaders'
+import { router } from 'kea-router'
import { ApiConfig } from 'lib/api'
import { urls } from 'scenes/urls'
@@ -26,6 +27,7 @@ import type {
} from '../generated/api.schemas'
import { jobCacheKey } from '../lib/jobs'
import { type CostSummary, type HealthSummary, computeHealthSummary, workflowHealthSummary } from '../lib/runHealth'
+import { withScope } from '../lib/scope'
import { engineeringAnalyticsFiltersLogic } from './engineeringAnalyticsFiltersLogic'
import type { RunScopeParams } from './engineeringAnalyticsFiltersLogic'
@@ -226,7 +228,13 @@ export interface workflowRunsLogicMeta {
queueP50Seconds: (jobAggregates: WorkflowJobAggregateApi[]) => number | null
runsTruncated: (runRows: WorkflowRunRow[]) => boolean
costSummary: (runnerCosts: WorkflowRunnerCostApi[]) => CostSummary | null
- breadcrumbs: (repoOwner: string, repoName: string, workflowName: string) => Breadcrumb[]
+ breadcrumbs: (
+ repoOwner: string,
+ repoName: string,
+ workflowName: string,
+ sourceId: string | null,
+ searchParams: Record<string, any>
+ ) => Breadcrumb[]
}
}
@@ -531,18 +539,24 @@ export const workflowRunsLogic = kea<workflowRunsLogicType>([
},
],
breadcrumbs: [
- (_, p) => [p.repoOwner, p.repoName, p.workflowName],
- (repoOwner: string, repoName: string, workflowName: string): Breadcrumb[] => [
+ (s, p) => [p.repoOwner, p.repoName, p.workflowName, s.sourceId, router.selectors.searchParams],
+ (
+ repoOwner: string,
+ repoName: string,
+ workflowName: string,
+ sourceId: string | null,
+ searchParams: Record<string, string | undefined>
+ ): Breadcrumb[] => [
{
key: 'EngineeringAnalytics',
name: 'Engineering analytics',
- path: urls.engineeringAnalytics(),
+ path: withScope(urls.engineeringAnalytics(), searchParams, sourceId),
iconType: 'health',
},
{
key: 'EngineeringAnalyticsWorkflows',
name: 'Workflows',
- path: urls.engineeringAnalyticsWorkflows(),
+ path: withScope(urls.engineeringAnalyticsWorkflows(), searchParams, sourceId),
iconType: 'health',
},
{