Skip to content

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

fix(eng-analytics): resolve team tab ownership via owners.yaml (#92023)

Raúl Negrón-Otero616a62c0e93c
diff --git a/.github/scripts/report_test_timings.py b/.github/scripts/report_test_timings.py
index d77081983129..a71377a8de6f 100644
--- a/.github/scripts/report_test_timings.py
+++ b/.github/scripts/report_test_timings.py
@@ -313,6 +313,22 @@ def jest_root_for_suite(suite: str) -> str:
return "frontend"
+def normalize_pytest_file(file: str) -> str:
+ """Keep a pytest JUnit ``file`` attribute only when it stays inside the repo.
+
+ pytest reports the decorator's own source file for tests wrapped in ``mock.patch``,
+ ``freeze_time``, or ``parameterized``, which arrives as a path into site-packages
+ (``../../../opt/.../unittest/mock.py``). Such a path can never resolve an owner, so it is
+ discarded here and the caller falls back to inferring the file from the JUnit classname.
+ """
+ if not file:
+ return ""
+ normalized = posixpath.normpath(file.replace("\\", "/"))
+ if normalized == ".." or normalized.startswith(("../", "/")):
+ return ""
+ return normalized
+
+
def infer_pytest_file(classname: str) -> str:
"""Find a safe pytest file path from a JUnit classname."""
parts = classname.split(".")
@@ -340,8 +356,9 @@ def test_identity(
file_source: Literal["junit", "inferred", "missing"] = "junit" if normalized_file else "missing"
return normalized_file, selector or name, selector, file_source
- normalized_file = file or infer_pytest_file(classname)
- file_source = "junit" if file else "inferred" if normalized_file else "missing"
+ junit_file = normalize_pytest_file(file)
+ normalized_file = junit_file or infer_pytest_file(classname)
+ file_source = "junit" if junit_file else "inferred" if normalized_file else "missing"
return (
normalized_file,
to_pytest_nodeid(classname, name),
@@ -791,7 +808,9 @@ def owner_team_lookup() -> Callable[[str], str]:
losing the emit.
"""
try:
- resolver = OwnersResolver()
+ # The explicit root skips the resolver's own `git rev-parse`, whose failure would
+ # silently unown every span in the run.
+ resolver = OwnersResolver(REPO_ROOT)
except Exception:
logger.exception("owners resolver unavailable; emitting spans without team attribution")
return lambda _file: ""
@@ -805,7 +824,9 @@ def owner_team_lookup() -> Callable[[str], str]:
except Exception:
logger.exception("owners resolution failed for %s; emitting span without team attribution", file)
return ""
- return owners[0] if owners else ""
+ # An `@handle` first owner is a person, not a team; stamping it would mint a
+ # one-person "team" in every per-team rollup.
+ return next((owner for owner in owners or [] if not owner.startswith("@")), "")
return lookup
diff --git a/.github/scripts/test_report_test_timings.py b/.github/scripts/test_report_test_timings.py
index d08f50daafaa..5c17265e3133 100644
--- a/.github/scripts/test_report_test_timings.py
+++ b/.github/scripts/test_report_test_timings.py
@@ -120,8 +120,17 @@ def test_find_repo_root_walks_to_repository_markers(tmp_path: Path) -> None:
assert report_test_timings.find_repo_root(script) == repo_root
-def test_test_identity_infers_existing_pytest_file_when_junit_omits_it(
- tmp_path: Path, monkeypatch: pytest.MonkeyPatch
+ "junit_file",
+ [
+ "",
+ # pytest reports the decorator's own file for tests wrapped in mock.patch/freeze_time/
+ # parameterized; a path escaping the repo must fall back to classname inference.
+ "../../../../../opt/hostedtoolcache/Python/3.13.13/x64/lib/python3.13/unittest/mock.py",
+ ],
+)
+def test_test_identity_infers_existing_pytest_file_when_junit_is_unusable(
+ tmp_path: Path, monkeypatch: pytest.MonkeyPatch, junit_file: str
) -> None:
test_file = tmp_path / "products/approvals/backend/tests/test_approvals_api.py"
test_file.parent.mkdir(parents=True)
@@ -130,7 +139,7 @@ def test_test_identity_infers_existing_pytest_file_when_junit_omits_it(
file, nodeid, selector, file_source = report_test_timings.test_identity(
"pytest",
- "",
+ junit_file,
"products.approvals.backend.tests.test_approvals_api.TestApprovalsFeatureGating",
"test_accessible",
)
@@ -806,6 +815,22 @@ def test_emit_shard_span_stamps_owner_team_only_for_owned_files(monkeypatch: pyt
assert "test.owner_team" not in tracer.spans[2].attributes
+def test_owner_team_lookup_skips_individual_handle_owners(monkeypatch: pytest.MonkeyPatch) -> None:
+ class _FakeResolution:
+ owners = ["@someone", "team-devex"]
+
+ class _FakeResolver:
+ def __init__(self, repo_root: Path) -> None:
+ pass
+
+ def resolve(self, file: str) -> _FakeResolution:
+ return _FakeResolution()
+
+ monkeypatch.setattr(report_test_timings, "OwnersResolver", _FakeResolver)
+
+ assert report_test_timings.owner_team_lookup()("products/x/test_a.py") == "team-devex"
+
+
def test_product_shard_derives_product_suite_and_keeps_repo_relative_paths(
tmp_path: Path, monkeypatch: pytest.MonkeyPatch
) -> None:
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index ac7be593d607..5421589db95a 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -6632,6 +6632,10 @@ snapshots:
hash: v1.k794b7964.7f17c5ac7c6862493f7c4d59e6e3c3146c42e3d7b08908ee1716d387c129ba64.lPsE9KrOSZee9wJq8zjqYnvk09numvEFWOn4mdCOgJE
scenes-app-engineering-analytics-run-activity-chart--default--light:
hash: v1.k794b7964.f63752ff3ebf3bbee3be4ddc83d1ff657d9cdd11ee71e7283c30ce5a1aefde72.yTb8kpRqcG51TbM2CqgRmC5YvgE7-6pV1Trc7y5wuto
+ scenes-app-engineering-analytics-teams--team-ci-health-roster--dark:
+ hash: v1.k794b7964.10bc7ae302cfe76b44f0efc6417a03f865126fb7fb3139d81615bcef2b13a3fb.islcHyz6-MSRZdmYI6AFJYKK-g28eAo3AtiL1jGemvE
+ scenes-app-engineering-analytics-teams--team-ci-health-roster--light:
+ hash: v1.k794b7964.86bf01dd65cb6a52cf1ec21ab03e88bad821ca3bbf96727513ac58b50f1dabbb.yveewhKz1q_fJNGD9YDmxy__v0lpk1rOrrO6rhtc-JM
scenes-app-engineering-analytics-test-health--trunk-quarantine-debt--dark:
hash: v1.k794b7964.1bf2a96d4a8f8875fc554a67e7e7b28adc98b144607babe0ae8342de5a0f3edc.JM5CCK4syW_o4_XReB3Nn6NUpB0I643u2a05XZmoeck
scenes-app-engineering-analytics-test-health--trunk-quarantine-debt--light:
diff --git a/products/engineering_analytics/SPEC.md b/products/engineering_analytics/SPEC.md
index 0b5e6417781a..65c9a376bfa9 100644
--- a/products/engineering_analytics/SPEC.md
+++ b/products/engineering_analytics/SPEC.md
@@ -158,7 +158,7 @@ Engineering-specific decisions. Product-level decisions live in README → Locke
- **Bot detection, defined once:** `handle.endswith("[bot]") OR handle in KNOWN_BOT_HANDLES`. Hardcoded allowlist; per-team config deferred.
- **Bots and drafts excluded by default** in throughput / cycle-time reads; first-class in bot-impact analysis, so never strip them at the substrate.
- **Time to merge** = `open_to_merge_seconds` = `merged_at - created_at`, coarse (draft + ready combined). The precise companion is `ready_to_merge_seconds` = `merged_at` minus the last observed `ready_for_review` issue event (only the last draft/ready switch counts; a draft can't merge), falling back to `created_at` for a merged PR verifiably never drafted (no transition rows and its whole open-to-merge span inside the observed issue-event window, so the transitions can't merely be unsynced). NULL means "not observed", never zero: GitHub caps the issue-events history walk, so coverage grows forward from the first sync.
-- **Team ownership is stamped at CI emission time, never mirrored server-side.** The CI emitter stamps `test.owner_team` from the repo's ownership map (`products/*/product.yaml` + CODEOWNERS, first listed owner); unstamped spans aggregate as the first-class team `unowned`. Capture-time truth is intentional: a test belongs to whoever owned it when it flaked. Team surfaces stay team-level: author→team joins (via the `team_members` snapshot) produce aggregates only, never per-member figures or cross-team rankings; a slug mismatch yields an empty series, never another team's data.
+- **Team ownership is stamped at CI emission time, never mirrored server-side.** The CI emitter stamps `test.owner_team` through `posthog_owners` (the repo's distributed `owners.yaml` files, with `products/*/product.yaml` as an alias; first listed team owner, individual `@handle` owners skipped); unstamped spans aggregate as the first-class team `unowned`. Capture-time truth is intentional: a test belongs to whoever owned it when it flaked. Team surfaces stay team-level: author→team joins (via the `team_members` snapshot) produce aggregates only, never per-member figures or cross-team rankings; a slug mismatch yields an empty series, never another team's data.
- **No provider abstraction until a second code host lands.** GitHub-isms stay below the builder boundary, canonical types above it; that seam makes extracting a `CodeHostProvider` Protocol mechanical.
## 7. Data sources
diff --git a/products/engineering_analytics/backend/logic/queries/_test_spans.py b/products/engineering_analytics/backend/logic/queries/_test_spans.py
index e7283a3bac7d..f51284e6a1b4 100644
--- a/products/engineering_analytics/backend/logic/queries/_test_spans.py
+++ b/products/engineering_analytics/backend/logic/queries/_test_spans.py
@@ -152,7 +152,13 @@ _SCAN_TEMPLATE = """
name AS nodeid,
attributes['test.selector'] AS selector,
attributes['test.outcome'] AS outcome,
- coalesce(nullIf(attributes['test.owner_team'], ''), {unowned_team}) AS owner_team,
+ -- An '@handle' stamp is a person from an owners.yaml first slot, not a team; older
+ -- spans carry them, so fold them into the unowned bucket instead of minting a row.
+ if(
+ startsWith(coalesce(attributes['test.owner_team'], ''), '@'),
+ {unowned_team},
+ coalesce(nullIf(attributes['test.owner_team'], ''), {unowned_team})
+ ) AS owner_team,
if(__QUEUE_PR__ != '', __QUEUE_PR__, resource_attributes['ci.pr_number']) AS pr_number,
resource_attributes['ci.branch'] AS branch,
-- The emitter always stamps ci.run_id; the trace_id fallback (one trace per job) keeps an
diff --git a/products/engineering_analytics/backend/logic/queries/team_ci_health.py b/products/engineering_analytics/backend/logic/queries/team_ci_health.py
index e5e4e67ffd34..a2ec52541631 100644
--- a/products/engineering_analytics/backend/logic/queries/team_ci_health.py
+++ b/products/engineering_analytics/backend/logic/queries/team_ci_health.py
@@ -1,8 +1,9 @@
"""HogQL rollups of per-test CI spans by owning team.
Ownership is stamped on the spans at emission time: the CI reporter resolves each test's
-file path against the repo's ownership map (``products/*/product.yaml`` + CODEOWNERS) and
-sets ``test.owner_team``, so no server-side ownership map exists. Spans without a stamp
+file path through ``posthog_owners`` (the repo's distributed ``owners.yaml`` files, with
+``products/*/product.yaml`` as an alias) and sets ``test.owner_team``, so no server-side
+ownership map exists. Spans without a stamp
aggregate under the literal team ``'unowned'``, an honest first-class bucket that surfaces
ownership gaps instead of dropping them.
diff --git a/products/engineering_analytics/backend/presentation/views/teams.py b/products/engineering_analytics/backend/presentation/views/teams.py
index 3b6e0ebb8ae7..ed1e7aa86d4e 100644
--- a/products/engineering_analytics/backend/presentation/views/teams.py
+++ b/products/engineering_analytics/backend/presentation/views/teams.py
@@ -69,7 +69,7 @@ class TeamActionsMixin(EngineeringAnalyticsViewSetBase):
"seen both failing and passing in the window, regression_test_count is owned tests that failed "
"with no such proof and still hit the blast-radius bar, plus failed/recovery/quarantined run counts. Each has an "
"equal-length previous-window twin for honest deltas. Ownership is stamped on the spans at CI "
- "emission time from the repo's ownership map (products/*/product.yaml + CODEOWNERS); unstamped "
+ "emission time from the repo's ownership map (the distributed owners.yaml files); unstamped "
"spans aggregate under the literal team 'unowned', and a re-stamped test lands under its latest "
"owner only. Teams are organizational owners of code surfaces, never authors. " + FLAKY_TEST_SIGNAL_CAVEAT
),
diff --git a/products/engineering_analytics/backend/tests/test_team_ci_health.py b/products/engineering_analytics/backend/tests/test_team_ci_health.py
index 79a10ef7be44..acd04ad31e96 100644
--- a/products/engineering_analytics/backend/tests/test_team_ci_health.py
+++ b/products/engineering_analytics/backend/tests/test_team_ci_health.py
@@ -16,6 +16,7 @@ T_UNOWNED = "posthog/api/test/test_shared/TestShared::test_unowned"
T_FOREIGN = "posthog/api/test/test_foreign/TestForeign::test_other_service"
T_RESTAMPED = "products/moved/backend/tests/test_moved/TestMoved::test_restamped"
T_PASS_ONLY = "products/quiet/backend/tests/test_quiet/TestQuiet::test_pass_only"
+T_HANDLE_OWNED = "posthog/api/test/test_handle/TestHandle::test_handle_owned"
class TestTeamCIHealthAPI(ClickhouseTestMixin, APIBaseTest):
@@ -80,6 +81,8 @@ class TestTeamCIHealthAPI(ClickhouseTestMixin, APIBaseTest):
cls._span(16, T_RESTAMPED, "failed", ts=cls.current_b, owner="team-new", run="602", pr="602"),
# No owner stamp: buckets under the literal 'unowned'.
cls._span(12, T_UNOWNED, "rerun_passed", ts=cls.current_b, owner="", run="401", pr="401"),
+ # An '@handle' stamp is a person, not a team (older spans carry them): also 'unowned'.
+ cls._span(19, T_HANDLE_OWNED, "rerun_passed", ts=cls.current_b, owner="@someone", run="801", pr="801"),
# A re-run pass with no same-run failure: a shard re-executed alongside the flaky one.
# It pairs with nothing, so its team must not appear in the roster at all.
cls._span(
@@ -162,7 +165,9 @@ class TestTeamCIHealthAPI(ClickhouseTestMixin, APIBaseTest):
assert (replay["same_commit_recovery_run_count"], replay["same_commit_recovery_run_count_prior"]) == (1, 2)
assert (replay["quarantined_failed_run_count"], replay["quarantined_failed_run_count_prior"]) == (1, 0)
- assert (rows["unowned"]["flaky_test_count"], rows["unowned"]["same_commit_recovery_run_count"]) == (1, 1)
+ # The unstamped test and the '@handle'-stamped one both land here; no '@someone' row exists.
+ assert (rows["unowned"]["flaky_test_count"], rows["unowned"]["same_commit_recovery_run_count"]) == (2, 2)
+ assert "@someone" not in rows
# A re-run attempt went green on the same commit, so it is current-window flaky; the prior
# window's 3 unrecovered PR failures are a regression, not a flake.
diff --git a/products/engineering_analytics/frontend/components/MetricTile.tsx b/products/engineering_analytics/frontend/components/MetricTile.tsx
index 000705a765b2..41668c8a5ef8 100644
--- a/products/engineering_analytics/frontend/components/MetricTile.tsx
+++ b/products/engineering_analytics/frontend/components/MetricTile.tsx
@@ -68,26 +68,19 @@ export function DeltaBadge({
)
}
-/** Current count + delta vs the prior window; a zero prior with current signal reads "new". */
-export function CountWithDelta({
- current,
- prior,
- goodWhenDown = true,
-}: {
- current: number
- prior: number
- goodWhenDown?: boolean
-}): JSX.Element {
+/** Current count with the prior window's count as muted context. Table cells stay colorless on
+ * purpose: four colored percent badges per row drown the numbers they annotate. */
+export function CountWithPrior({ current, prior }: { current: number; prior: number }): JSX.Element {
return (
<div className="flex items-baseline justify-end gap-1.5">
<span className="text-sm font-semibold tabular-nums">{humanFriendlyNumber(current)}</span>
- {prior > 0 ? (
- <DeltaBadge value={percentChange(current, prior)} goodWhenDown={goodWhenDown} />
- ) : current > 0 ? (
- <Tooltip title="No signal in the previous window. This is new.">
- <span className="text-xs font-semibold whitespace-nowrap text-danger">new</span>
+ {prior !== current && (
+ <Tooltip title="Count in the previous window">
+ <span className="text-xs text-tertiary tabular-nums whitespace-nowrap">
+ was {humanFriendlyNumber(prior)}
+ </span>
</Tooltip>
- ) : null}
+ )}
</div>
)
}
diff --git a/products/engineering_analytics/frontend/generated/api.ts b/products/engineering_analytics/frontend/generated/api.ts
index f72cf31c2e55..09954c8e14fb 100644
--- a/products/engineering_analytics/frontend/generated/api.ts
+++ b/products/engineering_analytics/frontend/generated/api.ts
@@ -780,7 +780,7 @@ export const getEngineeringAnalyticsTeamCiHealthUrl = (
}
/**
- * Per-owning-team rollup of the CI test surfaces each team owns, over the same run evidence as flaky_tests and with the same meaning of flaky: flaky_test_count is owned tests one commit was seen both failing and passing in the window, regression_test_count is owned tests that failed with no such proof and still hit the blast-radius bar, plus failed/recovery/quarantined run counts. Each has an equal-length previous-window twin for honest deltas. Ownership is stamped on the spans at CI emission time from the repo's ownership map (products/*\/product.yaml + CODEOWNERS); unstamped spans aggregate under the literal team 'unowned', and a re-stamped test lands under its latest owner only. Teams are organizational owners of code surfaces, never authors. Counts are absolute, never rates: CI emits every failure but omits ordinary passing spans, so there is no execution denominator. 'suspected_regression' means no recovery was recorded in this data, not that the test never flakes.
+ * Per-owning-team rollup of the CI test surfaces each team owns, over the same run evidence as flaky_tests and with the same meaning of flaky: flaky_test_count is owned tests one commit was seen both failing and passing in the window, regression_test_count is owned tests that failed with no such proof and still hit the blast-radius bar, plus failed/recovery/quarantined run counts. Each has an equal-length previous-window twin for honest deltas. Ownership is stamped on the spans at CI emission time from the repo's ownership map (the distributed owners.yaml files); unstamped spans aggregate under the literal team 'unowned', and a re-stamped test lands under its latest owner only. Teams are organizational owners of code surfaces, never authors. Counts are absolute, never rates: CI emits every failure but omits ordinary passing spans, so there is no execution denominator. 'suspected_regression' means no recovery was recorded in this data, not that the test never flakes.
*/
export const engineeringAnalyticsTeamCiHealth = async (
projectId: string,
diff --git a/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsTeamScene.tsx b/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsTeamScene.tsx
index ab07ca311c6c..22ed81ac0375 100644
--- a/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsTeamScene.tsx
+++ b/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsTeamScene.tsx
@@ -15,7 +15,7 @@ import { SceneContent } from '~/layout/scenes/components/SceneContent'
import { SceneTitleSection } from '~/layout/scenes/components/SceneTitleSection'
import { EntityHeader } from '../components/EntityHeader'
-import { CountWithDelta } from '../components/MetricTile'
+import { CountWithPrior } from '../components/MetricTile'
import { Section } from '../components/Section'
import { compactHoursLabel } from '../lib/format'
import { TeamDetailLogicProps, TeamTestSignalRow, teamDetailLogic } from './teamDetailLogic'
@@ -65,7 +65,7 @@ export function EngineeringAnalyticsTeamScene(): JSX.Element {
width: 140,
align: 'right',
sorter: (a, b) => a.signalCount - b.signalCount,
- render: (_, row) => <CountWithDelta current={row.signalCount} prior={row.signalCountPrior} />,
+ render: (_, row) => <CountWithPrior current={row.signalCount} prior={row.signalCountPrior} />,
},
{
title: 'Last seen',
diff --git a/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsTeams.stories.tsx b/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsTeams.stories.tsx
new file mode 100644
index 000000000000..574a2703a5d5
--- /dev/null
+++ b/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsTeams.stories.tsx
@@ -0,0 +1,134 @@
+import { Meta, StoryObj } from '@storybook/react'
+
+import { FEATURE_FLAGS } from 'lib/constants'
+import { App } from 'scenes/App'
+import { urls } from 'scenes/urls'
+
+import { mswDecorator } from '~/mocks/browser'
+
+import type { GitHubSourceApi, TeamCIHealthListApi } from '../generated/api.schemas'
+
+const SOURCES: GitHubSourceApi[] = [{ id: 'src-1', repo: 'PostHog/posthog', prefix: '' }]
+
+const TEAM_CI_HEALTH: TeamCIHealthListApi = {
+ items: [
+ {
+ owner_team: 'unowned',
+ flaky_test_count: 12,
+ flaky_test_count_prior: 30,
+ regression_test_count: 41,
+ regression_test_count_prior: 22,
+ failed_run_count: 512,
+ failed_run_count_prior: 431,
+ same_commit_recovery_run_count: 18,
+ same_commit_recovery_run_count_prior: 40,
+ quarantined_failed_run_count: 6,
+ quarantined_failed_run_count_prior: 0,
+ last_seen_at: '2026-07-02T09:12:00Z',
+ },
+ {
+ owner_team: 'team-replay',
+ flaky_test_count: 8,
+ flaky_test_count_prior: 8,
+ regression_test_count: 3,
+ regression_test_count_prior: 1,
+ failed_run_count: 96,
+ failed_run_count_prior: 240,
+ same_commit_recovery_run_count: 11,
+ same_commit_recovery_run_count_prior: 12,
+ quarantined_failed_run_count: 0,
+ quarantined_failed_run_count_prior: 0,
+ last_seen_at: '2026-07-02T08:40:00Z',
+ },
+ {
+ owner_team: 'batch-exports',
+ flaky_test_count: 0,
+ flaky_test_count_prior: 2,
+ regression_test_count: 7,
+ regression_test_count_prior: 0,
+ failed_run_count: 130,
+ failed_run_count_prior: 6,
+ same_commit_recovery_run_count: 0,
+ same_commit_recovery_run_count_prior: 2,
+ quarantined_failed_run_count: 0,
+ quarantined_failed_run_count_prior: 0,
+ last_seen_at: '2026-07-01T22:05:00Z',
+ },
+ {
+ owner_team: 'team-product-analytics',
+ flaky_test_count: 1,
+ flaky_test_count_prior: 0,
+ regression_test_count: 2,
+ regression_test_count_prior: 5,
+ failed_run_count: 44,
+ failed_run_count_prior: 44,
+ same_commit_recovery_run_count: 1,
+ same_commit_recovery_run_count_prior: 0,
+ quarantined_failed_run_count: 0,
+ quarantined_failed_run_count_prior: 0,
+ last_seen_at: '2026-07-01T16:30:00Z',
+ },
+ ],
+ truncated: false,
+ limit: 100,
+}
+
+const meta: Meta = {
+ component: App,
+ title: 'Scenes-App/Engineering Analytics/Teams',
+ parameters: {
+ layout: 'fullscreen',
+ viewMode: 'story',
+ mockDate: '2026-07-02',
+ featureFlags: [FEATURE_FLAGS.ENGINEERING_ANALYTICS],
+ testOptions: {
+ waitForSelector: '[data-attr="engineering-analytics-teams-table"]',
+ },
+ },
+ decorators: [
+ mswDecorator({
+ get: {
+ 'api/projects/:team_id/engineering_analytics/team_ci_health/': TEAM_CI_HEALTH,
+ 'api/projects/:team_id/engineering_analytics/sources/': SOURCES,
+ // Sibling-tab loaders mount with the scene; stub them so the story renders without error toasts.
+ 'api/projects/:team_id/engineering_analytics/ci_cards/': {
+ open_prs: 0,
+ repos: 1,
+ stuck: 0,
+ failing_ci: 0,
+ },
+ 'api/projects/:team_id/engineering_analytics/pull_requests/': {
+ items: [],
+ truncated: false,
+ limit: 1000,
+ },
+ 'api/projects/:team_id/engineering_analytics/workflow_health/': [],
+ 'api/projects/:team_id/engineering_analytics/quarantine/': {
+ available: false,
+ entries: [],
+ parse_errors: [],
+ parse_warnings: [],
+ repo: null,
+ source_url: null,
+ generated_at: null,
+ },
+ 'api/projects/:team_id/engineering_analytics/trunk_quarantine/': {
+ available: false,
+ ttl_days: 15,
+ repository: null,
+ trunk_url: null,
+ teams: [],
+ tests: [],
+ },
+ },
+ }),
+ ],
+}
+export default meta
+
+type Story = StoryObj<typeof meta>
+
+export const TeamCIHealthRoster: Story = {
+ render: () => <App />,
+ parameters: { pageUrl: urls.engineeringAnalyticsTeams() },
+}
diff --git a/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsTeams.tsx b/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsTeams.tsx
index 96f83f82c47d..a66e638026a7 100644
--- a/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsTeams.tsx
+++ b/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsTeams.tsx
@@ -7,7 +7,7 @@ import { LemonTable, LemonTableColumns, LemonTag, Link, Tooltip } from '@posthog
import { DateFilter } from 'lib/components/DateFilter/DateFilter'
import { urls } from 'scenes/urls'
-import { CountWithDelta } from '../components/MetricTile'
+import { CountWithPrior } from '../components/MetricTile'
import { ScopeBar, SourceScopeChip } from '../components/ScopeBar'
import { rowNavigationProps } from '../lib/rowNavigation'
import {
@@ -69,7 +69,7 @@ export function EngineeringAnalyticsTeams(): JSX.Element {
tooltip:
'Owned tests one commit was seen both failing and passing in this window, vs the previous one. Only tests with that recovery proof count as flaky.',
sorter: (a, b) => a.flakyTestCount - b.flakyTestCount,
- render: (_, row) => <CountWithDelta current={row.flakyTestCount} prior={row.flakyTestCountPrior} />,
+ render: (_, row) => <CountWithPrior current={row.flakyTestCount} prior={row.flakyTestCountPrior} />,
},
{
title: 'Regressions',
@@ -80,7 +80,7 @@ export function EngineeringAnalyticsTeams(): JSX.Element {
'Owned tests that failed with no recorded recovery and still hit several PRs or master. Treat as real breaks until a recovery proves otherwise.',
sorter: (a, b) => a.regressionTestCount - b.regressionTestCount,
render: (_, row) => (
- <CountWithDelta current={row.regressionTestCount} prior={row.regressionTestCountPrior} />
+ <CountWithPrior current={row.regressionTestCount} prior={row.regressionTestCountPrior} />
),
},
{
@@ -91,7 +91,7 @@ export function EngineeringAnalyticsTeams(): JSX.Element {
tooltip:
'CI runs where an owned test failed or errored. Absolute counts, not rates: passing runs are mostly not recorded.',
sorter: (a, b) => a.failedRunCount - b.failedRunCount,
- render: (_, row) => <CountWithDelta current={row.failedRunCount} prior={row.failedRunCountPrior} />,
+ render: (_, row) => <CountWithPrior current={row.failedRunCount} prior={row.failedRunCountPrior} />,
},
{
title: 'Recoveries',
@@ -102,7 +102,7 @@ export function EngineeringAnalyticsTeams(): JSX.Element {
'Runs where one commit both failed and passed an owned test (a re-run went green, or an in-job retry recovered it). This is what proves a flake.',
sorter: (a, b) => a.sameCommitRecoveryRunCount - b.sameCommitRecoveryRunCount,
render: (_, row) => (
- <CountWithDelta current={row.sameCommitRecoveryRunCount} prior={row.sameCommitRecoveryRunCountPrior} />
+ <CountWithPrior current={row.sameCommitRecoveryRunCount} prior={row.sameCommitRecoveryRunCountPrior} />
),
},
]
@@ -117,8 +117,8 @@ export function EngineeringAnalyticsTeams(): JSX.Element {
Team CI health
</h3>
<p className="m-0 text-xs text-tertiary">
- The CI test surfaces each team owns (flaky tests and failures), with the change vs the previous
- window. Ownership comes from the repo's ownership map, never from authorship.
+ The CI test surfaces each team owns (flaky tests and failures), with the previous window for
+ comparison. Ownership comes from the repo's owners.yaml files, never from authorship.
</p>
</div>
<DateFilter
@@ -137,7 +137,7 @@ export function EngineeringAnalyticsTeams(): JSX.Element {
rowClassName="cursor-pointer"
onRow={(row) => rowNavigationProps(detailUrlOf(row.ownerTeam, teamsWindow, sourceId))}
loading={teamsLoading}
- pagination={{ pageSize: 25 }}
+ pagination={{ pageSize: 10 }}
useURLForSorting={false}
emptyState="No team-attributed CI signal in this window. Signal appears once CI emits test spans with ownership stamps."
nouns={['team', 'teams']}
diff --git a/products/engineering_analytics/frontend/scenes/engineeringAnalyticsSceneLogic.ts b/products/engineering_analytics/frontend/scenes/engineeringAnalyticsSceneLogic.ts
index 960bea29d44b..0fd67ee3a301 100644
--- a/products/engineering_analytics/frontend/scenes/engineeringAnalyticsSceneLogic.ts
+++ b/products/engineering_analytics/frontend/scenes/engineeringAnalyticsSceneLogic.ts
@@ -10,7 +10,7 @@ export const VIEW_DESCRIPTIONS: Record<EngineeringAnalyticsView, string> = {
'pull-requests': 'Pull requests and their CI status across connected repos.',
workflows: 'Run volume, success rate, and duration per workflow over the selected window.',
'test-health': 'Quarantine debt by team: which quarantined tests each team owns, and how long they have stood.',
- teams: 'CI test surfaces rolled up by owning team: flaky signal and failures, with prior-window deltas.',
+ teams: 'CI test surfaces rolled up by owning team: flaky signal and failures, compared with the previous window.',
health: 'DORA-style deploy metrics from the GitHub deployments data: frequency, merge to deploy lead time, and failure proxies.',
}
diff --git a/products/engineering_analytics/mcp/tools.yaml b/products/engineering_analytics/mcp/tools.yaml
index 0c80536cdb74..eb36545a02b7 100644
--- a/products/engineering_analytics/mcp/tools.yaml
+++ b/products/engineering_analytics/mcp/tools.yaml
@@ -236,7 +236,7 @@ tools:
same_commit_recovery_run_count / quarantined_failed_run_count are run counts. Each has an equal-length
previous-window twin (*_prior) for honest deltas. Use this for "which team owns the flakiest surfaces right
now" and to route a flaky-test or CI Signal to its owning team. Ownership is stamped on the spans at CI
- emission time from the repo's ownership map (products/*/product.yaml + CODEOWNERS); spans without a stamp
+ emission time from the repo's ownership map (the distributed owners.yaml files); spans without a stamp
aggregate under the literal team 'unowned' (a nonempty 'unowned' row means ownership gaps, not a real team),
and a re-stamped test lands under its latest owner only. Teams are organizational owners of code surfaces,
never authors. Read all counts as absolute signal, never rates: fast passing runs are not emitted, so there
diff --git a/services/mcp/schema/generated-tool-definitions.json b/services/mcp/schema/generated-tool-definitions.json
index 2ace124f582f..b2e055372941 100644
--- a/services/mcp/schema/generated-tool-definitions.json
+++ b/services/mcp/schema/generated-tool-definitions.json
@@ -3349,7 +3349,7 @@
"feature_flag": "engineering-analytics"
},
"engineering-analytics-team-ci-health": {
- "description": "Per-owning-team rollup of the CI test surfaces each team owns, over a window (date_from default -14d, maximum 30 days). It reads the same per-run evidence as engineering-analytics-flaky-tests and means the same thing by flaky: flaky_test_count is owned tests one commit was seen both failing and passing in the window (a re-run attempt went green, or an in-job retry recovered it), regression_test_count is owned tests that failed with no such proof and still hit min_failed_prs distinct PRs or master, and failed_run_count / same_commit_recovery_run_count / quarantined_failed_run_count are run counts. Each has an equal-length previous-window twin (*_prior) for honest deltas. Use this for \"which team owns the flakiest surfaces right now\" and to route a flaky-test or CI Signal to its owning team. Ownership is stamped on the spans at CI emission time from the repo's ownership map (products/*/product.yaml + CODEOWNERS); spans without a stamp aggregate under the literal team 'unowned' (a nonempty 'unowned' row means ownership gaps, not a real team), and a re-stamped test lands under its latest owner only. Teams are organizational owners of code surfaces, never authors. Read all counts as absolute signal, never rates: fast passing runs are not emitted, so there is no honest denominator.",
+ "description": "Per-owning-team rollup of the CI test surfaces each team owns, over a window (date_from default -14d, maximum 30 days). It reads the same per-run evidence as engineering-analytics-flaky-tests and means the same thing by flaky: flaky_test_count is owned tests one commit was seen both failing and passing in the window (a re-run attempt went green, or an in-job retry recovered it), regression_test_count is owned tests that failed with no such proof and still hit min_failed_prs distinct PRs or master, and failed_run_count / same_commit_recovery_run_count / quarantined_failed_run_count are run counts. Each has an equal-length previous-window twin (*_prior) for honest deltas. Use this for \"which team owns the flakiest surfaces right now\" and to route a flaky-test or CI Signal to its owning team. Ownership is stamped on the spans at CI emission time from the repo's ownership map (the distributed owners.yaml files); spans without a stamp aggregate under the literal team 'unowned' (a nonempty 'unowned' row means ownership gaps, not a real team), and a re-stamped test lands under its latest owner only. Teams are organizational owners of code surfaces, never authors. Read all counts as absolute signal, never rates: fast passing runs are not emitted, so there is no honest denominator.",
"category": "Engineering analytics",
"feature": "engineering_analytics",
"summary": "Team CI health roster",
diff --git a/services/mcp/schema/tool-definitions-all.json b/services/mcp/schema/tool-definitions-all.json
index 01564832082f..a055e2f689f2 100644
--- a/services/mcp/schema/tool-definitions-all.json
+++ b/services/mcp/schema/tool-definitions-all.json
@@ -3378,7 +3378,7 @@
"feature_flag": "engineering-analytics"
},
"engineering-analytics-team-ci-health": {
- "description": "Per-owning-team rollup of the CI test surfaces each team owns, over a window (date_from default -14d, maximum 30 days). It reads the same per-run evidence as engineering-analytics-flaky-tests and means the same thing by flaky: flaky_test_count is owned tests one commit was seen both failing and passing in the window (a re-run attempt went green, or an in-job retry recovered it), regression_test_count is owned tests that failed with no such proof and still hit min_failed_prs distinct PRs or master, and failed_run_count / same_commit_recovery_run_count / quarantined_failed_run_count are run counts. Each has an equal-length previous-window twin (*_prior) for honest deltas. Use this for \"which team owns the flakiest surfaces right now\" and to route a flaky-test or CI Signal to its owning team. Ownership is stamped on the spans at CI emission time from the repo's ownership map (products/*/product.yaml + CODEOWNERS); spans without a stamp aggregate under the literal team 'unowned' (a nonempty 'unowned' row means ownership gaps, not a real team), and a re-stamped test lands under its latest owner only. Teams are organizational owners of code surfaces, never authors. Read all counts as absolute signal, never rates: fast passing runs are not emitted, so there is no honest denominator.",
+ "description": "Per-owning-team rollup of the CI test surfaces each team owns, over a window (date_from default -14d, maximum 30 days). It reads the same per-run evidence as engineering-analytics-flaky-tests and means the same thing by flaky: flaky_test_count is owned tests one commit was seen both failing and passing in the window (a re-run attempt went green, or an in-job retry recovered it), regression_test_count is owned tests that failed with no such proof and still hit min_failed_prs distinct PRs or master, and failed_run_count / same_commit_recovery_run_count / quarantined_failed_run_count are run counts. Each has an equal-length previous-window twin (*_prior) for honest deltas. Use this for \"which team owns the flakiest surfaces right now\" and to route a flaky-test or CI Signal to its owning team. Ownership is stamped on the spans at CI emission time from the repo's ownership map (the distributed owners.yaml files); spans without a stamp aggregate under the literal team 'unowned' (a nonempty 'unowned' row means ownership gaps, not a real team), and a re-stamped test lands under its latest owner only. Teams are organizational owners of code surfaces, never authors. Read all counts as absolute signal, never rates: fast passing runs are not emitted, so there is no honest denominator.",
"category": "Engineering analytics",
"feature": "engineering_analytics",
"summary": "Team CI health roster",
diff --git a/services/mcp/src/generated/engineering_analytics/api.ts b/services/mcp/src/generated/engineering_analytics/api.ts
index da341775153f..ac562379d846 100644
--- a/services/mcp/src/generated/engineering_analytics/api.ts
+++ b/services/mcp/src/generated/engineering_analytics/api.ts
@@ -208,7 +208,7 @@ export const EngineeringAnalyticsSourcesParams = /* @__PURE__ */ zod.object({
})
/**
- * Per-owning-team rollup of the CI test surfaces each team owns, over the same run evidence as flaky_tests and with the same meaning of flaky: flaky_test_count is owned tests one commit was seen both failing and passing in the window, regression_test_count is owned tests that failed with no such proof and still hit the blast-radius bar, plus failed/recovery/quarantined run counts. Each has an equal-length previous-window twin for honest deltas. Ownership is stamped on the spans at CI emission time from the repo's ownership map (products/*\/product.yaml + CODEOWNERS); unstamped spans aggregate under the literal team 'unowned', and a re-stamped test lands under its latest owner only. Teams are organizational owners of code surfaces, never authors. Counts are absolute, never rates: CI emits every failure but omits ordinary passing spans, so there is no execution denominator. 'suspected_regression' means no recovery was recorded in this data, not that the test never flakes.
+ * Per-owning-team rollup of the CI test surfaces each team owns, over the same run evidence as flaky_tests and with the same meaning of flaky: flaky_test_count is owned tests one commit was seen both failing and passing in the window, regression_test_count is owned tests that failed with no such proof and still hit the blast-radius bar, plus failed/recovery/quarantined run counts. Each has an equal-length previous-window twin for honest deltas. Ownership is stamped on the spans at CI emission time from the repo's ownership map (the distributed owners.yaml files); unstamped spans aggregate under the literal team 'unowned', and a re-stamped test lands under its latest owner only. Teams are organizational owners of code surfaces, never authors. Counts are absolute, never rates: CI emits every failure but omits ordinary passing spans, so there is no execution denominator. 'suspected_regression' means no recovery was recorded in this data, not that the test never flakes.
*/
export const EngineeringAnalyticsTeamCiHealthParams = /* @__PURE__ */ zod.object({
project_id: zod