: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(eng-analytics): put the repository in every page path (#115517)
Julian Bez76594c4f62d3
diff --git a/frontend/src/products.tsx b/frontend/src/products.tsxindex 4b910f601f07..19edbb908ebf 100644--- a/frontend/src/products.tsx+++ b/frontend/src/products.tsx@@ -190,6 +190,34 @@ export const productRoutes: Record<string, [string, string]> = {'/engineering-analytics/authors': ['EngineeringAnalytics', 'engineeringAnalyticsAuthors'],'/engineering-analytics/deploys': ['EngineeringAnalytics', 'engineeringAnalyticsDeploys'],'/engineering-analytics/teams/:ownerTeam': ['EngineeringAnalyticsTeam', 'engineeringAnalyticsTeam'],+ '/engineering-analytics/authors/:handle': ['EngineeringAnalyticsAuthor', 'engineeringAnalyticsAuthor'],+ '/engineering-analytics/repos/:repoOwner/:repoName/overview': ['EngineeringAnalytics', 'engineeringAnalytics'],+ '/engineering-analytics/repos/:repoOwner/:repoName/pull-requests': [+ 'EngineeringAnalytics',+ 'engineeringAnalyticsPullRequestList',+ ],+ '/engineering-analytics/repos/:repoOwner/:repoName/workflows': [+ 'EngineeringAnalytics',+ 'engineeringAnalyticsWorkflows',+ ],+ '/engineering-analytics/repos/:repoOwner/:repoName/tests': ['EngineeringAnalytics', 'engineeringAnalyticsTests'],+ '/engineering-analytics/repos/:repoOwner/:repoName/teams': ['EngineeringAnalytics', 'engineeringAnalyticsTeams'],+ '/engineering-analytics/repos/:repoOwner/:repoName/authors': [+ 'EngineeringAnalytics',+ 'engineeringAnalyticsAuthors',+ ],+ '/engineering-analytics/repos/:repoOwner/:repoName/deploys': [+ 'EngineeringAnalytics',+ 'engineeringAnalyticsDeploys',+ ],+ '/engineering-analytics/repos/:repoOwner/:repoName/teams/:ownerTeam': [+ 'EngineeringAnalyticsTeam',+ 'engineeringAnalyticsTeam',+ ],+ '/engineering-analytics/repos/:repoOwner/:repoName/authors/:handle': [+ 'EngineeringAnalyticsAuthor',+ 'engineeringAnalyticsAuthor',+ ],'/engineering-analytics/repos/:repoOwner/:repoName/pull-requests/:number': ['EngineeringAnalyticsPullRequest','engineeringAnalyticsPullRequest',@@ -206,7 +234,6 @@ export const productRoutes: Record<string, [string, string]> = {'EngineeringAnalyticsWorkflowRuns','engineeringAnalyticsWorkflowRuns',],- '/engineering-analytics/authors/:handle': ['EngineeringAnalyticsAuthor', 'engineeringAnalyticsAuthor'],'/error_tracking': ['ErrorTracking', 'errorTracking'],'/error_tracking/fingerprint/*': ['ErrorTrackingFingerprint', 'errorTrackingFingerprint'],'/error_tracking/alerts/new/:templateId': ['HogFunction', 'errorTrackingAlertNew'],@@ -1544,15 +1571,36 @@ export const productUrls = {}return combineUrl('/endpoints', { tab: 'usage', ...searchParams }).url},- engineeringAnalytics: (): string => '/engineering-analytics/overview',- engineeringAnalyticsPullRequestList: (): string => '/engineering-analytics/pull-requests',- engineeringAnalyticsWorkflows: (): string => '/engineering-analytics/workflows',- engineeringAnalyticsTests: (): string => '/engineering-analytics/tests',- engineeringAnalyticsTeams: (): string => '/engineering-analytics/teams',- engineeringAnalyticsAuthors: (): string => '/engineering-analytics/authors',- engineeringAnalyticsDeploys: (): string => '/engineering-analytics/deploys',- engineeringAnalyticsTeam: (ownerTeam: string): string =>- `/engineering-analytics/teams/${encodeURIComponent(ownerTeam)}`,+ engineeringAnalytics: (repo?: string | null): string =>+ repo+ ? `/engineering-analytics/repos/${repo.split('/').map(encodeURIComponent).join('/')}/overview`+ : '/engineering-analytics/overview',+ engineeringAnalyticsPullRequestList: (repo?: string | null): string =>+ repo+ ? `/engineering-analytics/repos/${repo.split('/').map(encodeURIComponent).join('/')}/pull-requests`+ : '/engineering-analytics/pull-requests',+ engineeringAnalyticsWorkflows: (repo?: string | null): string =>+ repo+ ? `/engineering-analytics/repos/${repo.split('/').map(encodeURIComponent).join('/')}/workflows`+ : '/engineering-analytics/workflows',+ engineeringAnalyticsTests: (repo?: string | null): string =>+ repo+ ? `/engineering-analytics/repos/${repo.split('/').map(encodeURIComponent).join('/')}/tests`+ : '/engineering-analytics/tests',+ engineeringAnalyticsTeams: (repo?: string | null): string =>+ repo+ ? `/engineering-analytics/repos/${repo.split('/').map(encodeURIComponent).join('/')}/teams`+ : '/engineering-analytics/teams',+ engineeringAnalyticsAuthors: (repo?: string | null): string =>+ repo+ ? `/engineering-analytics/repos/${repo.split('/').map(encodeURIComponent).join('/')}/authors`+ : '/engineering-analytics/authors',+ engineeringAnalyticsDeploys: (repo?: string | null): string =>+ repo+ ? `/engineering-analytics/repos/${repo.split('/').map(encodeURIComponent).join('/')}/deploys`+ : '/engineering-analytics/deploys',+ engineeringAnalyticsTeam: (ownerTeam: string, repo?: string | null): string =>+ `${repo ? `/engineering-analytics/repos/${repo.split('/').map(encodeURIComponent).join('/')}` : '/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 =>@@ -1566,8 +1614,8 @@ export const productUrls = {`/engineering-analytics/repos/${encodeURIComponent(repoOwner)}/${encodeURIComponent(repoName)}/actions/runs/${runId}${ciEngine ? `?ci_engine=${encodeURIComponent(ciEngine)}` : ''}`,engineeringAnalyticsWorkflowRuns: (repoOwner: string, repoName: string, workflowName: string): string =>`/engineering-analytics/repos/${encodeURIComponent(repoOwner)}/${encodeURIComponent(repoName)}/actions/workflows/${encodeURIComponent(workflowName)}`,- engineeringAnalyticsAuthor: (handle: string): string =>- `/engineering-analytics/authors/${encodeURIComponent(handle)}`,+ engineeringAnalyticsAuthor: (handle: string, repo?: string | null): string =>+ `${repo ? `/engineering-analytics/repos/${repo.split('/').map(encodeURIComponent).join('/')}` : '/engineering-analytics'}/authors/${encodeURIComponent(handle)}`,errorTracking: (params = {}): string => combineUrl('/error_tracking', params).url,errorTrackingConfiguration: (params = {}): string =>combineUrl('/error_tracking', { ...params, activeTab: 'configuration' }).url,diff --git a/products/engineering_analytics/frontend/components/AuthorFrictionTable.tsx b/products/engineering_analytics/frontend/components/AuthorFrictionTable.tsxindex 9ea71545c01a..6fb2343ce07a 100644--- a/products/engineering_analytics/frontend/components/AuthorFrictionTable.tsx+++ b/products/engineering_analytics/frontend/components/AuthorFrictionTable.tsx@@ -11,8 +11,8 @@ import { withCurrentScope } from '../lib/scope'import { CountCell } from './CountCell'import { FrictionGroupBar } from './FrictionGroupBar'-function authorUrl(handle: string, sourceId: string | null): string {- return withCurrentScope(urls.engineeringAnalyticsAuthor(handle), sourceId)+function authorUrl(handle: string, repo: string | null, sourceId: string | null): string {+ return withCurrentScope(urls.engineeringAnalyticsAuthor(handle, repo), sourceId)}const GROUPS_TOOLTIP = FRICTION_GROUP_ORDER.map(@@ -27,6 +27,7 @@ export function AuthorFrictionTable({maxScore,loading,sourceId,+ repo,emptyState,dataAttr,}: {@@ -37,6 +38,8 @@ export function AuthorFrictionTable({maxScore: numberloading: booleansourceId: string | null+ /** The 'owner/name' in scope, so an author link opens in the same repository. */+ repo: string | nullemptyState: stringdataAttr: string}): JSX.Element {@@ -72,7 +75,7 @@ export function AuthorFrictionTable({<Lettermark name={row.author} size="small" />)}<Link- to={authorUrl(row.author, sourceId)}+ to={authorUrl(row.author, repo, sourceId)}className="whitespace-nowrap text-xs font-medium"data-attr="engineering-analytics-friction-author-link">@@ -114,7 +117,7 @@ export function AuthorFrictionTable({dataSource={authors}rowKey={(row) => row.author}rowClassName="cursor-pointer"- onRow={(row) => rowNavigationProps(authorUrl(row.author, sourceId))}+ onRow={(row) => rowNavigationProps(authorUrl(row.author, repo, sourceId))}loading={loading}useURLForSorting={false}emptyState={emptyState}diff --git a/products/engineering_analytics/frontend/components/PullRequestTable.tsx b/products/engineering_analytics/frontend/components/PullRequestTable.tsxindex 11da4684eb7b..863e04375bf5 100644--- a/products/engineering_analytics/frontend/components/PullRequestTable.tsx+++ b/products/engineering_analytics/frontend/components/PullRequestTable.tsx@@ -113,7 +113,10 @@ export function PullRequestTable({<Linkto={combineUrl(- urls.engineeringAnalyticsAuthor(row.authorHandle),+ urls.engineeringAnalyticsAuthor(+ row.authorHandle,+ `${row.repoOwner}/${row.repoName}`+ ),sourceId ? { source: sourceId } : {}).url}diff --git a/products/engineering_analytics/frontend/lib/repoScope.test.ts b/products/engineering_analytics/frontend/lib/repoScope.test.tsnew file mode 100644index 000000000000..ae7d9da5ac91--- /dev/null+++ b/products/engineering_analytics/frontend/lib/repoScope.test.ts@@ -0,0 +1,65 @@+import type { GitHubSourceApi } from '../generated/api.schemas'+import { pickForwardRepo, repoFromPath, switchRepoPath } from './repoScope'++const SOURCES: GitHubSourceApi[] = [+ { id: 'src-a', repo: 'PostHog/posthog', prefix: 'a', synced: true },+ { id: 'src-b', repo: 'PostHog/posthog-js', prefix: 'b', synced: true },+ { id: 'src-c', repo: '', prefix: 'legacy', synced: true },+]++describe('repoScope', () => {+ it.each([+ ['a tab stays on that tab', '/engineering-analytics/repos/PostHog/posthog/workflows', '/workflows'],+ [+ 'a team page stays on that team',+ '/engineering-analytics/repos/PostHog/posthog/teams/team-cdp',+ '/teams/team-cdp',+ ],+ [+ 'a pull request lands on the pull request list',+ '/engineering-analytics/repos/PostHog/posthog/pull-requests/42',+ '/pull-requests',+ ],+ [+ 'a CI explorer lands on the pull request list',+ '/engineering-analytics/repos/PostHog/posthog/pull-requests/42/ci-explorer',+ '/pull-requests',+ ],+ [+ 'a workflow run lands on the workflows tab',+ '/engineering-analytics/repos/PostHog/posthog/actions/runs/7',+ '/workflows',+ ],+ ['a repo-less tab keeps its tab', '/engineering-analytics/tests', '/tests'],+ ])('switching repository from %s', (_label, pathname, rest) => {+ expect(switchRepoPath(pathname, 'PostHog/posthog-js')).toBe(+ `/engineering-analytics/repos/PostHog/posthog-js${rest}`+ )+ })++ it.each([+ [+ 'the requested repository, matched case-insensitively',+ { repo: 'posthog/POSTHOG-JS' },+ 'PostHog/posthog',+ 'PostHog/posthog-js',+ ],+ ['the last repository used over the default', {}, 'PostHog/posthog-js', 'PostHog/posthog-js'],+ ['the default when the last one is gone', {}, 'PostHog/gone', 'PostHog/posthog'],+ ['the default when the requested one is unknown', { repo: 'PostHog/unknown' }, null, 'PostHog/posthog'],+ ['nothing for a legacy source that names no repository', { sourceId: 'src-c' }, 'PostHog/posthog-js', null],+ ])('forwarding picks %s', (_label, requested, lastRepo, expected) => {+ expect(pickForwardRepo(SOURCES, requested, lastRepo)).toBe(expected)+ })++ it.each([+ ['an encoded segment', '/engineering-analytics/repos/PostHog/posthog%2Ejs/overview', 'PostHog/posthog.js'],+ ['a malformed escape, kept raw', '/engineering-analytics/repos/%zz/posthog/overview', '%zz/posthog'],+ ])('reads the repository from %s', (_label, pathname, expected) => {+ expect(repoFromPath(pathname)).toBe(expected)+ })++ it('has nothing to forward to when no source names a repository', () => {+ expect(pickForwardRepo([SOURCES[2]], {}, null)).toBeNull()+ })+})diff --git a/products/engineering_analytics/frontend/lib/repoScope.ts b/products/engineering_analytics/frontend/lib/repoScope.tsnew file mode 100644index 000000000000..e0ee6bed7180--- /dev/null+++ b/products/engineering_analytics/frontend/lib/repoScope.ts@@ -0,0 +1,76 @@+// Every page reads one repository, and the URL names it: /engineering-analytics/repos/:owner/:name/...+// These rules decide which repository a repo-less URL forwards to, and where switching repository lands.++import type { GitHubSourceApi } from '../generated/api.schemas'+import { repoPrefix } from './repoUrls'++const PRODUCT_ROOT = '/engineering-analytics'+const REPO_PATH = /^\/engineering-analytics\/repos\/([^/]+)\/([^/]+)(\/.*)?$/+// Pages about one entity of a repository. Another repository has no such entity, so switching repository+// from one of them lands on the tab that lists them.+const ENTITY_TAB: [RegExp, string][] = [+ [/^\/pull-requests\/[^/]+/, '/pull-requests'],+ [/^\/actions\//, '/workflows'],+]++// A hand-typed URL can carry a malformed escape such as %zz, and decodeURIComponent throws on it.+function decodeSegment(segment: string): string {+ try {+ return decodeURIComponent(segment)+ } catch {+ return segment+ }+}++/** The 'owner/name' a repo path names, or null for a repo-less path. */+export function repoFromPath(pathname: string): string | null {+ const match = REPO_PATH.exec(pathname)+ return match ? `${decodeSegment(match[1])}/${decodeSegment(match[2])}` : null+}++/** The repository a repo-less URL forwards to: the one it asks for, else the last one used, else the+ * backend's default (the first synced repository). Null when no connected repository has a name, or when+ * the URL asks for a legacy source that names none: that page stays repo-less and reads the source. */+export function pickForwardRepo(+ sources: GitHubSourceApi[],+ requested: { repo?: string | null; sourceId?: string | null },+ lastRepo: string | null+): string | null {+ const named = sources.filter((source) => source.repo)+ const known = (repo: string | null | undefined): string | null =>+ named.find((source) => source.repo.toLowerCase() === repo?.toLowerCase())?.repo ?? null+ const requestedRepo = known(requested.repo)+ if (requestedRepo) {+ return requestedRepo+ }+ const ofSource = requested.sourceId ? sources.filter((source) => source.id === requested.sourceId) : []+ if (ofSource.length > 0 && ofSource.every((source) => !source.repo)) {+ return null+ }+ const namedOfSource = ofSource.filter((source) => source.repo)+ return (+ (namedOfSource.find((source) => source.synced) ?? namedOfSource[0])?.repo ??+ known(lastRepo) ??+ (named.find((source) => source.synced) ?? named[0])?.repo ??+ null+ )+}++/** The repo path a repo-less product path forwards to: /engineering-analytics/<rest> keeps its <rest>. */+export function repoPathFor(pathname: string, repo: string): string {+ const [repoOwner, repoName] = repo.split('/')+ const rest = pathname.startsWith(PRODUCT_ROOT) ? pathname.slice(PRODUCT_ROOT.length) : ''+ return `${repoPrefix(repoOwner, repoName)}${rest && rest !== '/' ? rest : '/overview'}`+}++/** Where switching to `repo` lands: the same page in that repository, or the list tab for an entity page. */+export function switchRepoPath(pathname: string, repo: string): string {+ const match = REPO_PATH.exec(pathname)+ if (!match) {+ return repoPathFor(pathname, repo)+ }+ const rest = match[3] ?? '/overview'+ const entityTab = ENTITY_TAB.find(([pattern]) => pattern.test(rest))?.[1]+ const [repoOwner, repoName] = repo.split('/')+ return `${repoPrefix(repoOwner, repoName)}${entityTab ?? rest}`+}diff --git a/products/engineering_analytics/frontend/lib/repoUrls.ts b/products/engineering_analytics/frontend/lib/repoUrls.tsnew file mode 100644index 000000000000..aa6006efa946--- /dev/null+++ b/products/engineering_analytics/frontend/lib/repoUrls.ts@@ -0,0 +1,4 @@+/** The path prefix of one repository's pages. */+export function repoPrefix(repoOwner: string, repoName: string): string {+ return `/engineering-analytics/repos/${encodeURIComponent(repoOwner)}/${encodeURIComponent(repoName)}`+}diff --git a/products/engineering_analytics/frontend/lib/scope.ts b/products/engineering_analytics/frontend/lib/scope.tsindex c8804ab8d829..5eb7b44be058 100644--- a/products/engineering_analytics/frontend/lib/scope.ts+++ b/products/engineering_analytics/frontend/lib/scope.ts@@ -1,7 +1,7 @@import { combineUrl, router } from 'kea-router'-/** Carry the shared window, run scope, source, and repo onto an internal nav URL, so drilling in or stepping- * back never silently resets them. */+/** Carry the shared window, run scope, and source onto an internal nav URL, so drilling in or stepping back+ * never silently resets them. The repository rides in the path, never as a param. */export function withScope(url: string,searchParams: Record<string, string | undefined>,@@ -12,12 +12,11 @@ export function withScope(...(searchParams.date_to ? { date_to: searchParams.date_to } : {}),...(searchParams.run_scope ? { run_scope: searchParams.run_scope } : {}),...(sourceId ? { source: sourceId } : {}),- ...(searchParams.repo ? { repo: searchParams.repo } : {}),}).url}/** Like withScope, but reads the live URL for module-level link builders that don't have searchParams in- * scope, so a source-only link still carries the current window / run scope / repo. */+ * scope, so a source-only link still carries the current window and run scope. */export function withCurrentScope(url: string, sourceId: string | null | undefined): string {return withScope(url, router.values.searchParams, sourceId)}diff --git a/products/engineering_analytics/frontend/scenes/CIExplorerScene.tsx b/products/engineering_analytics/frontend/scenes/CIExplorerScene.tsxindex 4a33b5d7cc55..ea121a3b4562 100644--- a/products/engineering_analytics/frontend/scenes/CIExplorerScene.tsx+++ b/products/engineering_analytics/frontend/scenes/CIExplorerScene.tsx@@ -1,4 +1,4 @@-import { useActions, useValues } from 'kea'+import { useActions, useMountedLogic, useValues } from 'kea'import { IconPullRequest, IconRefresh } from '@posthog/icons'import { LemonButton, LemonSkeleton, LemonTabs, Link, Tooltip } from '@posthog/lemon-ui'@@ -16,6 +16,7 @@ import { CIExplorerSummaryCounts } from '../components/ciExplorer/CIExplorerSummimport { EntityHeader } from '../components/EntityHeader'import { PullRequestStateTag } from '../components/PullRequestStateTag'import { CIExplorerLogicProps, CIExplorerView, ciExplorerLogic } from './ciExplorerLogic'+import { repoScopeLogic } from './repoScopeLogic'export const scene: SceneExport<CIExplorerLogicProps> = {component: CIExplorerScene,@@ -29,6 +30,8 @@ export const scene: SceneExport<CIExplorerLogicProps> = {}export function CIExplorerScene(): JSX.Element {+ // Remembers this repository, so the product root reopens it.+ useMountedLogic(repoScopeLogic)const {lifecycle,prRuns,diff --git a/products/engineering_analytics/frontend/scenes/DeliverySections.tsx b/products/engineering_analytics/frontend/scenes/DeliverySections.tsxindex 0eb4040e987d..698e1b0af390 100644--- a/products/engineering_analytics/frontend/scenes/DeliverySections.tsx+++ b/products/engineering_analytics/frontend/scenes/DeliverySections.tsx@@ -20,6 +20,7 @@ export function DeliverySections({scope,scopeLabel,sourceId,+ repo,comparison = null,comparisonFailed = false,}: {@@ -27,11 +28,13 @@ export function DeliverySections({scope: DeliveryScopescopeLabel: stringsourceId: string | null+ /** The 'owner/name' in the page's path. */+ repo: string | null/** An author's comparison with their own team, which adds the team's row to the ready-to-merge card. */comparison?: DeliveryComparisonApi | nullcomparisonFailed?: boolean}): JSX.Element {- const summaryLogic = deliverySummaryLogic({ scope, sourceId })+ const summaryLogic = deliverySummaryLogic({ scope, sourceId, repo })const { summary, summaryLoading, summaryFailed } = useValues(summaryLogic)const { loadSummary } = useActions(summaryLogic)diff --git a/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsAuthorScene.stories.tsx b/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsAuthorScene.stories.tsxindex 6c4ed5779de0..d53eabb48a9b 100644--- a/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsAuthorScene.stories.tsx+++ b/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsAuthorScene.stories.tsx@@ -309,7 +309,7 @@ const meta: Meta = {viewMode: 'story',mockDate: '2026-07-02',featureFlags: [FEATURE_FLAGS.ENGINEERING_ANALYTICS],- pageUrl: urls.engineeringAnalyticsAuthor('jane-dev'),+ pageUrl: urls.engineeringAnalyticsAuthor('jane-dev', 'PostHog/posthog'),testOptions: {waitForSelector: '[data-attr="engineering-analytics-day-view"]',},diff --git a/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsAuthorScene.tsx b/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsAuthorScene.tsxindex 62e655e15767..8e7313cbd886 100644--- a/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsAuthorScene.tsx+++ b/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsAuthorScene.tsx@@ -1,4 +1,4 @@-import { useActions, useValues } from 'kea'+import { useActions, useMountedLogic, useValues } from 'kea'import { combineUrl } from 'kea-router'import { LemonSkeleton, Link } from '@posthog/lemon-ui'@@ -28,20 +28,25 @@ import { deliveryComparisonLogic } from './deliveryComparisonLogic'import { DeliverySections } from './DeliverySections'import { deliverySummaryLogic } from './deliverySummaryLogic'import { pullRequestTimelinesLogic } from './pullRequestTimelinesLogic'+import { repoScopeLogic } from './repoScopeLogic'export const scene: SceneExport<AuthorLogicProps> = {component: EngineeringAnalyticsAuthorScene,logic: authorLogic,- paramsToProps: ({ params: { handle }, searchParams: { source } }) => ({+ paramsToProps: ({ params: { handle, repoOwner, repoName }, searchParams: { source } }) => ({handle: decodeURIComponent(handle),sourceId: source ?? null,+ repo: repoOwner && repoName ? `${repoOwner}/${repoName}` : null,}),}export function EngineeringAnalyticsAuthorScene(): JSX.Element {+ // An old repo-less author link forwards to the repository it belongs to.+ useMountedLogic(repoScopeLogic)const {handle,sourceId,+ repo,deliveryScope,workflowCosts,workflowCostsLoading,@@ -51,11 +56,11 @@ export function EngineeringAnalyticsAuthorScene(): JSX.Element {frictionDetailFailed,} = useValues(authorLogic)const { loadWorkflowCosts, loadFrictionDetail } = useActions(authorLogic)- const { summary, summaryLoading } = useValues(deliverySummaryLogic({ scope: deliveryScope, sourceId }))+ const { summary, summaryLoading } = useValues(deliverySummaryLogic({ scope: deliveryScope, sourceId, repo }))const { comparison, comparisonLoading, comparisonFailed } = useValues(- deliveryComparisonLogic({ author: handle, sourceId })+ deliveryComparisonLogic({ author: handle, sourceId, repo: repo ?? undefined }))- const timelinesLogic = pullRequestTimelinesLogic({ scope: deliveryScope, sourceId })+ const timelinesLogic = pullRequestTimelinesLogic({ scope: deliveryScope, sourceId, repo })const {timelines,timelinesLoading,@@ -68,8 +73,8 @@ export function EngineeringAnalyticsAuthorScene(): JSX.Element {} = useValues(timelinesLogic)const { loadTimelines, setDayViewAlignment } = useActions(timelinesLogic)- const hubUrl = withCurrentScope(urls.engineeringAnalytics(), sourceId)- const pullRequestsUrl = withCurrentScope(urls.engineeringAnalyticsPullRequestList(), sourceId)+ const hubUrl = withCurrentScope(urls.engineeringAnalytics(repo), sourceId)+ const pullRequestsUrl = withCurrentScope(urls.engineeringAnalyticsPullRequestList(repo), sourceId)const avatarUrl = timelines?.items[0]?.author.avatar_urlconst 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.@@ -130,6 +135,7 @@ export function EngineeringAnalyticsAuthorScene(): JSX.Element {scope={deliveryScope}scopeLabel="This author"sourceId={sourceId}+ repo={repo}// Both reads keep their previous window while they reload, so the team rows wait for both.comparison={comparisonLoading || summaryLoading ? null : comparison}comparisonFailed={comparisonFailed}diff --git a/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsAuthors.stories.tsx b/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsAuthors.stories.tsxindex 2880a125153b..81de48d8c978 100644--- a/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsAuthors.stories.tsx+++ b/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsAuthors.stories.tsx@@ -109,13 +109,13 @@ type Story = StoryObj<typeof meta>export const AuthorFriction: Story = {render: () => <App />,- parameters: { pageUrl: urls.engineeringAnalyticsAuthors() },+ parameters: { pageUrl: urls.engineeringAnalyticsAuthors('PostHog/posthog') },}export const AuthorFrictionNotReady: Story = {render: () => <App />,parameters: {- pageUrl: urls.engineeringAnalyticsAuthors(),+ pageUrl: urls.engineeringAnalyticsAuthors('PostHog/posthog'),testOptions: { waitForSelector: '[data-attr="engineering-analytics-friction-not-ready"]' },},decorators: [diff --git a/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsAuthors.tsx b/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsAuthors.tsxindex aadb07d8f08a..549902ad00a2 100644--- a/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsAuthors.tsx+++ b/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsAuthors.tsx@@ -21,6 +21,7 @@ export function EngineeringAnalyticsAuthors(): JSX.Element {githubTeam,teamOptions,sourceId,+ scopeRepo,} = useValues(authorFrictionLogic)const { loadFriction, setGithubTeam } = useActions(authorFrictionLogic)@@ -76,6 +77,7 @@ export function EngineeringAnalyticsAuthors(): JSX.Element {maxScore={maxScore}loading={frictionLoading}sourceId={sourceId}+ repo={scopeRepo}emptyState={githubTeam? 'No one on this team has 3 merged pull requests in the window yet.'diff --git a/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsDeploys.stories.tsx b/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsDeploys.stories.tsxindex 6062f29d24dc..04110ca7e845 100644--- a/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsDeploys.stories.tsx+++ b/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsDeploys.stories.tsx@@ -184,7 +184,7 @@ type Story = StoryObj<typeof meta>export const Deploys: Story = {render: () => <App />,- parameters: { pageUrl: urls.engineeringAnalyticsDeploys() },+ parameters: { pageUrl: urls.engineeringAnalyticsDeploys('PostHog/posthog') },}// A docked side panel leaves the scene about 520px wide, where the lead-time controls must wrap.@@ -210,7 +210,7 @@ export const DeploysWithLimitedDeploymentCoverage: Story = {export const DeploysWithoutAttributedPullRequests: Story = {render: () => <App />,parameters: {- pageUrl: urls.engineeringAnalyticsDeploys(),+ pageUrl: urls.engineeringAnalyticsDeploys('PostHog/posthog'),testOptions: {waitForSelector: '[data-attr="engineering-analytics-dora-unattributed-empty"]',},@@ -241,7 +241,7 @@ export const DeploysWithoutAttributedPullRequests: Story = {export const DeploysWithoutDeployData: Story = {render: () => <App />,parameters: {- pageUrl: urls.engineeringAnalyticsDeploys(),+ pageUrl: urls.engineeringAnalyticsDeploys('PostHog/posthog'),testOptions: {waitForSelector: '[data-attr="engineering-analytics-dora-no-deploy-data"]',},diff --git a/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsScene.tsx b/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsScene.tsxindex 1191e8c08da7..31c2e7b3804c 100644--- a/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsScene.tsx+++ b/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsScene.tsx@@ -61,8 +61,11 @@ function DeploysRefreshButton(): JSX.Element {}export function EngineeringAnalyticsScene(): JSX.Element {- const { searchParams: linkParams } = useValues(router)+ const { searchParams } = useValues(router)const { activeView } = useValues(engineeringAnalyticsSceneLogic)+ const { scopeRepo } = useValues(engineeringAnalyticsLogic)+ // The repository rides in the path, so an old `?repo` must not follow the tabs.+ const { repo: _repo, ...linkParams } = searchParams// The general areas of the product. A drill-down page sits below the tab it opens from.const tabs: LemonTab<EngineeringAnalyticsView>[] = [@@ -70,28 +73,28 @@ export function EngineeringAnalyticsScene(): JSX.Element {key: 'hub',label: 'Overview',content: <RepoOverviewScene />,- link: combineUrl(urls.engineeringAnalytics(), linkParams).url,+ link: combineUrl(urls.engineeringAnalytics(scopeRepo), linkParams).url,'data-attr': 'engineering-analytics-overview-tab',},{key: 'pull-requests',label: 'Pull requests',content: <EngineeringAnalyticsPullRequests />,- link: combineUrl(urls.engineeringAnalyticsPullRequestList(), linkParams).url,+ link: combineUrl(urls.engineeringAnalyticsPullRequestList(scopeRepo), linkParams).url,'data-attr': 'engineering-analytics-pull-requests-tab',},{key: 'workflows',label: 'Workflows',content: <EngineeringAnalyticsWorkflows />,- link: combineUrl(urls.engineeringAnalyticsWorkflows(), linkParams).url,+ link: combineUrl(urls.engineeringAnalyticsWorkflows(scopeRepo), linkParams).url,'data-attr': 'engineering-analytics-workflows-tab',},{key: 'tests',label: 'Tests',content: <EngineeringAnalyticsTests />,- link: combineUrl(urls.engineeringAnalyticsTests(), linkParams).url,+ link: combineUrl(urls.engineeringAnalyticsTests(scopeRepo), linkParams).url,// Pinned because autocapture dashboards and selectors use the original value.'data-attr': 'engineering-analytics-test-health-tab',},@@ -99,7 +102,7 @@ export function EngineeringAnalyticsScene(): JSX.Element {key: 'deploys',label: 'Deploys',content: <EngineeringAnalyticsDeploys />,- link: combineUrl(urls.engineeringAnalyticsDeploys(), linkParams).url,+ link: combineUrl(urls.engineeringAnalyticsDeploys(scopeRepo), linkParams).url,// Pinned because autocapture dashboards and selectors use the original value.'data-attr': 'engineering-analytics-health-tab',},@@ -107,14 +110,14 @@ export function EngineeringAnalyticsScene(): JSX.Element {key: 'teams',label: 'Teams',content: <EngineeringAnalyticsTeams />,- link: combineUrl(urls.engineeringAnalyticsTeams(), linkParams).url,+ link: combineUrl(urls.engineeringAnalyticsTeams(scopeRepo), linkParams).url,'data-attr': 'engineering-analytics-teams-tab',},{key: 'authors',label: 'Authors',content: <EngineeringAnalyticsAuthors />,- link: combineUrl(urls.engineeringAnalyticsAuthors(), linkParams).url,+ link: combineUrl(urls.engineeringAnalyticsAuthors(scopeRepo), linkParams).url,'data-attr': 'engineering-analytics-authors-tab',},]diff --git a/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsTeamScene.stories.tsx b/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsTeamScene.stories.tsxindex d8eb128aa39c..8651230af34e 100644--- a/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsTeamScene.stories.tsx+++ b/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsTeamScene.stories.tsx@@ -155,7 +155,7 @@ const meta: Meta = {viewMode: 'story',mockDate: '2026-07-03T12:00:00Z',featureFlags: [FEATURE_FLAGS.ENGINEERING_ANALYTICS],- pageUrl: urls.engineeringAnalyticsTeam(TEAM),+ pageUrl: urls.engineeringAnalyticsTeam(TEAM, 'PostHog/posthog'),testOptions: {waitForSelector: '[data-attr="engineering-analytics-team-tests-table"]',},diff --git a/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsTeamScene.tsx b/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsTeamScene.tsxindex f5c4aec282b1..d70f4c10ae22 100644--- a/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsTeamScene.tsx+++ b/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsTeamScene.tsx@@ -35,9 +35,10 @@ import { DEFAULT_TEAMS_WINDOW, TEAMS_WINDOW_DATE_OPTIONS, TEAMS_WINDOW_LABELS, Uexport const scene: SceneExport<TeamDetailLogicProps> = {component: EngineeringAnalyticsTeamScene,logic: teamDetailLogic,- paramsToProps: ({ params: { ownerTeam }, searchParams: { source } }) => ({+ paramsToProps: ({ params: { ownerTeam, repoOwner, repoName }, searchParams: { source } }) => ({ownerTeam: decodeURIComponent(ownerTeam ?? ''),sourceId: source ?? null,+ repo: repoOwner && repoName ? `${repoOwner}/${repoName}` : null,}),}@@ -56,6 +57,7 @@ export function EngineeringAnalyticsTeamScene(): JSX.Element {ownerTeam,deliveryScope,sourceId,+ repo,quarantinedTests,} = useValues(teamDetailLogic)const { loadActivity, loadHealthRow, loadMergeTrend } = useActions(teamDetailLogic)@@ -68,8 +70,8 @@ export function EngineeringAnalyticsTeamScene(): JSX.Element {const isUnowned = ownerTeam === UNOWNED_TEAMconst mainDataNotConnected = [activityStatus, healthRowStatus, mergeTrendStatus].includes('notConnected')- const hubUrl = withCurrentScope(urls.engineeringAnalytics(), sourceId)- const teamsUrl = withCurrentScope(urls.engineeringAnalyticsTeams(), sourceId)+ const hubUrl = withCurrentScope(urls.engineeringAnalytics(repo), sourceId)+ const teamsUrl = withCurrentScope(urls.engineeringAnalyticsTeams(repo), sourceId)const testColumns: LemonTableColumns<TeamTestSignalRow> = [{@@ -239,6 +241,7 @@ export function EngineeringAnalyticsTeamScene(): JSX.Element {<TeamDeliveryPanelscope={deliveryScope}sourceId={sourceId}+ repo={repo}busy={windowBusy}controls={windowControls}>diff --git a/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsTeams.stories.tsx b/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsTeams.stories.tsxindex ed145a76dc48..6b1b6ff92891 100644--- a/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsTeams.stories.tsx+++ b/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsTeams.stories.tsx@@ -126,7 +126,7 @@ type Story = StoryObj<typeof meta>export const TeamCIHealthRoster: Story = {render: () => <App />,parameters: {- pageUrl: urls.engineeringAnalyticsTeams(),+ pageUrl: urls.engineeringAnalyticsTeams('PostHog/posthog'),// The friction column appears only after its own request lands, later than the roster rows.testOptions: { waitForSelector: '[data-attr="engineering-analytics-teams-friction"]' },},@@ -135,7 +135,7 @@ export const TeamCIHealthRoster: Story = {export const TeamCIHealthLoadError: Story = {render: () => <App />,parameters: {- pageUrl: urls.engineeringAnalyticsTeams(),+ pageUrl: urls.engineeringAnalyticsTeams('PostHog/posthog'),testOptions: { waitForSelector: '.text-danger' },},decorators: [diff --git a/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsTeams.tsx b/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsTeams.tsxindex 41f7f2a6dc5f..8e16c1fb9eeb 100644--- a/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsTeams.tsx+++ b/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsTeams.tsx@@ -18,12 +18,12 @@ import { DEFAULT_TEAMS_WINDOW, TEAMS_WINDOW_LABELS, TeamCIHealthRow, UNOWNED_TEAconst FIXED_WINDOW = TEAMS_WINDOW_LABELS[DEFAULT_TEAMS_WINDOW].current.toLowerCase()/** The team's detail page, carrying the current scope so it opens scoped the same. */-function detailUrlOf(ownerTeam: string, sourceId: string | null): string {- return withCurrentScope(urls.engineeringAnalyticsTeam(ownerTeam), sourceId)+function detailUrlOf(ownerTeam: string, repo: string | null, sourceId: string | null): string {+ return withCurrentScope(urls.engineeringAnalyticsTeam(ownerTeam, repo), sourceId)}export function EngineeringAnalyticsTeams(): JSX.Element {- const { teams, teamsFailed, teamsLoading, teamsNotConnected, sourceId } = useValues(teamsLogic)+ const { teams, teamsFailed, teamsLoading, teamsNotConnected, sourceId, scopeRepo } = useValues(teamsLogic)const { loadTeams } = useActions(teamsLogic)const { friction } = useValues(authorFrictionLogic)const medianFriction = new Map((friction?.teams ?? []).map((team) => [team.github_team, team.median_score]))@@ -60,7 +60,7 @@ export function EngineeringAnalyticsTeams(): JSX.Element {row.ownerTeam === UNOWNED_TEAM ? (<div className="flex items-center gap-2"><Link- to={detailUrlOf(row.ownerTeam, sourceId)}+ to={detailUrlOf(row.ownerTeam, scopeRepo, sourceId)}className="font-semibold"data-attr="eng-analytics-team-link">@@ -74,7 +74,7 @@ export function EngineeringAnalyticsTeams(): JSX.Element {</div>) : (<Link- to={detailUrlOf(row.ownerTeam, sourceId)}+ to={detailUrlOf(row.ownerTeam, scopeRepo, sourceId)}className="font-mono text-xs font-semibold"data-attr="eng-analytics-team-link">@@ -131,7 +131,7 @@ export function EngineeringAnalyticsTeams(): JSX.Element {dataSource={teams?.rows ?? []}rowKey={(row) => row.ownerTeam}rowClassName="cursor-pointer"- onRow={(row) => rowNavigationProps(detailUrlOf(row.ownerTeam, sourceId))}+ onRow={(row) => rowNavigationProps(detailUrlOf(row.ownerTeam, scopeRepo, sourceId))}loading={teamsLoading}pagination={{ pageSize: 20 }}useURLForSorting={false}diff --git a/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsTests.stories.tsx b/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsTests.stories.tsxindex 0eafbcd440a3..6b5354ac7de1 100644--- a/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsTests.stories.tsx+++ b/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsTests.stories.tsx@@ -114,7 +114,7 @@ type Story = StoryObj<typeof meta>export const TrunkQuarantineDebt: Story = {render: () => <App />,- parameters: { pageUrl: urls.engineeringAnalyticsTests() },+ parameters: { pageUrl: urls.engineeringAnalyticsTests('PostHog/posthog') },}const OWNERS_UNAVAILABLE: TrunkQuarantineDebtApi = {@@ -126,7 +126,7 @@ const OWNERS_UNAVAILABLE: TrunkQuarantineDebtApi = {export const TrunkQuarantineDebtOwnersUnavailable: Story = {render: () => <App />,- parameters: { pageUrl: urls.engineeringAnalyticsTests() },+ parameters: { pageUrl: urls.engineeringAnalyticsTests('PostHog/posthog') },decorators: [mswDecorator({get: { 'api/projects/:team_id/engineering_analytics/trunk_quarantine/': OWNERS_UNAVAILABLE },@@ -137,7 +137,7 @@ export const TrunkQuarantineDebtOwnersUnavailable: Story = {export const QuarantineLoadError: Story = {render: () => <App />,parameters: {- pageUrl: urls.engineeringAnalyticsTests(),+ pageUrl: urls.engineeringAnalyticsTests('PostHog/posthog'),testOptions: { waitForSelector: '.text-danger' },},decorators: [diff --git a/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsTests.tsx b/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsTests.tsxindex 4b30675c11e7..8b8556ad5443 100644--- a/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsTests.tsx+++ b/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsTests.tsx@@ -24,6 +24,7 @@ function TrunkQuarantineDebtBoard(): JSX.Element {trunkQuarantineTestsByTeam,expandedTrunkQuarantineTeams,sourceId,+ scopeRepo,} = useValues(engineeringAnalyticsLogic)const { loadTrunkQuarantine, toggleTrunkQuarantineTeam } = useActions(engineeringAnalyticsLogic)@@ -39,7 +40,7 @@ function TrunkQuarantineDebtBoard(): JSX.Element {key: 'ownerTeam',render: (_, row) => (<Link- to={withCurrentScope(urls.engineeringAnalyticsTeam(row.ownerTeam), sourceId)}+ to={withCurrentScope(urls.engineeringAnalyticsTeam(row.ownerTeam, scopeRepo), sourceId)}className="font-semibold"data-attr="engineering-analytics-quarantine-team-link">diff --git a/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsWorkflows.stories.tsx b/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsWorkflows.stories.tsxindex f2fde4f80d4b..b7f6033aae00 100644--- a/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsWorkflows.stories.tsx+++ b/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsWorkflows.stories.tsx@@ -115,11 +115,11 @@ type Story = StoryObj<typeof meta>export const WorkflowList: Story = {render: () => <App />,- parameters: { pageUrl: urls.engineeringAnalyticsWorkflows() },+ parameters: { pageUrl: urls.engineeringAnalyticsWorkflows('PostHog/posthog') },}// The scope hydrates from the URL, so this opens on the merge-queue group.export const WorkflowListScopedToMergeQueue: Story = {render: () => <App />,- parameters: { pageUrl: `${urls.engineeringAnalyticsWorkflows()}?run_scope=merge_queue` },+ parameters: { pageUrl: `${urls.engineeringAnalyticsWorkflows('PostHog/posthog')}?run_scope=merge_queue` },}diff --git a/products/engineering_analytics/frontend/scenes/PullRequestDetailScene.tsx b/products/engineering_analytics/frontend/scenes/PullRequestDetailScene.tsxindex fc2314137e4a..8c4c571457a7 100644--- a/products/engineering_analytics/frontend/scenes/PullRequestDetailScene.tsx+++ b/products/engineering_analytics/frontend/scenes/PullRequestDetailScene.tsx@@ -1,4 +1,4 @@-import { useActions, useValues } from 'kea'+import { useActions, useMountedLogic, useValues } from 'kea'import { combineUrl } from 'kea-router'import { IconExternal, IconPullRequest } from '@posthog/icons'@@ -48,6 +48,7 @@ import {pullRequestDetailLogic,latestRunPerWorkflow,} from './pullRequestDetailLogic'+import { repoScopeLogic } from './repoScopeLogic'export const scene: SceneExport<PullRequestDetailLogicProps> = {component: PullRequestDetailScene,@@ -407,6 +408,8 @@ function PrWorkflowsTable({}export function PullRequestDetailScene(): JSX.Element {+ // Remembers this repository, so the product root reopens it.+ useMountedLogic(repoScopeLogic)const {lifecycle,lifecycleLoading,@@ -518,12 +521,15 @@ export function PullRequestDetailScene(): JSX.Element {repoSlot={<RepoScopeChiplabel={`${repoOwner}/${repoName}`}- to={withCurrentScope(urls.engineeringAnalytics(), sourceId)}+ to={withCurrentScope(urls.engineeringAnalytics(`${repoOwner}/${repoName}`), sourceId)}/>}lensFilter={{label: `pr: #${pullRequest?.number ?? ''}`,- to: withCurrentScope(urls.engineeringAnalyticsPullRequestList(), sourceId),+ to: withCurrentScope(+ urls.engineeringAnalyticsPullRequestList(`${repoOwner}/${repoName}`),+ sourceId+ ),}}showDate={false}/>@@ -551,7 +557,10 @@ export function PullRequestDetailScene(): JSX.Element {<Linkto={combineUrl(- urls.engineeringAnalyticsAuthor(pullRequest.author.handle),+ urls.engineeringAnalyticsAuthor(+ pullRequest.author.handle,+ `${repoOwner}/${repoName}`+ ),sourceId ? { source: sourceId } : {}).url}diff --git a/products/engineering_analytics/frontend/scenes/RepoOverviewScene.stories.tsx b/products/engineering_analytics/frontend/scenes/RepoOverviewScene.stories.tsxindex c11766913033..a37c712b057a 100644--- a/products/engineering_analytics/frontend/scenes/RepoOverviewScene.stories.tsx+++ b/products/engineering_analytics/frontend/scenes/RepoOverviewScene.stories.tsx@@ -277,7 +277,7 @@ type Story = StoryObj<typeof meta>export const RepoOverview: Story = {render: () => <App />,- parameters: { pageUrl: urls.engineeringAnalytics() },+ parameters: { pageUrl: urls.engineeringAnalytics('PostHog/posthog') },}// The Trunk-source variant: the failed-queue-run proxy card is replaced by the queue's own@@ -293,7 +293,7 @@ const OVERVIEW_WITH_TRUNK: RepoOverviewApi = {export const RepoOverviewWithTrunkQueueData: Story = {render: () => <App />,- parameters: { pageUrl: urls.engineeringAnalytics() },+ parameters: { pageUrl: urls.engineeringAnalytics('PostHog/posthog') },decorators: [mswDecorator({get: {diff --git a/products/engineering_analytics/frontend/scenes/RepoOverviewScene.tsx b/products/engineering_analytics/frontend/scenes/RepoOverviewScene.tsxindex 102ebc015705..93e94e0af4b9 100644--- a/products/engineering_analytics/frontend/scenes/RepoOverviewScene.tsx+++ b/products/engineering_analytics/frontend/scenes/RepoOverviewScene.tsx@@ -45,7 +45,7 @@ export function RepoOverviewScene(): JSX.Element {prPreviewCount,workflowPreviewCount,} = useValues(repoOverviewLogic)- const { workflowHealth, workflowHealthLoadError, workflowHealthLoading, sourceId, activeSource } =+ const { workflowHealth, workflowHealthLoadError, workflowHealthLoading, sourceId, scopeRepo, activeSource } =useValues(engineeringAnalyticsLogic)const { loadWorkflowHealth } = useActions(engineeringAnalyticsLogic)const { loadAttention, loadOverview, loadRepoActivity, showMorePrs, showMoreWorkflows } =@@ -229,7 +229,11 @@ export function RepoOverviewScene(): JSX.Element {to={// A bare link would reset the shared window / run scope / repo (the filters// logic re-hydrates from the URL on every route), so carry it, plus the source.- withScope(urls.engineeringAnalyticsWorkflows(), searchParams, sourceId)+ withScope(+ urls.engineeringAnalyticsWorkflows(scopeRepo),+ searchParams,+ sourceId+ )}>View all →@@ -270,7 +274,9 @@ export function RepoOverviewScene(): JSX.Element {Show more</LemonButton>)}- <Link to={withCurrentScope(urls.engineeringAnalyticsPullRequestList(), sourceId)}>+ <Link+ to={withCurrentScope(urls.engineeringAnalyticsPullRequestList(scopeRepo), sourceId)}+ >View all →</Link></div>diff --git a/products/engineering_analytics/frontend/scenes/TeamDeliveryPanel.tsx b/products/engineering_analytics/frontend/scenes/TeamDeliveryPanel.tsxindex a81e28794312..bdc504d45d52 100644--- a/products/engineering_analytics/frontend/scenes/TeamDeliveryPanel.tsx+++ b/products/engineering_analytics/frontend/scenes/TeamDeliveryPanel.tsx@@ -10,17 +10,19 @@ import { deliverySummaryLogic } from './deliverySummaryLogic'export function TeamDeliveryPanel({scope,sourceId,+ repo,busy,controls,children,}: {scope: DeliveryScopesourceId: string | null+ repo: string | nullbusy: booleancontrols: ReactNodechildren: ReactNode}): JSX.Element {- const { summary, summaryFailed, summaryLoading } = useValues(deliverySummaryLogic({ scope, sourceId }))+ const { summary, summaryFailed, summaryLoading } = useValues(deliverySummaryLogic({ scope, sourceId, repo }))return (<ScopePanel busy={busy || summaryLoading} controls={controls}>@@ -31,7 +33,7 @@ export function TeamDeliveryPanel({delivery figures.</div>) : (- <DeliverySections scope={scope} scopeLabel="This team" sourceId={sourceId} />+ <DeliverySections scope={scope} scopeLabel="This team" sourceId={sourceId} repo={repo} />)}{children}</ScopePanel>diff --git a/products/engineering_analytics/frontend/scenes/TeamFrictionSection.tsx b/products/engineering_analytics/frontend/scenes/TeamFrictionSection.tsxindex d841164de3c1..ca8e92ba0d8c 100644--- a/products/engineering_analytics/frontend/scenes/TeamFrictionSection.tsx+++ b/products/engineering_analytics/frontend/scenes/TeamFrictionSection.tsx@@ -9,7 +9,8 @@ import { authorFrictionLogic } from './authorFrictionLogic'/** A team's median friction and its members by friction. Members keep their repository-wide ranks. */export function TeamFrictionSection({ githubTeam }: { githubTeam: string }): JSX.Element {- const { friction, frictionLoading, frictionFailed, frictionNotConnected, sourceId } = useValues(authorFrictionLogic)+ const { friction, frictionLoading, frictionFailed, frictionNotConnected, sourceId, scopeRepo } =+ useValues(authorFrictionLogic)const { loadFriction } = useActions(authorFrictionLogic)const members = (friction?.items ?? []).filter((item) => (item.teams ?? []).includes(githubTeam))@@ -50,6 +51,7 @@ export function TeamFrictionSection({ githubTeam }: { githubTeam: string }): JSXmaxScore={maxScore}loading={frictionLoading}sourceId={sourceId}+ repo={scopeRepo}emptyState={friction?.has_membership_data === false? 'Team membership is not synced for this source, so the team has no members to show.'diff --git a/products/engineering_analytics/frontend/scenes/WorkflowRunDetailScene.tsx b/products/engineering_analytics/frontend/scenes/WorkflowRunDetailScene.tsxindex 8ce3e37e1a73..ff7c2568c8e5 100644--- a/products/engineering_analytics/frontend/scenes/WorkflowRunDetailScene.tsx+++ b/products/engineering_analytics/frontend/scenes/WorkflowRunDetailScene.tsx@@ -1,4 +1,4 @@-import { useActions, useValues } from 'kea'+import { useActions, useMountedLogic, useValues } from 'kea'import { router } from 'kea-router'import { IconCheckCircle, IconExternal, IconHourglass, IconPause, IconXCircle } from '@posthog/icons'@@ -26,6 +26,7 @@ import { githubCommitUrl, githubRunUrl } from '../lib/github'import { isDecisiveFailure } from '../lib/lifecycle'import { verdictTag } from '../lib/runStatus'import { withScope } from '../lib/scope'+import { repoScopeLogic } from './repoScopeLogic'import { WorkflowRunDetailLogicProps, workflowRunDetailLogic } from './workflowRunDetailLogic'export const scene: SceneExport<WorkflowRunDetailLogicProps> = {@@ -41,6 +42,8 @@ export const scene: SceneExport<WorkflowRunDetailLogicProps> = {}export function WorkflowRunDetailScene(): JSX.Element {+ // Remembers this repository, so the product root reopens it.+ useMountedLogic(repoScopeLogic)const {run,runLoading,@@ -142,7 +145,11 @@ export function WorkflowRunDetailScene(): JSX.Element {repoSlot={<RepoScopeChiplabel={`${run.repo.owner}/${run.repo.name}`}- to={withScope(urls.engineeringAnalytics(), searchParams, sourceId)}+ to={withScope(+ urls.engineeringAnalytics(`${run.repo.owner}/${run.repo.name}`),+ searchParams,+ sourceId+ )}/>}crumbs={[diff --git a/products/engineering_analytics/frontend/scenes/WorkflowRunsScene.tsx b/products/engineering_analytics/frontend/scenes/WorkflowRunsScene.tsxindex cf50223486c6..5153a47c595a 100644--- a/products/engineering_analytics/frontend/scenes/WorkflowRunsScene.tsx+++ b/products/engineering_analytics/frontend/scenes/WorkflowRunsScene.tsx@@ -1,4 +1,4 @@-import { useActions, useValues } from 'kea'+import { useActions, useMountedLogic, useValues } from 'kea'import { router } from 'kea-router'import { IconExternal, IconGear } from '@posthog/icons'@@ -42,6 +42,7 @@ import { githubCommitUrl, githubWorkflowUrl } from '../lib/github'import { jobCacheKey } from '../lib/jobs'import { isDecisiveFailure } from '../lib/lifecycle'import { withScope } from '../lib/scope'+import { repoScopeLogic } from './repoScopeLogic'import { WorkflowRunRow, WorkflowRunsLogicProps, workflowRunsLogic } from './workflowRunsLogic'/** Spend by runner tier: tier, job count, cost (or 'free'), share bar scaled to billable spend. */@@ -96,6 +97,8 @@ function runRowKey(run: WorkflowRunRow): string {}export function WorkflowRunsScene(): JSX.Element {+ // Remembers this repository, so the product root reopens it.+ useMountedLogic(repoScopeLogic)const {runRows,runsLoading,@@ -316,7 +319,7 @@ export function WorkflowRunsScene(): JSX.Element {repoSlot={<RepoScopeChiplabel={`${repoOwner}/${repoName}`}- to={withScope(urls.engineeringAnalytics(), searchParams, sourceId)}+ to={withScope(urls.engineeringAnalytics(`${repoOwner}/${repoName}`), searchParams, sourceId)}/>}crumbs={[diff --git a/products/engineering_analytics/frontend/scenes/authorFrictionLogic.test.ts b/products/engineering_analytics/frontend/scenes/authorFrictionLogic.test.tsindex 12317aee3f3d..43aef7eb1991 100644--- a/products/engineering_analytics/frontend/scenes/authorFrictionLogic.test.ts+++ b/products/engineering_analytics/frontend/scenes/authorFrictionLogic.test.ts@@ -1,6 +1,8 @@+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'@@ -114,4 +116,17 @@ describe('authorFrictionLogic', () => {await expectLogic(logic).toDispatchActions(['loadFrictionSuccess'])expect(mockFriction).toHaveBeenCalledTimes(3)})++ it('reads once, for the forwarded repository, when an old repo-less link opens', async () => {+ ;(engineeringAnalyticsSources as jest.Mock).mockResolvedValue([+ { id: 'source-2', repo: 'PostHog/posthog-js', prefix: 'js', synced: true },+ ])+ router.actions.push(urls.engineeringAnalyticsAuthors())+ logic = authorFrictionLogic()+ logic.mount()++ await expectLogic(logic).toDispatchActions(['loadFrictionSuccess'])+ expect(mockFriction).toHaveBeenCalledTimes(1)+ expect(mockFriction).toHaveBeenCalledWith('1', { source_id: undefined, repo: 'PostHog/posthog-js' })+ })})diff --git a/products/engineering_analytics/frontend/scenes/authorFrictionLogic.ts b/products/engineering_analytics/frontend/scenes/authorFrictionLogic.tsindex 64d684aa89d2..a2ec3f572ea6 100644--- a/products/engineering_analytics/frontend/scenes/authorFrictionLogic.ts+++ b/products/engineering_analytics/frontend/scenes/authorFrictionLogic.ts@@ -5,7 +5,12 @@ import { ApiConfig } from 'lib/api'import { engineeringAnalyticsAuthorFriction } from '../generated/api'import type { AuthorFrictionApi, AuthorFrictionListApi } from '../generated/api.schemas'-import { LoaderStatus, engineeringAnalyticsLogic, loaderStatusFromError } from './engineeringAnalyticsLogic'+import {+ LoaderStatus,+ awaitsRepoForward,+ engineeringAnalyticsLogic,+ loaderStatusFromError,+} from './engineeringAnalyticsLogic'const projectId = (): string => String(ApiConfig.getCurrentProjectId())@@ -150,6 +155,8 @@ export const authorFrictionLogic = kea<authorFrictionLogicType>([refresh: () => actions.loadFriction(),})),afterMount(({ actions }) => {- actions.loadFriction()+ if (!awaitsRepoForward()) {+ actions.loadFriction()+ }}),])diff --git a/products/engineering_analytics/frontend/scenes/authorLogic.test.ts b/products/engineering_analytics/frontend/scenes/authorLogic.test.tsindex 2d82f0851df9..dda9d699c491 100644--- a/products/engineering_analytics/frontend/scenes/authorLogic.test.ts+++ b/products/engineering_analytics/frontend/scenes/authorLogic.test.ts@@ -28,25 +28,19 @@ describe('authorLogic', () => {afterEach(() => logic?.unmount())- it('keeps the scope on the breadcrumbs back to the pull requests list', () => {- router.actions.push(urls.engineeringAnalyticsAuthor('jane-dev'), {+ it('keeps the repository and scope on the breadcrumbs back to the pull requests list', () => {+ router.actions.push(urls.engineeringAnalyticsAuthor('jane-dev', 'PostHog/posthog-js'), {source: 'source-2',- repo: 'PostHog/posthog-js',date_from: '-30d',})- logic = authorLogic({ handle: 'jane-dev', sourceId: 'source-2' })+ logic = authorLogic({ handle: 'jane-dev', sourceId: 'source-2', repo: 'PostHog/posthog-js' })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- )+ expect(hub.pathname).toBe('/engineering-analytics/repos/PostHog/posthog-js/overview')+ expect(pullRequests.pathname).toBe('/engineering-analytics/repos/PostHog/posthog-js/pull-requests')for (const destination of [hub, pullRequests]) {- expect(Object.fromEntries(destination.searchParams)).toEqual({- date_from: '-30d',- source: 'source-2',- repo: 'PostHog/posthog-js',- })+ expect(Object.fromEntries(destination.searchParams)).toEqual({ date_from: '-30d', source: 'source-2' })}})})diff --git a/products/engineering_analytics/frontend/scenes/authorLogic.ts b/products/engineering_analytics/frontend/scenes/authorLogic.tsindex 09c0285f1c99..3791665520c4 100644--- a/products/engineering_analytics/frontend/scenes/authorLogic.ts+++ b/products/engineering_analytics/frontend/scenes/authorLogic.ts@@ -17,6 +17,8 @@ export interface AuthorLogicProps {handle: string// Which GitHub source the page was scoped to, threaded from `?source=` via paramsToProps.sourceId: string | null+ /** The 'owner/name' from the path. Every figure on the page is this repository's. */+ repo: string | null}// Generated by kea-typegen. Update if you're an agent, ignore if you're human.@@ -29,6 +31,7 @@ export interface authorLogicValues {frictionDetailFailed: booleanfrictionDetailLoading: booleanhandle: string+ repo: string | nullsourceId: string | nullworkflowCosts: WorkflowCostApi[]workflowCostsFailed: boolean@@ -56,9 +59,15 @@ export interface authorLogicMeta {key: string__keaTypeGenInternalSelectorTypes: {sourceId: (arg: string | null) => string | null+ repo: (arg: string | null) => string | nullhandle: (arg: string) => stringdeliveryScope: (handle: string) => DeliveryScope- breadcrumbs: (handle: string, sourceId: string | null, searchParams: Record<string, any>) => Breadcrumb[]+ breadcrumbs: (+ handle: string,+ repo: string | null,+ sourceId: string | null,+ searchParams: Record<string, any>+ ) => Breadcrumb[]}}@@ -67,7 +76,7 @@ export type authorLogicType = MakeLogicType<authorLogicValues, authorLogicActionexport const authorLogic = kea<authorLogicType>([path(['products', 'engineering_analytics', 'frontend', 'scenes', 'authorLogic']),props({} as AuthorLogicProps),- key((props) => `author/${props.handle}@${props.sourceId ?? ''}`),+ key((props) => `author/${props.handle}@${props.repo ?? ''}@${props.sourceId ?? ''}`),connect(() => ({values: [engineeringAnalyticsFiltersLogic, ['dateFrom', 'dateTo']],@@ -85,6 +94,7 @@ export const authorLogic = kea<authorLogicType>([date_from: values.dateFrom ?? undefined,date_to: values.dateTo ?? undefined,source_id: props.sourceId ?? undefined,+ repo: props.repo ?? undefined,}),},],@@ -96,6 +106,7 @@ export const authorLogic = kea<authorLogicType>([await engineeringAnalyticsAuthorFrictionDetail(String(ApiConfig.getCurrentProjectId()), {author: props.handle,source_id: props.sourceId ?? undefined,+ repo: props.repo ?? undefined,}),},],@@ -117,26 +128,28 @@ export const authorLogic = kea<authorLogicType>([() => [(_, p: AuthorLogicProps) => p.sourceId],(sourceId: string | null): string | null => sourceId,],+ repo: [() => [(_, p: AuthorLogicProps) => p.repo], (repo: string | null): string | null => repo],handle: [() => [(_, p: AuthorLogicProps) => p.handle], (handle: string): string => handle],// 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: [- (s) => [s.handle, s.sourceId, router.selectors.searchParams],+ (s) => [s.handle, s.repo, s.sourceId, router.selectors.searchParams],(handle: string,+ repo: string | null,sourceId: string | null,searchParams: Record<string, string | undefined>): Breadcrumb[] => [{key: 'EngineeringAnalytics',name: 'Engineering analytics',- path: withScope(urls.engineeringAnalytics(), searchParams, sourceId),+ path: withScope(urls.engineeringAnalytics(repo), searchParams, sourceId),iconType: 'health',},{key: 'EngineeringAnalyticsPullRequests',name: 'Pull requests',- path: withScope(urls.engineeringAnalyticsPullRequestList(), searchParams, sourceId),+ path: withScope(urls.engineeringAnalyticsPullRequestList(repo), searchParams, sourceId),iconType: 'health',},{ key: ['EngineeringAnalyticsAuthor', handle], name: handle, iconType: 'health' },diff --git a/products/engineering_analytics/frontend/scenes/ciExplorerLogic.ts b/products/engineering_analytics/frontend/scenes/ciExplorerLogic.tsindex 3b027548e2cf..9b09c1717bdb 100644--- a/products/engineering_analytics/frontend/scenes/ciExplorerLogic.ts+++ b/products/engineering_analytics/frontend/scenes/ciExplorerLogic.ts@@ -817,7 +817,7 @@ export const ciExplorerLogic = kea<ciExplorerLogicType>([{key: 'EngineeringAnalytics',name: 'Engineering analytics',- path: withScope(urls.engineeringAnalytics(), searchParams, sourceId),+ path: withScope(urls.engineeringAnalytics(`${repoOwner}/${repoName}`), searchParams, sourceId),iconType: 'health',},{diff --git a/products/engineering_analytics/frontend/scenes/deliverySummaryLogic.ts b/products/engineering_analytics/frontend/scenes/deliverySummaryLogic.tsindex 24e29951401f..eeaeed72e0d1 100644--- a/products/engineering_analytics/frontend/scenes/deliverySummaryLogic.ts+++ b/products/engineering_analytics/frontend/scenes/deliverySummaryLogic.ts@@ -12,6 +12,8 @@ export interface DeliverySummaryLogicProps {// An author or a GitHub team; the summary endpoint rejects a single pull request.scope: DeliveryScopesourceId: string | null+ /** The 'owner/name' in the page's path. */+ repo?: string | null}// Generated by kea-typegen. Update if you're an agent, ignore if you're human.@@ -57,7 +59,7 @@ export type deliverySummaryLogicType = MakeLogicType<export const deliverySummaryLogic = kea<deliverySummaryLogicType>([path(['products', 'engineering_analytics', 'frontend', 'scenes', 'deliverySummaryLogic']),props({} as DeliverySummaryLogicProps),- key((props) => `${deliveryScopeKey(props.scope)}@${props.sourceId ?? ''}`),+ key((props) => `${deliveryScopeKey(props.scope)}@${props.repo ?? ''}@${props.sourceId ?? ''}`),connect(() => ({values: [engineeringAnalyticsFiltersLogic, ['dateFrom', 'dateTo']],@@ -73,6 +75,7 @@ export const deliverySummaryLogic = kea<deliverySummaryLogicType>([date_from: values.dateFrom ?? undefined,date_to: values.dateTo ?? undefined,source_id: props.sourceId ?? undefined,+ repo: props.repo ?? undefined,}),},],diff --git a/products/engineering_analytics/frontend/scenes/doraLogic.ts b/products/engineering_analytics/frontend/scenes/doraLogic.tsindex 94229a49d32e..562b1e99315d 100644--- a/products/engineering_analytics/frontend/scenes/doraLogic.ts+++ b/products/engineering_analytics/frontend/scenes/doraLogic.ts@@ -8,7 +8,12 @@ import type { BoxPlotBucket } from '../components/LeadTimeBoxPlot'import { engineeringAnalyticsDora } from '../generated/api'import type { DoraOverviewApi } from '../generated/api.schemas'import { engineeringAnalyticsFiltersLogic } from './engineeringAnalyticsFiltersLogic'-import { engineeringAnalyticsLogic, formatBucket, type WorkflowGranularity } from './engineeringAnalyticsLogic'+import {+ awaitsRepoForward,+ engineeringAnalyticsLogic,+ formatBucket,+ type WorkflowGranularity,+} from './engineeringAnalyticsLogic'const projectId = (): string => String(ApiConfig.getCurrentProjectId())@@ -359,6 +364,8 @@ export const doraLogic = kea<doraLogicType>([})),afterMount(({ actions }) => {- actions.loadDora()+ if (!awaitsRepoForward()) {+ actions.loadDora()+ }}),])diff --git a/products/engineering_analytics/frontend/scenes/engineeringAnalyticsLogic.test.ts b/products/engineering_analytics/frontend/scenes/engineeringAnalyticsLogic.test.tsindex 08f9847ec42c..e857b0b58116 100644--- a/products/engineering_analytics/frontend/scenes/engineeringAnalyticsLogic.test.ts+++ b/products/engineering_analytics/frontend/scenes/engineeringAnalyticsLogic.test.ts@@ -195,6 +195,8 @@ describe('engineeringAnalyticsLogic', () => {let extraUnmounts: (() => void)[] = []beforeEach(() => {+ // The last repository used persists, so one test's pick must not steer the next test's forward.+ localStorage.clear()initKeaTests()ApiConfig.setCurrentProjectId(1)jest.clearAllMocks()@@ -463,30 +465,61 @@ describe('engineeringAnalyticsLogic', () => {})it.each([- ['workflows', () => urls.engineeringAnalyticsWorkflows()],- ['tests', () => urls.engineeringAnalyticsTests()],- ['teams', () => urls.engineeringAnalyticsTeams()],- ['authors', () => urls.engineeringAnalyticsAuthors()],- ['team detail', () => urls.engineeringAnalyticsTeam('team-replay')],- ['deploys', () => urls.engineeringAnalyticsDeploys()],- ])('the %s route applies ?source and ?repo like the other tabs', async (_label, url) => {+ ['workflows', () => urls.engineeringAnalyticsWorkflows('posthog/posthog.com')],+ ['tests', () => urls.engineeringAnalyticsTests('posthog/posthog.com')],+ ['teams', () => urls.engineeringAnalyticsTeams('posthog/posthog.com')],+ ['authors', () => urls.engineeringAnalyticsAuthors('posthog/posthog.com')],+ ['team detail', () => urls.engineeringAnalyticsTeam('team-replay', 'posthog/posthog.com')],+ ['deploys', () => urls.engineeringAnalyticsDeploys('posthog/posthog.com')],+ ])('the %s route takes the repository from its path and the source from ?source', async (_label, url) => {logic = engineeringAnalyticsLogic()logic.mount()- router.actions.push(url(), { source: 'src-newer', repo: 'posthog/posthog.com' })+ router.actions.push(url(), { source: 'src-newer' })await expectLogic(logic).toDispatchActions(['setScope'])expect(logic.values.sourceId).toBe('src-newer')expect(logic.values.scopeRepo).toBe('posthog/posthog.com')})it('requests the hub once on a scoped direct load', async () => {- router.actions.push(urls.engineeringAnalyticsTeam('team-replay'), { source: 'src-newer' })+ router.actions.push(urls.engineeringAnalyticsTeam('team-replay', 'posthog/posthog.com'), {+ source: 'src-newer',+ })+ logic = engineeringAnalyticsLogic()+ logic.mount()++ await expectLogic(logic).toDispatchActions(['loadCardsSuccess'])+ expect(mockCiCards).toHaveBeenCalledTimes(1)+ expect(mockCiCards.mock.calls[0][1]).toMatchObject({ source_id: 'src-newer', repo: 'posthog/posthog.com' })+ })++ it.each([+ ['the repository it names', { repo: 'posthog/posthog.com' }, 'posthog/posthog.com'],+ ['the first synced repository of the source it names', { source: 'src-newer' }, 'posthog/posthog.com'],+ ['the default repository when it names none', {}, 'posthog/posthog'],+ ])('an old repo-less link forwards to %s, then loads once', async (_label, searchParams, repo) => {+ mockSources.mockResolvedValue(SOURCES)+ router.actions.push(urls.engineeringAnalyticsPullRequestList(), { ...searchParams, date_from: '-30d' })logic = engineeringAnalyticsLogic()logic.mount()await expectLogic(logic).toDispatchActions(['loadCardsSuccess'])+ expect(routedPath()).toBe(urls.engineeringAnalyticsPullRequestList(repo))+ expect(router.values.searchParams).not.toHaveProperty('repo')expect(mockCiCards).toHaveBeenCalledTimes(1)- expect(mockCiCards.mock.calls[0][1]).toMatchObject({ source_id: 'src-newer' })+ expect(mockCiCards.mock.calls[0][1]).toMatchObject({ repo })+ })++ it('an old repo-less link to a legacy source stays repo-less and reads that source', async () => {+ mockSources.mockResolvedValue([...SOURCES, { id: 'src-legacy', repo: '', prefix: 'legacy', synced: true }])+ router.actions.push(urls.engineeringAnalyticsPullRequestList(), { source: 'src-legacy' })+ logic = engineeringAnalyticsLogic()+ logic.mount()++ await expectLogic(logic).toDispatchActions(['noRepoToForward', 'loadCardsSuccess'])+ expect(routedPath()).toBe(urls.engineeringAnalyticsPullRequestList())+ expect(mockCiCards).toHaveBeenCalledTimes(1)+ expect(mockCiCards.mock.calls[0][1]).toMatchObject({ source_id: 'src-legacy' })})const openPullRequestList = async (@@ -494,7 +527,8 @@ describe('engineeringAnalyticsLogic', () => {sources: GitHubSourceApi[] = SOURCES): Promise<jest.SpyInstance> => {mockSources.mockResolvedValue(sources)- router.actions.push(urls.engineeringAnalyticsPullRequestList(), searchParams)+ const { repo, ...rest } = searchParams+ router.actions.push(urls.engineeringAnalyticsPullRequestList(repo), rest)logic = engineeringAnalyticsLogic()logic.mount()await expectLogic(logic).toDispatchActions(['loadGithubSourcesSuccess'])@@ -530,7 +564,7 @@ describe('engineeringAnalyticsLogic', () => {PICKED,'#42',urls.engineeringAnalyticsCIExplorer('posthog', 'posthog', 42),- PICKED,+ { source: 'src-older', date_from: '-30d' },'number',],])('the pull request jump opens %s once', async (_label, opened, text, pathname, searchParams, inputKind) => {diff --git a/products/engineering_analytics/frontend/scenes/engineeringAnalyticsLogic.ts b/products/engineering_analytics/frontend/scenes/engineeringAnalyticsLogic.tsindex c76c4191f783..9f1aa1783e31 100644--- a/products/engineering_analytics/frontend/scenes/engineeringAnalyticsLogic.ts+++ b/products/engineering_analytics/frontend/scenes/engineeringAnalyticsLogic.ts@@ -17,6 +17,7 @@ import posthog from 'posthog-js'import { ApiConfig, ApiError } from 'lib/api'import { dayjs } from 'lib/dayjs'import { groupBy } from 'lib/utils/arrays'+import { removeProjectIdIfPresent } from 'lib/utils/kea-router'import { objectsEqual } from 'lib/utils/objects'import { urls } from 'scenes/urls'@@ -31,10 +32,12 @@ import {import type { GitHubSourceApi, PullRequestListItemApi, PushCISampleApi } from '../generated/api.schemas'import { CIStatus, ciStatusOf } from '../lib/ci'import { parsePullRequestReference, resolvePullRequestTarget } from '../lib/pullRequestReference'+import { repoFromPath, switchRepoPath } from '../lib/repoScope'import { type FleetSummary, computeFleetSummary } from '../lib/runHealth'import { scopeToValue, withCurrentScope, withScope } from '../lib/scope'import { engineeringAnalyticsFiltersLogic } from './engineeringAnalyticsFiltersLogic'import type { RunScopeParams } from './engineeringAnalyticsFiltersLogic'+import { repoScopeLogic } from './repoScopeLogic'// pinned: analytics event name. Renaming it breaks the insights built on it.const EVENT_PULL_REQUEST_JUMP_SUBMITTED = 'pull request jump submitted'@@ -398,6 +401,14 @@ export interface TrunkQuarantineData {*/export type LoaderStatus = 'ok' | 'notConnected' | 'error'+/** Whether repoScopeLogic is about to forward the current repo-less URL to a repository. A load waits for+ * the forward, which ends in a refresh, so it does not read a repository the page leaves at once. */+export function awaitsRepoForward(): boolean {+ const pathname = removeProjectIdIfPresent(router.values.location.pathname)+ const repoLess = pathname.startsWith('/engineering-analytics/') && repoFromPath(pathname) === null+ return repoLess && (repoScopeLogic.findMounted()?.values.pendingForward ?? false)+}+export function loaderStatusFromError(errorObject: unknown): LoaderStatus {return errorObject instanceof ApiError && errorObject.status === 400 ? 'notConnected' : 'error'}@@ -467,6 +478,9 @@ export interface engineeringAnalyticsLogicValues {// Generated by kea-typegen. Update if you're an agent, ignore if you're human.export interface engineeringAnalyticsLogicActions {+ noRepoToForward: () => {+ value: true+ }applyCardFilter: (card: CardFilter) => {card: CardFilter}@@ -704,6 +718,7 @@ export const engineeringAnalyticsLogic: LogicWrapper<engineeringAnalyticsLogicTyconnect(() => ({values: [engineeringAnalyticsFiltersLogic, ['dateFrom', 'dateTo', 'runScopeParams']],+ actions: [repoScopeLogic, ['noRepoToForward']],})),actions({@@ -1240,6 +1255,15 @@ export const engineeringAnalyticsLogic: LogicWrapper<engineeringAnalyticsLogicTy},setSourceId: () => actions.refresh(),setScope: () => actions.refresh(),+ noRepoToForward: () => {+ // A repo-less page takes no scope from urlToAction, so a legacy source's link reads ?source here.+ const source = router.values.searchParams.source ?? null+ if (source !== values.sourceId) {+ actions.setScope(source, null)+ } else {+ actions.refresh()+ }+ },[engineeringAnalyticsFiltersLogic.actionTypes.setDateRange]: () => {actions.loadWorkflowHealth()},@@ -1289,57 +1313,55 @@ export const engineeringAnalyticsLogic: LogicWrapper<engineeringAnalyticsLogicTy},})),- actionToUrl(() => {- // Write the (source, repo) scope onto the URL. A source change without a repo drops `?repo`- // (the old repo belonged to the old source); setScope writes both together.- const writeScope = (- sourceId: string | null,- scopeRepo: string | null- ): [string, Record<string, string>, Record<string, string>, { replace: boolean }] => {- const searchParams = { ...router.values.searchParams }- if (sourceId) {- searchParams.source = sourceId- } else {- delete searchParams.source+ actionToUrl(() => ({+ // The repository is a path segment, so picking one navigates to the same page in it. `?source`+ // stays a query param: it only tells apart two sources that sync the same repository.+ setScope: ({ sourceId, scopeRepo }) => {+ if (!scopeRepo) {+ return undefined}- if (scopeRepo) {- searchParams.repo = scopeRepo- } else {- delete searchParams.repo- }- return [router.values.location.pathname, searchParams, router.values.hashParams, { replace: true }]- }- return {- setSourceId: ({ sourceId }) => writeScope(sourceId, null),- setScope: ({ sourceId, scopeRepo }) => writeScope(sourceId, scopeRepo),- }- }),+ const pathname = removeProjectIdIfPresent(router.values.location.pathname)+ const { repo: _repo, source: _source, ...searchParams } = router.values.searchParams+ return [+ switchRepoPath(pathname, scopeRepo),+ sourceId ? { ...searchParams, source: sourceId } : searchParams,+ router.values.hashParams,+ ]+ },+ })),urlToAction(({ actions, values }) => {- // `?run_scope=` is hydrated by engineeringAnalyticsFiltersLogic, not here.- const applyScope = (source: string | undefined, repo: string | undefined): void => {- const nextSource = source ?? null- const nextRepo = repo ?? null+ // `?run_scope=` is hydrated by engineeringAnalyticsFiltersLogic, not here. A repo-less path takes+ // no scope: repoScopeLogic forwards it to a repository first.+ const applyScope = (+ { repoOwner, repoName }: Record<string, string | undefined>,+ searchParams: Record<string, any>+ ): void => {+ const nextSource = searchParams.source ?? null+ const nextRepo = repoOwner && repoName ? `${repoOwner}/${repoName}` : nullif (nextSource !== values.sourceId || nextRepo !== values.scopeRepo) {actions.setScope(nextSource, nextRepo)}}- return {- [urls.engineeringAnalytics()]: (_, s) => applyScope(s.source, s.repo),- [urls.engineeringAnalyticsPullRequestList()]: (_, s) => applyScope(s.source, s.repo),- [urls.engineeringAnalyticsWorkflows()]: (_, s) => applyScope(s.source, s.repo),- [urls.engineeringAnalyticsTests()]: (_, s) => applyScope(s.source, s.repo),- [urls.engineeringAnalyticsDeploys()]: (_, s) => applyScope(s.source, s.repo),- [urls.engineeringAnalyticsTeams()]: (_, s) => applyScope(s.source, s.repo),- [urls.engineeringAnalyticsAuthors()]: (_, s) => applyScope(s.source, s.repo),- '/engineering-analytics/teams/:ownerTeam': (_, s) => applyScope(s.source, s.repo),- }+ return Object.fromEntries(+ [+ 'overview',+ 'pull-requests',+ 'workflows',+ 'tests',+ 'deploys',+ 'teams',+ 'authors',+ 'teams/:ownerTeam',+ ].map((rest) => [`/engineering-analytics/repos/:repoOwner/:repoName/${rest}`, applyScope])+ )}),afterMount(({ actions, values }) => {actions.loadGithubSources()- // A scoped URL already refreshed through urlToAction, which runs before this hook.- if (!values.cardsLoading) {+ // A scoped URL already refreshed through urlToAction, which runs before this hook. A repo-less+ // product URL loads once repoScopeLogic forwards it, or once it finds nothing to forward to.+ if (!awaitsRepoForward() && !values.cardsLoading) {actions.refresh()}}),diff --git a/products/engineering_analytics/frontend/scenes/pullRequestDetailLogic.ts b/products/engineering_analytics/frontend/scenes/pullRequestDetailLogic.tsindex fe709b811068..c77d681d8f4a 100644--- a/products/engineering_analytics/frontend/scenes/pullRequestDetailLogic.ts+++ b/products/engineering_analytics/frontend/scenes/pullRequestDetailLogic.ts@@ -754,13 +754,17 @@ export const pullRequestDetailLogic = kea<pullRequestDetailLogicType>([{key: 'EngineeringAnalytics',name: 'Engineering analytics',- path: withScope(urls.engineeringAnalytics(), searchParams, sourceId),+ path: withScope(urls.engineeringAnalytics(`${repoOwner}/${repoName}`), searchParams, sourceId),iconType: 'health',},{key: 'EngineeringAnalyticsPullRequests',name: 'Pull requests',- path: withScope(urls.engineeringAnalyticsPullRequestList(), searchParams, sourceId),+ path: withScope(+ urls.engineeringAnalyticsPullRequestList(`${repoOwner}/${repoName}`),+ searchParams,+ sourceId+ ),iconType: 'health',},{diff --git a/products/engineering_analytics/frontend/scenes/pullRequestTimelinesLogic.ts b/products/engineering_analytics/frontend/scenes/pullRequestTimelinesLogic.tsindex 8ff7faa02161..a1bba2209ea5 100644--- a/products/engineering_analytics/frontend/scenes/pullRequestTimelinesLogic.ts+++ b/products/engineering_analytics/frontend/scenes/pullRequestTimelinesLogic.ts@@ -12,6 +12,8 @@ import { engineeringAnalyticsFiltersLogic } from './engineeringAnalyticsFiltersLexport interface PullRequestTimelinesLogicProps {scope: DeliveryScopesourceId: string | null+ /** The 'owner/name' in the page's path. */+ repo?: string | null}// Generated by kea-typegen. Update if you're an agent, ignore if you're human.@@ -71,7 +73,7 @@ export type pullRequestTimelinesLogicType = MakeLogicType<export const pullRequestTimelinesLogic = kea<pullRequestTimelinesLogicType>([path(['products', 'engineering_analytics', 'frontend', 'scenes', 'pullRequestTimelinesLogic']),props({} as PullRequestTimelinesLogicProps),- key((props) => `${deliveryScopeKey(props.scope)}@${props.sourceId ?? ''}`),+ key((props) => `${deliveryScopeKey(props.scope)}@${props.repo ?? ''}@${props.sourceId ?? ''}`),connect(() => ({values: [engineeringAnalyticsFiltersLogic, ['dateFrom', 'dateTo']],@@ -91,6 +93,7 @@ export const pullRequestTimelinesLogic = kea<pullRequestTimelinesLogicType>([date_from: values.dateFrom ?? undefined,date_to: values.dateTo ?? undefined,source_id: props.sourceId ?? undefined,+ repo: props.repo ?? undefined,}),},],diff --git a/products/engineering_analytics/frontend/scenes/repoOverviewLogic.ts b/products/engineering_analytics/frontend/scenes/repoOverviewLogic.tsindex ffd25ac395a8..109ba31855b2 100644--- a/products/engineering_analytics/frontend/scenes/repoOverviewLogic.ts+++ b/products/engineering_analytics/frontend/scenes/repoOverviewLogic.ts@@ -14,6 +14,7 @@ import { HUB_PREVIEW_MAX, HUB_PREVIEW_ROWS, HUB_PREVIEW_STEP } from '../lib/previmport { engineeringAnalyticsFiltersLogic } from './engineeringAnalyticsFiltersLogic'import {PullRequestRow,+ awaitsRepoForward,engineeringAnalyticsLogic,loaderStatusFromError,toPullRequestRow,@@ -315,6 +316,9 @@ export const repoOverviewLogic = kea<repoOverviewLogicType>([})),afterMount(({ actions }) => {+ if (awaitsRepoForward()) {+ return+ }actions.loadAttention()actions.loadOverview()actions.loadRepoActivity()diff --git a/products/engineering_analytics/frontend/scenes/repoScopeLogic.ts b/products/engineering_analytics/frontend/scenes/repoScopeLogic.tsnew file mode 100644index 000000000000..23b235dc548c--- /dev/null+++ b/products/engineering_analytics/frontend/scenes/repoScopeLogic.ts@@ -0,0 +1,202 @@+// Keeps the repository in the URL: forwards a repo-less product URL (old links, the product root) to a+// repository, and remembers the last repository used per project so the root reopens it.++import { MakeLogicType, actions, connect, kea, listeners, path, reducers, selectors } from 'kea'+import { loaders } from 'kea-loaders'+import { router, urlToAction } from 'kea-router'++import { ApiConfig } from 'lib/api'+import { removeProjectIdIfPresent } from 'lib/utils/kea-router'+import { teamLogic } from 'scenes/teamLogic'++import { engineeringAnalyticsSources } from '../generated/api'+import type { GitHubSourceApi } from '../generated/api.schemas'+import { pickForwardRepo, repoFromPath, repoPathFor } from '../lib/repoScope'++const projectId = (): string => String(ApiConfig.getCurrentProjectId())++// The repo-less paths that forward. A repo path never forwards.+const LEGACY_PATHS = [+ '/engineering-analytics/overview',+ '/engineering-analytics/pull-requests',+ '/engineering-analytics/workflows',+ '/engineering-analytics/tests',+ '/engineering-analytics/deploys',+ '/engineering-analytics/teams',+ '/engineering-analytics/authors',+ '/engineering-analytics/teams/:ownerTeam',+ '/engineering-analytics/authors/:handle',+]+const REPO_PATHS = [+ '/engineering-analytics/repos/:repoOwner/:repoName/overview',+ '/engineering-analytics/repos/:repoOwner/:repoName/pull-requests',+ '/engineering-analytics/repos/:repoOwner/:repoName/workflows',+ '/engineering-analytics/repos/:repoOwner/:repoName/tests',+ '/engineering-analytics/repos/:repoOwner/:repoName/deploys',+ '/engineering-analytics/repos/:repoOwner/:repoName/teams',+ '/engineering-analytics/repos/:repoOwner/:repoName/authors',+ '/engineering-analytics/repos/:repoOwner/:repoName/teams/:ownerTeam',+ '/engineering-analytics/repos/:repoOwner/:repoName/authors/:handle',+ '/engineering-analytics/repos/:repoOwner/:repoName/pull-requests/:number',+ '/engineering-analytics/repos/:repoOwner/:repoName/pull-requests/:number/ci-explorer',+ '/engineering-analytics/repos/:repoOwner/:repoName/actions/runs/:runId',+ '/engineering-analytics/repos/:repoOwner/:repoName/actions/workflows/:workflowName',+]++// Generated by kea-typegen. Update if you're an agent, ignore if you're human.+export interface repoScopeLogicValues {+ currentTeamId: number | null // teamLogic+ githubSources: GitHubSourceApi[] | null+ githubSourcesLoading: boolean+ lastRepo: string | null+ lastRepoByTeam: Record<string, string>+ pendingForward: boolean+}++// Generated by kea-typegen. Update if you're an agent, ignore if you're human.+export interface repoScopeLogicActions {+ clearPendingForward: () => {+ value: true+ }+ forwardToRepo: () => {+ value: true+ }+ loadGithubSources: () => any+ loadGithubSourcesFailure: (+ error: string,+ errorObject?: any+ ) => {+ error: string+ errorObject?: any+ }+ loadGithubSourcesSuccess: (+ githubSources: GitHubSourceApi[],+ payload?: any+ ) => {+ githubSources: GitHubSourceApi[]+ payload?: any+ }+ noRepoToForward: () => {+ value: true+ }+ rememberRepo: (+ teamId: number,+ repo: string+ ) => {+ repo: string+ teamId: number+ }+}++// Generated by kea-typegen. Update if you're an agent, ignore if you're human.+export interface repoScopeLogicMeta {+ __keaTypeGenInternalSelectorTypes: {+ lastRepo: (lastRepoByTeam: Record<string, string>, currentTeamId: number | null) => string | null+ }+}++export type repoScopeLogicType = MakeLogicType<+ repoScopeLogicValues,+ repoScopeLogicActions,+ Record<string, any>,+ repoScopeLogicMeta+>++export const repoScopeLogic = kea<repoScopeLogicType>([+ path(['products', 'engineering_analytics', 'frontend', 'scenes', 'repoScopeLogic']),+ connect(() => ({+ values: [teamLogic, ['currentTeamId']],+ })),++ actions({+ forwardToRepo: true,+ clearPendingForward: true,+ // Nothing to forward to: the repo-less page stays and loads its own connect or empty state.+ noRepoToForward: true,+ rememberRepo: (teamId: number, repo: string) => ({ teamId, repo }),+ }),++ loaders({+ githubSources: [+ null as GitHubSourceApi[] | null,+ {+ loadGithubSources: async (): Promise<GitHubSourceApi[]> =>+ await engineeringAnalyticsSources(projectId()),+ },+ ],+ }),++ reducers({+ lastRepoByTeam: [+ {} as Record<string, string>,+ { persist: true, prefix: 'engineering_analytics_' },+ { rememberRepo: (state, { teamId, repo }) => ({ ...state, [teamId]: repo }) },+ ],+ // A forward asked for before the repository list loaded waits for it.+ pendingForward: [false, { forwardToRepo: () => true, clearPendingForward: () => false }],+ }),++ selectors({+ lastRepo: [+ (s) => [s.lastRepoByTeam, s.currentTeamId],+ (lastRepoByTeam: Record<string, string>, currentTeamId: number | null): string | null =>+ currentTeamId ? (lastRepoByTeam[currentTeamId] ?? null) : null,+ ],+ }),++ listeners(({ actions, values }) => {+ const forward = (): void => {+ actions.clearPendingForward()+ const pathname = removeProjectIdIfPresent(router.values.location.pathname)+ // The person may have moved on while the repository list loaded.+ if (!pathname.startsWith('/engineering-analytics/') || repoFromPath(pathname)) {+ return+ }+ const { repo, source, ...searchParams } = router.values.searchParams+ const target = pickForwardRepo(values.githubSources ?? [], { repo, sourceId: source }, values.lastRepo)+ // Nothing connected, or only a legacy source with no repository name.+ if (!target) {+ actions.noRepoToForward()+ return+ }+ router.actions.replace(+ repoPathFor(pathname, target),+ source ? { ...searchParams, source } : searchParams,+ router.values.hashParams+ )+ }+ return {+ forwardToRepo: () => {+ if (values.githubSources) {+ forward()+ } else if (!values.githubSourcesLoading) {+ actions.loadGithubSources()+ }+ },+ loadGithubSourcesSuccess: () => {+ if (values.pendingForward) {+ forward()+ }+ },+ loadGithubSourcesFailure: () => {+ actions.clearPendingForward()+ actions.noRepoToForward()+ },+ }+ }),++ urlToAction(({ actions, values }) => ({+ ...Object.fromEntries(LEGACY_PATHS.map((pattern) => [pattern, () => actions.forwardToRepo()])),+ ...Object.fromEntries(+ REPO_PATHS.map((pattern) => [+ pattern,+ ({ repoOwner, repoName }: Record<string, string | undefined>) => {+ const repo = `${repoOwner}/${repoName}`+ if (values.currentTeamId && values.lastRepo !== repo) {+ actions.rememberRepo(values.currentTeamId, repo)+ }+ },+ ])+ ),+ })),+])diff --git a/products/engineering_analytics/frontend/scenes/teamDetailLogic.test.ts b/products/engineering_analytics/frontend/scenes/teamDetailLogic.test.tsindex 03fceca898ef..700d3f957d0c 100644--- a/products/engineering_analytics/frontend/scenes/teamDetailLogic.test.ts+++ b/products/engineering_analytics/frontend/scenes/teamDetailLogic.test.ts@@ -93,10 +93,10 @@ describe('teamDetailLogic', () => {unmountFilters = undefined})- it('reloads team CI health and merge trend for the shared date range', async () => {+ it('reloads team CI health and merge trend for the shared date range, in the repo it shows', async () => {const filters = engineeringAnalyticsFiltersLogic()unmountFilters = filters.mount()- logic = teamDetailLogic({ ownerTeam: 'team-replay', sourceId: 'source-1' })+ logic = teamDetailLogic({ ownerTeam: 'team-replay', sourceId: 'source-1', repo: 'PostHog/posthog-js' })logic.mount()await expectLogic(logic).toDispatchActionsInAnyOrder([@@ -115,12 +115,14 @@ describe('teamDetailLogic', () => {owner_team: 'team-replay',limit: 1,source_id: 'source-1',+ repo: 'PostHog/posthog-js',})expect(mockMergeTrend).toHaveBeenLastCalledWith('1', {owner_team: 'team-replay',date_from: '2026-06-01',date_to: '2026-06-30',source_id: 'source-1',+ repo: 'PostHog/posthog-js',})expect(mockActivity).toHaveBeenCalledTimes(1)})@@ -132,7 +134,7 @@ describe('teamDetailLogic', () => {const filters = engineeringAnalyticsFiltersLogic()unmountFilters = filters.mount()filters.actions.setDateRange(dateFrom, dateTo)- logic = teamDetailLogic({ ownerTeam: 'team-replay', sourceId: 'source-1' })+ logic = teamDetailLogic({ ownerTeam: 'team-replay', sourceId: 'source-1', repo: null })logic.mount()await expectLogic(logic).toDispatchActionsInAnyOrder(['loadHealthRowSuccess', 'loadMergeTrendSuccess'])diff --git a/products/engineering_analytics/frontend/scenes/teamDetailLogic.ts b/products/engineering_analytics/frontend/scenes/teamDetailLogic.tsindex d68bd136096f..76b4e2d9c3d3 100644--- a/products/engineering_analytics/frontend/scenes/teamDetailLogic.ts+++ b/products/engineering_analytics/frontend/scenes/teamDetailLogic.ts@@ -37,6 +37,8 @@ const projectId = (): string => String(ApiConfig.getCurrentProjectId())export interface TeamDetailLogicProps {ownerTeam: stringsourceId: string | null+ /** The 'owner/name' from the path. Every figure on the page is this repository's. */+ repo: string | null}export interface TeamTestSignalRow {@@ -86,6 +88,7 @@ export interface teamDetailLogicValues {mergeTrendStatus: LoaderStatusownerTeam: stringquarantinedTests: TrunkQuarantinedTestRow[]+ repo: string | nullsourceId: string | null}@@ -154,12 +157,18 @@ export interface teamDetailLogicMeta {__keaTypeGenInternalSelectorTypes: {ownerTeam: (ownerTeam: string) => stringsourceId: (sourceId: string | null) => string | null+ repo: (repo: string | null) => string | nulldeliveryScope: (ownerTeam: string) => DeliveryScope | nullquarantinedTests: (trunkQuarantineTestsByTeam: Record<string, TrunkQuarantinedTestRow[]>,ownerTeam: string) => TrunkQuarantinedTestRow[]- breadcrumbs: (ownerTeam: string, sourceId: string | null, searchParams: Record<string, any>) => Breadcrumb[]+ breadcrumbs: (+ ownerTeam: string,+ repo: string | null,+ sourceId: string | null,+ searchParams: Record<string, any>+ ) => Breadcrumb[]mergeTrendSeries: (mergeTrend: TeamMergeTrendData | null) => {average: number[]labels: string[]@@ -178,7 +187,7 @@ export type teamDetailLogicType = MakeLogicType<export const teamDetailLogic = kea<teamDetailLogicType>([path(['products', 'engineering_analytics', 'frontend', 'scenes', 'teamDetailLogic']),props({} as TeamDetailLogicProps),- key((props) => `${props.ownerTeam}@${props.sourceId ?? ''}`),+ key((props) => `${props.ownerTeam}@${props.repo ?? ''}@${props.sourceId ?? ''}`),connect(() => ({values: [@@ -204,6 +213,7 @@ export const teamDetailLogic = kea<teamDetailLogicType>([owner_team: props.ownerTeam,date_from: DEFAULT_TEAMS_WINDOW,source_id: props.sourceId ?? undefined,+ repo: props.repo ?? undefined,})return {tests: data.tests.map((t) => ({@@ -228,6 +238,7 @@ export const teamDetailLogic = kea<teamDetailLogicType>([owner_team: props.ownerTeam,limit: 1,source_id: props.sourceId ?? undefined,+ repo: props.repo ?? undefined,})const item = data.items[0]return item ? toTeamCIHealthRow(item) : null@@ -247,6 +258,7 @@ export const teamDetailLogic = kea<teamDetailLogicType>([date_from: values.dateFrom ?? DEFAULT_TEAMS_WINDOW,date_to: values.dateTo ?? undefined,source_id: props.sourceId ?? undefined,+ repo: props.repo ?? undefined,})return {hasMembershipData: data.has_membership_data,@@ -289,6 +301,7 @@ export const teamDetailLogic = kea<teamDetailLogicType>([selectors({ownerTeam: [(_, p) => [p.ownerTeam], (ownerTeam: string) => ownerTeam],sourceId: [(_, p) => [p.sourceId], (sourceId: string | null) => sourceId],+ repo: [(_, p) => [p.repo], (repo: string | null) => repo],/** owners.yaml team names are GitHub team slugs (checked by `hogli owners:lint --live`). Null for* unowned surfaces, which have no GitHub team. */deliveryScope: [@@ -304,22 +317,23 @@ export const teamDetailLogic = kea<teamDetailLogicType>([): TrunkQuarantinedTestRow[] => trunkQuarantineTestsByTeam[ownerTeam] ?? [],],breadcrumbs: [- (s) => [s.ownerTeam, s.sourceId, router.selectors.searchParams],+ (s) => [s.ownerTeam, s.repo, s.sourceId, router.selectors.searchParams],(ownerTeam: string,+ repo: string | null,sourceId: string | null,searchParams: Record<string, string | undefined>): Breadcrumb[] => [{key: 'EngineeringAnalytics',name: 'Engineering analytics',- path: withScope(urls.engineeringAnalytics(), searchParams, sourceId),+ path: withScope(urls.engineeringAnalytics(repo), searchParams, sourceId),iconType: 'health',},{key: 'EngineeringAnalyticsTeams',name: 'Teams',- path: withScope(urls.engineeringAnalyticsTeams(), searchParams, sourceId),+ path: withScope(urls.engineeringAnalyticsTeams(repo), searchParams, sourceId),iconType: 'health',},{diff --git a/products/engineering_analytics/frontend/scenes/teamsLogic.ts b/products/engineering_analytics/frontend/scenes/teamsLogic.tsindex 495d2832883d..7ef346643960 100644--- a/products/engineering_analytics/frontend/scenes/teamsLogic.ts+++ b/products/engineering_analytics/frontend/scenes/teamsLogic.ts@@ -7,7 +7,12 @@ import { dateMapping } from 'lib/utils/dateFilters'import { engineeringAnalyticsTeamCiHealth } from '../generated/api'import type { TeamCIHealthItemApi } from '../generated/api.schemas'-import { LoaderStatus, engineeringAnalyticsLogic, loaderStatusFromError } from './engineeringAnalyticsLogic'+import {+ LoaderStatus,+ awaitsRepoForward,+ engineeringAnalyticsLogic,+ loaderStatusFromError,+} from './engineeringAnalyticsLogic'const projectId = (): string => String(ApiConfig.getCurrentProjectId())@@ -89,6 +94,7 @@ export function toTeamCIHealthRow(it: TeamCIHealthItemApi): TeamCIHealthRow {// Generated by kea-typegen. Update if you're an agent, ignore if you're human.export interface teamsLogicValues {+ scopeRepo: string | null // engineeringAnalyticsLogicsourceId: string | null // engineeringAnalyticsLogicteams: TeamsData | nullteamsFailed: boolean@@ -99,10 +105,10 @@ export interface teamsLogicValues {// Generated by kea-typegen. Update if you're an agent, ignore if you're human.export interface teamsLogicActions {- setSourceId: (sourceId: string | null) => {- sourceId: string | null+ refresh: () => {+ value: true} // engineeringAnalyticsLogic- loadTeams: () => any+ loadTeams: (_: void) => voidloadTeamsFailure: (error: string,errorObject?: any@@ -112,10 +118,10 @@ export interface teamsLogicActions {}loadTeamsSuccess: (teams: TeamsData,- payload?: any+ payload?: void) => {teams: TeamsData- payload?: any+ payload?: void}}@@ -132,18 +138,21 @@ export type teamsLogicType = MakeLogicType<teamsLogicValues, teamsLogicActions,export const teamsLogic = kea<teamsLogicType>([path(['products', 'engineering_analytics', 'frontend', 'scenes', 'teamsLogic']),connect(() => ({- values: [engineeringAnalyticsLogic, ['sourceId']],- actions: [engineeringAnalyticsLogic, ['setSourceId']],+ values: [engineeringAnalyticsLogic, ['sourceId', 'scopeRepo']],+ actions: [engineeringAnalyticsLogic, ['refresh']],})),loaders(({ values }) => ({teams: [null as TeamsData | null,{- loadTeams: async (): Promise<TeamsData> => {+ loadTeams: async (_: void, breakpoint): Promise<TeamsData> => {const data = await engineeringAnalyticsTeamCiHealth(projectId(), {date_from: DEFAULT_TEAMS_WINDOW,source_id: values.sourceId ?? undefined,+ repo: values.scopeRepo ?? undefined,})+ // A repository switch starts a new load; drop this response if one did.+ breakpoint()return {rows: data.items.map(toTeamCIHealthRow),truncated: data.truncated,@@ -168,9 +177,12 @@ export const teamsLogic = kea<teamsLogicType>([teamsNotConnected: [(s) => [s.teamsStatus], (status: LoaderStatus): boolean => status === 'notConnected'],}),listeners(({ actions }) => ({- setSourceId: () => actions.loadTeams(),+ // engineeringAnalyticsLogic refreshes on every source or repo change and after a repo-less forward.+ refresh: () => actions.loadTeams(),})),afterMount(({ actions }) => {- actions.loadTeams()+ if (!awaitsRepoForward()) {+ actions.loadTeams()+ }}),])diff --git a/products/engineering_analytics/frontend/scenes/timeToProductionLogic.ts b/products/engineering_analytics/frontend/scenes/timeToProductionLogic.tsindex 837d14fe5037..f0fc5b68df37 100644--- a/products/engineering_analytics/frontend/scenes/timeToProductionLogic.ts+++ b/products/engineering_analytics/frontend/scenes/timeToProductionLogic.ts@@ -6,7 +6,7 @@ import { ApiConfig } from 'lib/api'import { engineeringAnalyticsRepoOverview } from '../generated/api'import type { RepoOverviewApi } from '../generated/api.schemas'import { engineeringAnalyticsFiltersLogic } from './engineeringAnalyticsFiltersLogic'-import { engineeringAnalyticsLogic } from './engineeringAnalyticsLogic'+import { awaitsRepoForward, engineeringAnalyticsLogic } from './engineeringAnalyticsLogic'const projectId = (): string => String(ApiConfig.getCurrentProjectId())@@ -92,6 +92,8 @@ export const timeToProductionLogic = kea<timeToProductionLogicType>([})),afterMount(({ actions }) => {- actions.loadTiming()+ if (!awaitsRepoForward()) {+ actions.loadTiming()+ }}),])diff --git a/products/engineering_analytics/frontend/scenes/workflowRunDetailLogic.test.ts b/products/engineering_analytics/frontend/scenes/workflowRunDetailLogic.test.tsindex e26dc81091f8..d8c355350d80 100644--- a/products/engineering_analytics/frontend/scenes/workflowRunDetailLogic.test.ts+++ b/products/engineering_analytics/frontend/scenes/workflowRunDetailLogic.test.ts@@ -92,7 +92,6 @@ describe('workflowRunDetailLogic', () => {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',@@ -122,19 +121,16 @@ describe('workflowRunDetailLogic', () => {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.tsindex 057d4d89d7bb..163e9526dd05 100644--- a/products/engineering_analytics/frontend/scenes/workflowRunDetailLogic.ts+++ b/products/engineering_analytics/frontend/scenes/workflowRunDetailLogic.ts@@ -223,13 +223,17 @@ export const workflowRunDetailLogic = kea<workflowRunDetailLogicType>([{key: 'EngineeringAnalytics',name: 'Engineering analytics',- path: withScope(urls.engineeringAnalytics(), searchParams, sourceId),+ path: withScope(urls.engineeringAnalytics(`${repoOwner}/${repoName}`), searchParams, sourceId),iconType: 'health',},{key: 'EngineeringAnalyticsWorkflows',name: 'Workflows',- path: withScope(urls.engineeringAnalyticsWorkflows(), searchParams, sourceId),+ path: withScope(+ urls.engineeringAnalyticsWorkflows(`${repoOwner}/${repoName}`),+ searchParams,+ sourceId+ ),iconType: 'health',},]diff --git a/products/engineering_analytics/frontend/scenes/workflowRunsLogic.ts b/products/engineering_analytics/frontend/scenes/workflowRunsLogic.tsindex caa98eb0a140..ccf8d52052d9 100644--- a/products/engineering_analytics/frontend/scenes/workflowRunsLogic.ts+++ b/products/engineering_analytics/frontend/scenes/workflowRunsLogic.ts@@ -577,13 +577,17 @@ export const workflowRunsLogic = kea<workflowRunsLogicType>([{key: 'EngineeringAnalytics',name: 'Engineering analytics',- path: withScope(urls.engineeringAnalytics(), searchParams, sourceId),+ path: withScope(urls.engineeringAnalytics(`${repoOwner}/${repoName}`), searchParams, sourceId),iconType: 'health',},{key: 'EngineeringAnalyticsWorkflows',name: 'Workflows',- path: withScope(urls.engineeringAnalyticsWorkflows(), searchParams, sourceId),+ path: withScope(+ urls.engineeringAnalyticsWorkflows(`${repoOwner}/${repoName}`),+ searchParams,+ sourceId+ ),iconType: 'health',},{diff --git a/products/engineering_analytics/manifest.tsx b/products/engineering_analytics/manifest.tsxindex b069fef5e63e..33c81765c7bc 100644--- a/products/engineering_analytics/manifest.tsx+++ b/products/engineering_analytics/manifest.tsx@@ -68,10 +68,12 @@ export const manifest: ProductManifest = {iconType: 'health',},},- // Detail paths follow GitHub's REST-API shape (repos/:owner/:repo/pull-requests/:n, .../actions/runs/:id)- // — a repos/ prefix that keeps them clear of the tab routes and readable collection nouns. Cross-repo- // aggregates stay at the product root. Provider lives on the data (RepoRef.provider), so these url- // builders are the single place to branch verbs for a future provider (e.g. GitLab).+ // Every page reads one repository, so the repository is a path segment on every page, shaped like+ // GitHub's REST API (repos/:owner/:repo/pull-requests/:n, .../actions/runs/:id). The repo-less tab+ // paths still route: the scene logic forwards them to a repository (the `?repo` they carry, else the+ // last one used, else the default), so old links and the product root keep working. Provider lives on+ // the data (RepoRef.provider), so these url builders are the single place to branch verbs for a+ // future provider (e.g. GitLab).routes: {'/engineering-analytics/overview': ['EngineeringAnalytics', 'engineeringAnalytics'],'/engineering-analytics/pull-requests': ['EngineeringAnalytics', 'engineeringAnalyticsPullRequestList'],@@ -81,6 +83,40 @@ export const manifest: ProductManifest = {'/engineering-analytics/authors': ['EngineeringAnalytics', 'engineeringAnalyticsAuthors'],'/engineering-analytics/deploys': ['EngineeringAnalytics', 'engineeringAnalyticsDeploys'],'/engineering-analytics/teams/:ownerTeam': ['EngineeringAnalyticsTeam', 'engineeringAnalyticsTeam'],+ '/engineering-analytics/authors/:handle': ['EngineeringAnalyticsAuthor', 'engineeringAnalyticsAuthor'],+ '/engineering-analytics/repos/:repoOwner/:repoName/overview': ['EngineeringAnalytics', 'engineeringAnalytics'],+ '/engineering-analytics/repos/:repoOwner/:repoName/pull-requests': [+ 'EngineeringAnalytics',+ 'engineeringAnalyticsPullRequestList',+ ],+ '/engineering-analytics/repos/:repoOwner/:repoName/workflows': [+ 'EngineeringAnalytics',+ 'engineeringAnalyticsWorkflows',+ ],+ '/engineering-analytics/repos/:repoOwner/:repoName/tests': [+ 'EngineeringAnalytics',+ 'engineeringAnalyticsTests',+ ],+ '/engineering-analytics/repos/:repoOwner/:repoName/teams': [+ 'EngineeringAnalytics',+ 'engineeringAnalyticsTeams',+ ],+ '/engineering-analytics/repos/:repoOwner/:repoName/authors': [+ 'EngineeringAnalytics',+ 'engineeringAnalyticsAuthors',+ ],+ '/engineering-analytics/repos/:repoOwner/:repoName/deploys': [+ 'EngineeringAnalytics',+ 'engineeringAnalyticsDeploys',+ ],+ '/engineering-analytics/repos/:repoOwner/:repoName/teams/:ownerTeam': [+ 'EngineeringAnalyticsTeam',+ 'engineeringAnalyticsTeam',+ ],+ '/engineering-analytics/repos/:repoOwner/:repoName/authors/:handle': [+ 'EngineeringAnalyticsAuthor',+ 'engineeringAnalyticsAuthor',+ ],'/engineering-analytics/repos/:repoOwner/:repoName/pull-requests/:number': ['EngineeringAnalyticsPullRequest','engineeringAnalyticsPullRequest',@@ -97,7 +133,6 @@ export const manifest: ProductManifest = {'EngineeringAnalyticsWorkflowRuns','engineeringAnalyticsWorkflowRuns',],- '/engineering-analytics/authors/:handle': ['EngineeringAnalyticsAuthor', 'engineeringAnalyticsAuthor'],},redirects: {// Bare product root lands on the overview tab without dropping its scope.@@ -108,16 +143,40 @@ export const manifest: ProductManifest = {'/engineering-analytics/health': (_params, searchParams, hashParams): string =>combineUrl(urls.engineeringAnalyticsDeploys(), searchParams, hashParams).url,},+ // Tab and team/author builders take the 'owner/name' in scope. Without one they return the repo-less+ // path, which forwards to a repository, so a caller outside the product never has to pick one.+ // The paths are written out because the app URL catalog evaluates these builders without imports.urls: {- engineeringAnalytics: (): string => '/engineering-analytics/overview',- engineeringAnalyticsPullRequestList: (): string => '/engineering-analytics/pull-requests',- engineeringAnalyticsWorkflows: (): string => '/engineering-analytics/workflows',- engineeringAnalyticsTests: (): string => '/engineering-analytics/tests',- engineeringAnalyticsTeams: (): string => '/engineering-analytics/teams',- engineeringAnalyticsAuthors: (): string => '/engineering-analytics/authors',- engineeringAnalyticsDeploys: (): string => '/engineering-analytics/deploys',- engineeringAnalyticsTeam: (ownerTeam: string): string =>- `/engineering-analytics/teams/${encodeURIComponent(ownerTeam)}`,+ engineeringAnalytics: (repo?: string | null): string =>+ repo+ ? `/engineering-analytics/repos/${repo.split('/').map(encodeURIComponent).join('/')}/overview`+ : '/engineering-analytics/overview',+ engineeringAnalyticsPullRequestList: (repo?: string | null): string =>+ repo+ ? `/engineering-analytics/repos/${repo.split('/').map(encodeURIComponent).join('/')}/pull-requests`+ : '/engineering-analytics/pull-requests',+ engineeringAnalyticsWorkflows: (repo?: string | null): string =>+ repo+ ? `/engineering-analytics/repos/${repo.split('/').map(encodeURIComponent).join('/')}/workflows`+ : '/engineering-analytics/workflows',+ engineeringAnalyticsTests: (repo?: string | null): string =>+ repo+ ? `/engineering-analytics/repos/${repo.split('/').map(encodeURIComponent).join('/')}/tests`+ : '/engineering-analytics/tests',+ engineeringAnalyticsTeams: (repo?: string | null): string =>+ repo+ ? `/engineering-analytics/repos/${repo.split('/').map(encodeURIComponent).join('/')}/teams`+ : '/engineering-analytics/teams',+ engineeringAnalyticsAuthors: (repo?: string | null): string =>+ repo+ ? `/engineering-analytics/repos/${repo.split('/').map(encodeURIComponent).join('/')}/authors`+ : '/engineering-analytics/authors',+ engineeringAnalyticsDeploys: (repo?: string | null): string =>+ repo+ ? `/engineering-analytics/repos/${repo.split('/').map(encodeURIComponent).join('/')}/deploys`+ : '/engineering-analytics/deploys',+ engineeringAnalyticsTeam: (ownerTeam: string, repo?: string | null): string =>+ `${repo ? `/engineering-analytics/repos/${repo.split('/').map(encodeURIComponent).join('/')}` : '/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 =>@@ -131,8 +190,8 @@ export const manifest: ProductManifest = {`/engineering-analytics/repos/${encodeURIComponent(repoOwner)}/${encodeURIComponent(repoName)}/actions/runs/${runId}${ciEngine ? `?ci_engine=${encodeURIComponent(ciEngine)}` : ''}`,engineeringAnalyticsWorkflowRuns: (repoOwner: string, repoName: string, workflowName: string): string =>`/engineering-analytics/repos/${encodeURIComponent(repoOwner)}/${encodeURIComponent(repoName)}/actions/workflows/${encodeURIComponent(workflowName)}`,- engineeringAnalyticsAuthor: (handle: string): string =>- `/engineering-analytics/authors/${encodeURIComponent(handle)}`,+ engineeringAnalyticsAuthor: (handle: string, repo?: string | null): string =>+ `${repo ? `/engineering-analytics/repos/${repo.split('/').map(encodeURIComponent).join('/')}` : '/engineering-analytics'}/authors/${encodeURIComponent(handle)}`,},fileSystemTypes: {},treeItemsNew: [],