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): skip CI setup breaks in tests (#102948)

Raúl Negrón-Oterodafb27f76833
diff --git a/products/engineering_analytics/SPEC.md b/products/engineering_analytics/SPEC.md
index 155a5452d08e..c79be852ae59 100644
--- a/products/engineering_analytics/SPEC.md
+++ b/products/engineering_analytics/SPEC.md
@@ -92,6 +92,7 @@ The endpoint catalog is `presentation/views.py`; the agent-facing descriptions l
- Capped list contracts that include a sibling aggregate return `{items, truncated, limit}` so they never silently undercount against it.
- Span-derived reads (flaky tests, team CI health) report absolute counts, never rates: sub-threshold runs aren't emitted, so denominators are biased.
- Test evidence is counted per CI run, never per span or run attempt (one run fans a test across matrix legs, and every attempt re-tests the same commit), and both span-derived reads group the same `run_evidence()` so the grain and the meaning of flaky cannot drift. A test is `confirmed_flake` only on same-commit recovery proof: a re-run attempt going green, or an in-job retry. Unproven failures rank as `suspected_regression` by blast radius.
+- A CI setup break is not per-test evidence. `run_evidence()` drops every trial of a run attempt whose errored tests span 3 or more jobs or 3 or more owning teams, so its errors are no test's failure and its passes are no test's recovery. The spans name the attempt, and GitHub's synced `workflow_jobs` rows confirm it: the same attempt must report 3 or more failed jobs there. CI stamps every span attribute the rule reads, so no evidence is dropped on the spans alone, and an unsynced jobs table drops nothing.
- Reads over optional data (e.g. `team_members`) degrade honestly (`has_membership_data: false`), never 500.
### Exposed warehouse views
diff --git a/products/engineering_analytics/backend/logic/queries/_test_spans.py b/products/engineering_analytics/backend/logic/queries/_test_spans.py
index c92b4a81b4cf..d2aae4adc87b 100644
--- a/products/engineering_analytics/backend/logic/queries/_test_spans.py
+++ b/products/engineering_analytics/backend/logic/queries/_test_spans.py
@@ -23,12 +23,17 @@ Failures with no recovery prove nothing about determinism. This surface answers
test costs us, so unproven failures are ranked by blast radius and never called flaky.
"""
+from collections.abc import Sequence
from datetime import datetime
from posthog.hogql import ast
+from posthog.clickhouse.workload import Workload
+
from products.engineering_analytics.backend.facade.contracts import UNOWNED_TEAM
from products.engineering_analytics.backend.logic.merge_queue import source_pr_string_expr
+from products.engineering_analytics.backend.logic.queries._curated import CuratedGitHubSource
+from products.engineering_analytics.backend.logic.queries._workflow_filters import job_created_floor_constant
# On a merge-queue gate run the emitter stamps ``ci.pr_number`` from the webhook payload, which names
# the throwaway PR the queue opened rather than the PR being landed. Every blast-radius read here
@@ -104,6 +109,7 @@ _RUN_EVIDENCE = """
max(outcome = 'passed') AND NOT trial_failed AS trial_passed,
max(span_timestamp) AS trial_at
FROM (__SPAN_SCAN__)
+ WHERE NOT has({setup_break_run_attempts}, (run_id, toString(attempt)))
GROUP BY runner, nodeid, run_id, job_key, attempt
)
GROUP BY runner, nodeid, run_id, job_key
@@ -115,6 +121,31 @@ _RUN_EVIDENCE = """
HAVING failed_in_run OR recovered_in_run OR quarantined_in_run
"""
+# A CI setup break errors tests in many jobs, or tests of many owning teams, in one run attempt. Those
+# errors describe the attempt, not any one test, so run_evidence() drops every trial of that attempt:
+# its failures are not failures of a test, and its passes are not recovery proof.
+SETUP_BREAK_MIN_JOBS = 3
+SETUP_BREAK_MIN_TEAMS = 3
+
+# CI stamps every attribute the rule below reads, and the warehouse is the side of the pair the
+# emitter cannot write, so both must agree before any evidence is dropped.
+_SETUP_BREAK_CANDIDATES = """
+ SELECT run_id, attempt
+ FROM (__SPAN_SCAN__)
+ WHERE outcome = 'error'
+ GROUP BY run_id, attempt
+ HAVING uniq(job_key) >= {setup_break_min_jobs}
+ OR uniqIf(owner_team, owner_team != {unowned_team}) >= {setup_break_min_teams}
+"""
+
+_BROADLY_FAILED_ATTEMPTS = """
+ SELECT toString(run_id) AS run_id, run_attempt
+ FROM __JOBS_SOURCE__
+ WHERE run_id IN {candidate_run_ids}
+ GROUP BY run_id, run_attempt
+ HAVING uniqIf(name, conclusion = 'failure') >= {setup_break_min_jobs}
+"""
+
def run_evidence(*, bounded: bool) -> str:
"""One row per (test, CI run): what that run proves about that test.
@@ -122,7 +153,8 @@ def run_evidence(*, bounded: bool) -> str:
Every consumer groups this, never the raw spans, so all of them count at the same grain and
agree on what the signal means. See the module docstring for why the run is the grain.
- ``bounded`` adds the upper time bound; some callers scan to now.
+ ``bounded`` adds the upper time bound; some callers scan to now. The caller binds
+ {setup_break_run_attempts} through ``scan_placeholders``, from ``query_setup_break_attempts``.
"""
return _RUN_EVIDENCE.replace("__SPAN_SCAN__", _scan(bounded=bounded))
@@ -187,6 +219,7 @@ def scan_placeholders(
date_from: datetime,
scan_from: datetime | None = None,
date_to: datetime | None = None,
+ setup_break_run_attempts: Sequence[tuple[str, int]] = (),
) -> dict[str, ast.Expr]:
placeholders: dict[str, ast.Expr] = {
"service_names": ast.Constant(value=CI_SERVICE_NAMES),
@@ -195,12 +228,71 @@ def scan_placeholders(
"repository": ast.Constant(value=repository),
"date_from": ast.Constant(value=date_from),
"scan_from": ast.Constant(value=scan_from if scan_from is not None else date_from),
+ "setup_break_min_jobs": ast.Constant(value=SETUP_BREAK_MIN_JOBS),
+ "setup_break_min_teams": ast.Constant(value=SETUP_BREAK_MIN_TEAMS),
+ "setup_break_run_attempts": ast.Array(
+ exprs=[
+ ast.Tuple(exprs=[ast.Constant(value=run_id), ast.Constant(value=str(attempt))])
+ for run_id, attempt in setup_break_run_attempts
+ ]
+ ),
}
if date_to is not None:
placeholders["date_to"] = ast.Constant(value=date_to)
return placeholders
+def query_setup_break_attempts(
+ *,
+ curated: CuratedGitHubSource,
+ date_from: datetime,
+ scan_from: datetime | None = None,
+ date_to: datetime | None = None,
+) -> tuple[tuple[str, int], ...]:
+ """The ``(run_id, attempt)`` pairs whose CI setup broke, for ``scan_placeholders``.
+
+ Two sources have to agree. The spans name the attempts that look broken, and GitHub's synced job
+ rows say which of those really failed across jobs. An attempt GitHub does not report that way keeps
+ its trials, so no test's evidence rests on the span attributes alone.
+ """
+ jobs_source = curated.jobs_source(created_floor=True)
+ if not curated.repository or jobs_source is None:
+ return ()
+
+ window_start = scan_from if scan_from is not None else date_from
+ candidates = (
+ curated.run(
+ _SETUP_BREAK_CANDIDATES.replace("__SPAN_SCAN__", _scan(bounded=date_to is not None)),
+ query_type="engineering_analytics.setup_break_candidates",
+ placeholders=scan_placeholders(
+ repository=curated.repository, date_from=date_from, scan_from=scan_from, date_to=date_to
+ ),
+ workload=Workload.LOGS,
+ ).results
+ or []
+ )
+ # An unstamped span falls back to its trace ID, which names no GitHub run.
+ candidate_run_ids = {int(run_id) for run_id, _attempt in candidates if str(run_id).isdigit()}
+ if not candidate_run_ids:
+ return ()
+
+ confirmed = (
+ curated.run(
+ _BROADLY_FAILED_ATTEMPTS.replace("__JOBS_SOURCE__", jobs_source),
+ query_type="engineering_analytics.setup_break_confirmation",
+ placeholders={
+ "candidate_run_ids": ast.Constant(value=sorted(candidate_run_ids)),
+ "setup_break_min_jobs": ast.Constant(value=SETUP_BREAK_MIN_JOBS),
+ "job_created_floor": job_created_floor_constant(window_start),
+ },
+ ).results
+ or []
+ )
+ confirmed_attempts = {(str(run_id), int(attempt)) for run_id, attempt in confirmed}
+ candidate_attempts = {(str(run_id), int(attempt)) for run_id, attempt in candidates}
+ return tuple(sorted(candidate_attempts & confirmed_attempts))
+
+
def rerun_recovered_job_attempts(*, scan_from: str) -> str:
"""``(run_id, run_attempt, runner_name)``, as strings, of every pytest job attempt whose in-process
retry recovered a test. That job concludes as a success, but its log still holds the failure.
diff --git a/products/engineering_analytics/backend/logic/queries/flaky_tests.py b/products/engineering_analytics/backend/logic/queries/flaky_tests.py
index 3a35ff025e97..cf8489345499 100644
--- a/products/engineering_analytics/backend/logic/queries/flaky_tests.py
+++ b/products/engineering_analytics/backend/logic/queries/flaky_tests.py
@@ -29,6 +29,7 @@ from products.engineering_analytics.backend.facade.contracts import (
)
from products.engineering_analytics.backend.logic.queries._curated import CuratedGitHubSource
from products.engineering_analytics.backend.logic.queries._test_spans import (
+ query_setup_break_attempts,
run_evidence,
scan_placeholders,
selector_from_nodeid,
@@ -79,7 +80,12 @@ def query_flaky_tests(
if not repository:
return FlakyTestList(items=[], truncated=False, limit=limit)
- placeholders = scan_placeholders(repository=repository, date_from=date_from, date_to=date_to)
+ placeholders = scan_placeholders(
+ repository=repository,
+ date_from=date_from,
+ date_to=date_to,
+ setup_break_run_attempts=query_setup_break_attempts(curated=curated, date_from=date_from, date_to=date_to),
+ )
placeholders["min_failed_prs"] = ast.Constant(value=min_failed_prs)
runner_filter = ""
if runner is not None:
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 eaf7136085bd..fe2eed977afa 100644
--- a/products/engineering_analytics/backend/logic/queries/team_ci_health.py
+++ b/products/engineering_analytics/backend/logic/queries/team_ci_health.py
@@ -34,6 +34,7 @@ from products.engineering_analytics.backend.facade.contracts import (
from products.engineering_analytics.backend.logic._shared import _prior_window
from products.engineering_analytics.backend.logic.queries._curated import CuratedGitHubSource
from products.engineering_analytics.backend.logic.queries._test_spans import (
+ query_setup_break_attempts,
run_evidence,
scan_placeholders,
selector_from_nodeid,
@@ -116,7 +117,13 @@ def _window_placeholders(
# The prior window twins the current one: [scan_from, date_from) vs [date_from, date_to].
window = _prior_window(date_from, date_to)
return scan_placeholders(
- repository=curated.repository, date_from=date_from, scan_from=window.scan_from, date_to=window.resolved_to
+ repository=curated.repository,
+ date_from=date_from,
+ scan_from=window.scan_from,
+ date_to=window.resolved_to,
+ setup_break_run_attempts=query_setup_break_attempts(
+ curated=curated, date_from=date_from, scan_from=window.scan_from, date_to=window.resolved_to
+ ),
)
diff --git a/products/engineering_analytics/backend/presentation/serializers/suite_health.py b/products/engineering_analytics/backend/presentation/serializers/suite_health.py
index c81952eed2ff..8021e580f855 100644
--- a/products/engineering_analytics/backend/presentation/serializers/suite_health.py
+++ b/products/engineering_analytics/backend/presentation/serializers/suite_health.py
@@ -145,7 +145,9 @@ class TrunkQuarantineDebtSerializer(DataclassSerializer):
class FlakyTestListSerializer(DataclassSerializer):
items = FlakyTestItemSerializer(
many=True,
- help_text="Tests worth acting on now, ranked by blast radius: master failures, then PRs hit, then runs.",
+ help_text="Tests worth acting on now, ranked by blast radius: master failures, then PRs hit, then runs. "
+ "A CI setup break (a run attempt whose tests errored in 3 or more jobs or for 3 or more owning teams) "
+ "excludes every trial of that attempt, not only its failures.",
)
class Meta:
diff --git a/products/engineering_analytics/backend/presentation/serializers/teams.py b/products/engineering_analytics/backend/presentation/serializers/teams.py
index e6129da936f6..2bdfcf408814 100644
--- a/products/engineering_analytics/backend/presentation/serializers/teams.py
+++ b/products/engineering_analytics/backend/presentation/serializers/teams.py
@@ -72,7 +72,9 @@ class TeamCIHealthListSerializer(DataclassSerializer):
items = TeamCIHealthItemSerializer(
many=True,
help_text="Owning teams ranked by current flaky + failure signal, heaviest first, capped at `limit`. "
- "Teams are organizational owners of code surfaces; this never aggregates by author.",
+ "Teams are organizational owners of code surfaces; this never aggregates by author. A CI setup break "
+ "(a run attempt whose tests errored in 3 or more jobs or for 3 or more owning teams) excludes every "
+ "trial of that attempt, not only its failures.",
)
class Meta:
diff --git a/products/engineering_analytics/backend/tests/_github_fixtures.py b/products/engineering_analytics/backend/tests/_github_fixtures.py
index fbe1b7945d4f..2e4aa3a9e9d6 100644
--- a/products/engineering_analytics/backend/tests/_github_fixtures.py
+++ b/products/engineering_analytics/backend/tests/_github_fixtures.py
@@ -6,6 +6,7 @@ import zlib
import tempfile
from collections.abc import Iterator
from contextlib import contextmanager
+from datetime import UTC, datetime, timedelta
from pathlib import Path
from typing import Any
@@ -18,9 +19,11 @@ from posthog.models.team import Team
from products.engineering_analytics.backend.logic.sources import (
ISSUE_EVENTS_SCHEMA,
PULL_REQUESTS_SCHEMA,
+ WORKFLOW_JOBS_SCHEMA,
WORKFLOW_RUNS_SCHEMA,
GitHubTables,
)
+from products.engineering_analytics.backend.logic.views.source_schema import WORKFLOW_JOBS_COLUMNS
from products.warehouse_sources.backend.facade.models import DataWarehouseTable, ExternalDataSchema, ExternalDataSource
from products.warehouse_sources.backend.facade.testing import create_data_warehouse_table_from_csv
from products.warehouse_sources.backend.facade.types import ExternalDataSourceType
@@ -319,8 +322,43 @@ def _status_row(status_id: int, deployment_id: int, state: str, environment: str
}
+def connect_github_jobs(test: PostHogTestCase, *, prefix: str, jobs: list[tuple[int, int, int, str]]) -> None:
+ """Seed ``workflow_jobs`` rows on the team's existing GitHub source, as ``(id, run_id, attempt,
+ conclusion)``. Reads that corroborate a span-derived signal against GitHub need this table."""
+ source = ExternalDataSource.objects.get(team=test.team, prefix=prefix)
+ now = datetime.now(UTC)
+ table_name = create_github_warehouse_table(
+ test,
+ "github_workflow_jobs",
+ WORKFLOW_JOBS_COLUMNS,
+ [
+ dict.fromkeys(WORKFLOW_JOBS_COLUMNS)
+ | {
+ "id": job_id,
+ "run_id": run_id,
+ "run_attempt": attempt,
+ "name": f"job-{job_id}",
+ "conclusion": conclusion,
+ "created_at": (now - timedelta(days=1)).isoformat(),
+ "started_at": (now - timedelta(days=1)).isoformat(),
+ "completed_at": now.isoformat(),
+ }
+ for job_id, run_id, attempt, conclusion in jobs
+ ],
+ source=source,
+ prefix=prefix,
+ )
+ link_schema(test.team, source, name=WORKFLOW_JOBS_SCHEMA, table=DataWarehouseTable.objects.get(name=table_name))
+
+
def create_github_warehouse_table(
- test: PostHogTestCase, base_name: str, columns: dict, rows: list[dict[str, Any]]
+ test: PostHogTestCase,
+ base_name: str,
+ columns: dict,
+ rows: list[dict[str, Any]],
+ *,
+ source: ExternalDataSource | None = None,
+ prefix: str = GITHUB_SOURCE_PREFIX,
) -> str:
# Returns the real table name (prefixed), which the builder is then told to read,
# proving build_query honors the resolved name instead of a hardcoded one.
@@ -336,7 +374,8 @@ def create_github_warehouse_table(
table_columns=columns,
test_bucket=TEST_BUCKET,
team=test.team,
- source_prefix=GITHUB_SOURCE_PREFIX,
+ source=source,
+ source_prefix=prefix,
)
test.addCleanup(cleanup)
return table.name
diff --git a/products/engineering_analytics/backend/tests/test_flaky_tests.py b/products/engineering_analytics/backend/tests/test_flaky_tests.py
index 0e7315c1b137..1efcf158ff57 100644
--- a/products/engineering_analytics/backend/tests/test_flaky_tests.py
+++ b/products/engineering_analytics/backend/tests/test_flaky_tests.py
@@ -14,6 +14,7 @@ from products.engineering_analytics.backend.logic.queries._test_spans import sel
from products.engineering_analytics.backend.logic.views.source_schema import WORKFLOW_JOBS_COLUMNS
from products.engineering_analytics.backend.tests._github_fixtures import (
GITHUB_SOURCE_PREFIX,
+ connect_github_jobs,
connect_github_source_without_data,
create_github_warehouse_table,
)
@@ -38,6 +39,8 @@ T_FOREIGN = "posthog/api/test/test_foreign/TestForeign::test_other_service"
T_OTHER_REPO = "posthog/api/test/test_other_repo/TestOtherRepo::test_flaky"
T_JEST_RECOVERY = "products/surveys/frontend/surveyLogic.test.ts::surveyLogic saves"
T_JEST_CROSS_LEG = "frontend/src/scenes/legacy.test.ts::legacy scene renders"
+T_SETUP_BREAK = "posthog/api/test/test_setup/TestSetup::test_errors_when_setup_breaks"
+T_SPAN_ONLY_BREAK = "posthog/api/test/test_setup/TestSetup::test_errors_without_a_broken_run"
class TestFlakyTestsAPI(ClickhouseTestMixin, APIBaseTest):
@@ -145,6 +148,33 @@ class TestFlakyTestsAPI(ClickhouseTestMixin, APIBaseTest):
),
# A job-root span carries no test.outcome and must never become a row.
cls._span(23, "Backend CI / core (1)", None, ts=recent, run="1300", branch="master"),
+ # CI setup broke: one run attempt errored tests in three jobs. The errors describe the attempt, not
+ # the tests, so none of them reaches the queue as a master failure.
+ *[
+ cls._span(
+ 40 + shard,
+ f"{T_SETUP_BREAK}_{shard}",
+ "error",
+ ts=recent,
+ run="1700",
+ branch="master",
+ job=f"backend:core:{shard}",
+ )
+ for shard in (1, 2, 3)
+ ],
+ # The same shape in a run GitHub reports as healthy.
+ *[
+ cls._span(
+ 50 + shard,
+ f"{T_SPAN_ONLY_BREAK}_{shard}",
+ "error",
+ ts=recent,
+ run="1800",
+ branch="master",
+ job=f"backend:core:{shard}",
+ )
+ for shard in (1, 2, 3)
+ ],
# Main Jest spans share the same evidence model. Recovery only counts within the
# stable FOSS/EE + shard job that failed.
cls._span(
@@ -290,6 +320,16 @@ class TestFlakyTestsAPI(ClickhouseTestMixin, APIBaseTest):
f"'{stamp}', '{stamp}', '{stamp}', 0, '{service}', {attrs}, {resource})"
)
+ def setUp(self) -> None:
+ super().setUp()
+ # Run 1700 failed across three jobs on GitHub; run 1800 passed. Only 1700 may drop evidence.
+ connect_github_jobs(
+ self,
+ prefix="flaky",
+ jobs=[(70 + shard, 1700, 1, "failure") for shard in (1, 2, 3)]
+ + [(80 + shard, 1800, 1, "success") for shard in (1, 2, 3)],
+ )
+
def _get(self, **params: str) -> dict:
response = self.client.get(f"/api/projects/{self.team.id}/engineering_analytics/flaky_tests/", params)
assert response.status_code == status.HTTP_200_OK, response.content
@@ -301,8 +341,9 @@ class TestFlakyTestsAPI(ClickhouseTestMixin, APIBaseTest):
def test_default_window_qualifies_only_actionable_tests(self) -> None:
data = self._get()
- # The 2-PR test is below the bar; the out-of-window, foreign-service, other-repo, and
- # outcome-less job-root spans must never qualify.
+ # The 2-PR test is below the bar; the out-of-window, foreign-service, other-repo, CI setup break,
+ # and outcome-less job-root spans must never qualify. Run 1800 carries run 1700's shape without
+ # GitHub's failed jobs, so its tests keep their failures.
assert {row["nodeid"] for row in data["items"]} == {
T_RERUN_RECOVERY,
T_STALE_REREPORT,
@@ -318,6 +359,7 @@ class TestFlakyTestsAPI(ClickhouseTestMixin, APIBaseTest):
T_NO_RUN_ID,
T_JEST_RECOVERY,
T_JEST_CROSS_LEG,
+ *(f"{T_SPAN_ONLY_BREAK}_{shard}" for shard in (1, 2, 3)),
}
assert data["truncated"] is False
assert data["limit"] == 50
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 405d46eeedfe..61cb4ed68af1 100644
--- a/products/engineering_analytics/backend/tests/test_team_ci_health.py
+++ b/products/engineering_analytics/backend/tests/test_team_ci_health.py
@@ -8,7 +8,10 @@ from posthog.clickhouse.client import sync_execute
from posthog.clickhouse.traces.spans import TRACE_SPANS_DISTRIBUTED_TABLE_SQL, TRACE_SPANS_TABLE_SQL
from products.engineering_analytics.backend.logic.census import CENSUS_EVENT
-from products.engineering_analytics.backend.tests._github_fixtures import connect_github_source_without_data
+from products.engineering_analytics.backend.tests._github_fixtures import (
+ connect_github_jobs,
+ connect_github_source_without_data,
+)
T_REPLAY_PRS = "products/replay/backend/tests/test_snap/TestSnap::test_prs"
T_REPLAY_RERUN = "products/replay/backend/tests/test_playlist/TestPlaylist::test_rerun"
@@ -19,6 +22,9 @@ 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"
+T_SETUP_TEAM_A = "posthog/api/test/test_setup/TestSetup::test_team_a"
+T_SETUP_TEAM_B = "posthog/api/test/test_setup/TestSetup::test_team_b"
+T_SETUP_TEAM_C = "posthog/api/test/test_setup/TestSetup::test_team_c"
class TestTeamCIHealthAPI(ClickhouseTestMixin, APIBaseTest):
@@ -110,6 +116,27 @@ class TestTeamCIHealthAPI(ClickhouseTestMixin, APIBaseTest):
# The latest stamp owns the whole test, in the roster and the drill-in alike.
cls._span(18, T_RESTAMPED, "failed", ts=prior, owner="team-old", run="601", pr="601"),
cls._span(16, T_RESTAMPED, "failed", ts=cls.current_b, owner="team-new", run="602", pr="602"),
+ # CI setup broke in run 901: its tests errored in three jobs at once. That is not evidence about
+ # any of these tests, so no team gains a failed run or a signal from it.
+ cls._span(30, T_REPLAY_PRS, "error", ts=cls.current_b, owner="team-replay", run="901", pr="901", job="a"),
+ cls._span(31, T_REPLAY_RERUN, "error", ts=cls.current_b, owner="team-replay", run="901", pr="901", job="b"),
+ cls._span(32, T_UNOWNED, "error", ts=cls.current_b, owner="", run="901", pr="901", job="c"),
+ # Three owning teams in one job also identify a setup break.
+ cls._span(33, T_SETUP_TEAM_A, "error", ts=cls.current_b, owner="team-setup-a", run="902", job="shared"),
+ cls._span(34, T_SETUP_TEAM_B, "error", ts=cls.current_b, owner="team-setup-b", run="902", job="shared"),
+ cls._span(35, T_SETUP_TEAM_C, "error", ts=cls.current_b, owner="team-setup-c", run="902", job="shared"),
+ # Unowned tests do not form a third owning team, so this run remains test evidence.
+ cls._span(36, T_REPLAY_PRS, "error", ts=cls.current_b, owner="team-replay", run="903", job="shared"),
+ cls._span(
+ 37,
+ T_EXPORTS_RECOVERED,
+ "error",
+ ts=cls.current_b,
+ owner="batch-exports",
+ run="903",
+ job="shared",
+ ),
+ cls._span(38, T_UNOWNED, "error", ts=cls.current_b, owner="", run="903", job="shared"),
# 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'.
@@ -158,10 +185,13 @@ class TestTeamCIHealthAPI(ClickhouseTestMixin, APIBaseTest):
attempt: str = "1",
pr: str = "",
service: str = "ci-backend",
+ job: str = "",
) -> str:
attr_pairs = [f"'test.outcome__str', '{outcome}'"]
if owner:
attr_pairs.append(f"'test.owner_team__str', '{owner}'")
+ if job:
+ attr_pairs.append(f"'test.job_key__str', '{job}'")
resource_pairs = [
"'ci.repository', 'PostHog/posthog'",
f"'ci.run_id', '{run}'",
@@ -176,6 +206,15 @@ class TestTeamCIHealthAPI(ClickhouseTestMixin, APIBaseTest):
f"map({', '.join(resource_pairs)}))"
)
+ def setUp(self) -> None:
+ super().setUp()
+ # Both runs whose spans read as a setup break failed across three jobs on GitHub too.
+ connect_github_jobs(
+ self,
+ prefix="teams",
+ jobs=[(run * 10 + index, run, 1, "failure") for run in (901, 902) for index in (1, 2, 3)],
+ )
+
def _get(self, endpoint: str, **params: str) -> dict:
response = self.client.get(f"/api/projects/{self.team.id}/engineering_analytics/{endpoint}/", params)
assert response.status_code == status.HTTP_200_OK, response.content
@@ -192,7 +231,8 @@ class TestTeamCIHealthAPI(ClickhouseTestMixin, APIBaseTest):
replay = rows["team-replay"]
assert (replay["flaky_test_count"], replay["regression_test_count"]) == (1, 1)
assert (replay["flaky_test_count_prior"], replay["regression_test_count_prior"]) == (2, 0)
- assert (replay["failed_run_count"], replay["failed_run_count_prior"]) == (3, 1)
+ # The setup break in run 901 errored this team's tests too, and adds no failed run.
+ assert (replay["failed_run_count"], replay["failed_run_count_prior"]) == (4, 1)
assert (replay["same_commit_recovery_run_count"], replay["same_commit_recovery_run_count_prior"]) == (1, 2)
# Two owned tests were quarantined in the same run in each window.
assert (replay["quarantined_failed_run_count"], replay["quarantined_failed_run_count_prior"]) == (1, 1)
@@ -200,6 +240,7 @@ class TestTeamCIHealthAPI(ClickhouseTestMixin, APIBaseTest):
# 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
+ assert not {"team-setup-a", "team-setup-b", "team-setup-c"} & rows.keys()
# 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.
@@ -207,7 +248,7 @@ class TestTeamCIHealthAPI(ClickhouseTestMixin, APIBaseTest):
assert (exports["flaky_test_count"], exports["regression_test_count"]) == (2, 0)
assert (exports["flaky_test_count_prior"], exports["regression_test_count_prior"]) == (1, 1)
# Two owned tests failed and recovered in one shared run in each window.
- assert (exports["failed_run_count"], exports["failed_run_count_prior"]) == (1, 3)
+ assert (exports["failed_run_count"], exports["failed_run_count_prior"]) == (2, 3)
assert (exports["same_commit_recovery_run_count"], exports["same_commit_recovery_run_count_prior"]) == (1, 1)
# The foreign-service span's team must not appear at all.
@@ -236,7 +277,7 @@ class TestTeamCIHealthAPI(ClickhouseTestMixin, APIBaseTest):
assert data["owner_team"] == "team-replay"
# Before/after pairs: ranked by the stronger window, xfail excluded from signal.
assert [(t["nodeid"], t["signal_count"], t["signal_count_prior"]) for t in data["tests"]] == [
- (T_REPLAY_PRS, 3, 2),
+ (T_REPLAY_PRS, 4, 2),
(T_REPLAY_RERUN, 1, 2),
]
assert not data["truncated_tests"]
diff --git a/products/engineering_analytics/frontend/generated/api.schemas.ts b/products/engineering_analytics/frontend/generated/api.schemas.ts
index 18e3f1d039a7..00b3a382f868 100644
--- a/products/engineering_analytics/frontend/generated/api.schemas.ts
+++ b/products/engineering_analytics/frontend/generated/api.schemas.ts
@@ -674,7 +674,7 @@ export interface FlakyTestItemApi {
}
export interface FlakyTestListApi {
- /** Tests worth acting on now, ranked by blast radius: master failures, then PRs hit, then runs. */
+ /** Tests worth acting on now, ranked by blast radius: master failures, then PRs hit, then runs. A CI setup break (a run attempt whose tests errored in 3 or more jobs or for 3 or more owning teams) excludes every trial of that attempt, not only its failures. */
items: FlakyTestItemApi[]
/** True when more tests qualified than the cap; `items` is the highest-ranked `limit` rows. */
truncated: boolean
@@ -1831,7 +1831,7 @@ export interface TeamCIHealthItemApi {
}
export interface TeamCIHealthListApi {
- /** Owning teams ranked by current flaky + failure signal, heaviest first, capped at `limit`. Teams are organizational owners of code surfaces; this never aggregates by author. */
+ /** Owning teams ranked by current flaky + failure signal, heaviest first, capped at `limit`. Teams are organizational owners of code surfaces; this never aggregates by author. A CI setup break (a run attempt whose tests errored in 3 or more jobs or for 3 or more owning teams) excludes every trial of that attempt, not only its failures. */
items: TeamCIHealthItemApi[]
/** True when more teams had signal than the cap. */
truncated: boolean
diff --git a/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsTeamScene.tsx b/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsTeamScene.tsx
index 6c3c23c4d7df..a64ec9d5621f 100644
--- a/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsTeamScene.tsx
+++ b/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsTeamScene.tsx
@@ -94,7 +94,7 @@ export function EngineeringAnalyticsTeamScene(): JSX.Element {
width: 140,
align: 'right',
tooltip:
- 'Runs where this test failed, errored, or a retry recovered it. Fixed window; the picker above does not move this list.',
+ 'Runs where this test failed, errored, or a retry recovered it. Failures from a CI setup break are left out. Fixed window; the picker above does not move this list.',
sorter: (a, b) => a.signalCount - b.signalCount,
render: (_, row) => <CountCell value={row.signalCount} />,
},
@@ -170,7 +170,7 @@ export function EngineeringAnalyticsTeamScene(): JSX.Element {
/>
<WindowComparisonCard
title="Failed runs"
- tooltip="CI runs where at least one test this team owns failed or errored. A run counts once, however many tests failed. Absolute counts, not rates: passing runs are mostly not recorded."
+ tooltip="CI runs where at least one test this team owns failed or errored. A run counts once, however many tests failed. Runs where CI setup broke tests across many jobs or teams are left out. Absolute counts, not rates: passing runs are mostly not recorded."
value={healthRow?.failedRunCount}
previousValue={healthRow?.failedRunCountPrior}
formatValue={humanFriendlyNumber}
diff --git a/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsTeams.tsx b/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsTeams.tsx
index 0264074b4862..ec5893aa10ef 100644
--- a/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsTeams.tsx
+++ b/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsTeams.tsx
@@ -75,7 +75,7 @@ export function EngineeringAnalyticsTeams(): JSX.Element {
key: 'regressionTestCount',
width: 120,
align: 'right',
- tooltip: `Owned tests that failed in the ${FIXED_WINDOW} with no recorded recovery and still hit several PRs or master. Treat as real breaks until a recovery proves otherwise.`,
+ tooltip: `Owned tests that failed in the ${FIXED_WINDOW} with no recorded recovery and still hit several PRs or master. Failures from a CI setup break are left out. Treat as real breaks until a recovery proves otherwise.`,
sorter: (a, b) => a.regressionTestCount - b.regressionTestCount,
render: (_, row) => <CountCell value={row.regressionTestCount} />,
},
diff --git a/products/engineering_analytics/mcp/tools.yaml b/products/engineering_analytics/mcp/tools.yaml
index 7c1752fffe77..325badd7f90e 100644
--- a/products/engineering_analytics/mcp/tools.yaml
+++ b/products/engineering_analytics/mcp/tools.yaml
@@ -131,8 +131,10 @@ tools:
suspected_regression means only failures were recorded, which is absence of proof, not proof of a real
break: treat it as real until a recovery proves otherwise. A test qualifies on any same-commit recovery, any
master/main failure, a quarantined failure, or failures on at least min_failed_prs distinct PRs (default 3).
- Counts are absolute, never rates, because fast passing runs are not emitted. Use selector to run or
- quarantine the test with its runner; nodeid is only the stable grouping key.
+ Failures from a CI setup break are not per-test evidence and are left out: a run attempt whose tests errored
+ in three or more jobs or for three or more owning teams. Counts are absolute, never rates, because fast
+ passing runs are not emitted. Use selector to run or quarantine the test with its runner; nodeid is only the
+ stable grouping key.
feature_flag: engineering-analytics
engineering-analytics-job-aggregates:
operation: engineering_analytics_job_aggregates
@@ -247,16 +249,18 @@ tools:
(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 and quarantined_failed_run_count count distinct CI runs across the team's
- owned tests, so one run with many failing tests counts once. 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. Each row also carries test_file_count (the daily owners.yaml census
- denominator, with a window-start twin) and merged_pr_count (merged PRs by the team's members, bots
- excluded); teams with census counts but no CI signal appear with zero signal counts and a null last_seen_at.
- 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.
+ owned tests, so one run with many failing tests counts once. Failures from a CI setup break are not per-test
+ evidence and are left out: a run attempt whose tests errored in three or more jobs or for three or more
+ owning teams. 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. Each
+ row also carries test_file_count (the daily owners.yaml census denominator, with a window-start twin) and
+ merged_pr_count (merged PRs by the team's members, bots excluded); teams with census counts but no CI signal
+ appear with zero signal counts and a null last_seen_at. 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.
feature_flag: engineering-analytics
engineering-analytics-team-merge-trend:
operation: engineering_analytics_team_merge_trend
diff --git a/products/engineering_analytics/skills/diagnosing-ci-and-merge-bottlenecks/SKILL.md b/products/engineering_analytics/skills/diagnosing-ci-and-merge-bottlenecks/SKILL.md
index 1ce1cd7a03e8..6452b42e4c1c 100644
--- a/products/engineering_analytics/skills/diagnosing-ci-and-merge-bottlenecks/SKILL.md
+++ b/products/engineering_analytics/skills/diagnosing-ci-and-merge-bottlenecks/SKILL.md
@@ -55,7 +55,9 @@ to take one failing test or red run to a verdict, switch to the `investigating-c
quarantine candidates. **It does not answer "which tests are flaky"**: this queue only sees the main Backend pytest
and Frontend Jest suites, and recovery proof only arrives when someone re-runs failed jobs (or a pytest test is hand-marked
`@pytest.mark.flaky(reruns=N)`). Counts are absolute signal, never rates: passing runs are mostly not
- emitted, so there is no honest denominator.
+ emitted, so there is no honest denominator. Failures from a CI setup break are left out: a run attempt whose
+ tests errored in 3 or more jobs or for 3 or more owning teams. A real break that wide is left out too, so when a
+ whole suite goes red, check `workflow-health` rather than reading an empty queue as healthy.
- **`engineering-analytics-sources`**: the team's connected GitHub sources and repos. With more than one of
either, call it first and pass the chosen entry's `source_id` **and** `repo` to `pull-requests`,
diff --git a/services/mcp/schema/generated-tool-definitions.json b/services/mcp/schema/generated-tool-definitions.json
index 9c2a99f01e69..7800b880809e 100644
--- a/services/mcp/schema/generated-tool-definitions.json
+++ b/services/mcp/schema/generated-tool-definitions.json
@@ -3626,7 +3626,7 @@
"feature_flag": "engineering-analytics"
},
"engineering-analytics-flaky-tests": {
- "description": "Pytest and Jest tests worth acting on now, from the per-test CI spans over a window (date_from default -7d, maximum 30 days), ranked by blast radius: master failures first, then how many distinct PRs the test broke. Use this for \"what is this failing test costing us\" and to pick quarantine candidates. It does not measure flake rates. This data sees the main Backend pytest and Frontend Jest suites; package-specific runners are not included. Evidence is counted per CI run, never per span or run attempt: one run fans a test across matrix legs, and re-run attempts re-test the same commit. classification is confirmed_flake only when one commit both failed and passed the test (same_commit_recovery_run_count > 0): a \"Re-run failed jobs\" attempt went green on the same commit, or an in-job pytest retry (tests hand-marked @pytest.mark.flaky(reruns=N)) recovered it. quarantined means a tolerated failure was recorded while the test was masked. suspected_regression means only failures were recorded, which is absence of proof, not proof of a real break: treat it as real until a recovery proves otherwise. A test qualifies on any same-commit recovery, any master/main failure, a quarantined failure, or failures on at least min_failed_prs distinct PRs (default 3). Counts are absolute, never rates, because fast passing runs are not emitted. Use selector to run or quarantine the test with its runner; nodeid is only the stable grouping key.",
+ "description": "Pytest and Jest tests worth acting on now, from the per-test CI spans over a window (date_from default -7d, maximum 30 days), ranked by blast radius: master failures first, then how many distinct PRs the test broke. Use this for \"what is this failing test costing us\" and to pick quarantine candidates. It does not measure flake rates. This data sees the main Backend pytest and Frontend Jest suites; package-specific runners are not included. Evidence is counted per CI run, never per span or run attempt: one run fans a test across matrix legs, and re-run attempts re-test the same commit. classification is confirmed_flake only when one commit both failed and passed the test (same_commit_recovery_run_count > 0): a \"Re-run failed jobs\" attempt went green on the same commit, or an in-job pytest retry (tests hand-marked @pytest.mark.flaky(reruns=N)) recovered it. quarantined means a tolerated failure was recorded while the test was masked. suspected_regression means only failures were recorded, which is absence of proof, not proof of a real break: treat it as real until a recovery proves otherwise. A test qualifies on any same-commit recovery, any master/main failure, a quarantined failure, or failures on at least min_failed_prs distinct PRs (default 3). Failures from a CI setup break are not per-test evidence and are left out: a run attempt whose tests errored in three or more jobs or for three or more owning teams. Counts are absolute, never rates, because fast passing runs are not emitted. Use selector to run or quarantine the test with its runner; nodeid is only the stable grouping key.",
"category": "Engineering analytics",
"feature": "engineering_analytics",
"summary": "Active test health queue",
@@ -3686,7 +3686,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 and quarantined_failed_run_count count distinct CI runs across the team's owned tests, so one run with many failing tests counts once. 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. Each row also carries test_file_count (the daily owners.yaml census denominator, with a window-start twin) and merged_pr_count (merged PRs by the team's members, bots excluded); teams with census counts but no CI signal appear with zero signal counts and a null last_seen_at. 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 and quarantined_failed_run_count count distinct CI runs across the team's owned tests, so one run with many failing tests counts once. Failures from a CI setup break are not per-test evidence and are left out: a run attempt whose tests errored in three or more jobs or for three or more owning teams. 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. Each row also carries test_file_count (the daily owners.yaml census denominator, with a window-start twin) and merged_pr_count (merged PRs by the team's members, bots excluded); teams with census counts but no CI signal appear with zero signal counts and a null last_seen_at. 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 976c0c8e35ed..5e8ea23f9c13 100644
--- a/services/mcp/schema/tool-definitions-all.json
+++ b/services/mcp/schema/tool-definitions-all.json
@@ -3655,7 +3655,7 @@
"feature_flag": "engineering-analytics"
},
"engineering-analytics-flaky-tests": {
- "description": "Pytest and Jest tests worth acting on now, from the per-test CI spans over a window (date_from default -7d, maximum 30 days), ranked by blast radius: master failures first, then how many distinct PRs the test broke. Use this for \"what is this failing test costing us\" and to pick quarantine candidates. It does not measure flake rates. This data sees the main Backend pytest and Frontend Jest suites; package-specific runners are not included. Evidence is counted per CI run, never per span or run attempt: one run fans a test across matrix legs, and re-run attempts re-test the same commit. classification is confirmed_flake only when one commit both failed and passed the test (same_commit_recovery_run_count > 0): a \"Re-run failed jobs\" attempt went green on the same commit, or an in-job pytest retry (tests hand-marked @pytest.mark.flaky(reruns=N)) recovered it. quarantined means a tolerated failure was recorded while the test was masked. suspected_regression means only failures were recorded, which is absence of proof, not proof of a real break: treat it as real until a recovery proves otherwise. A test qualifies on any same-commit recovery, any master/main failure, a quarantined failure, or failures on at least min_failed_prs distinct PRs (default 3). Counts are absolute, never rates, because fast passing runs are not emitted. Use selector to run or quarantine the test with its runner; nodeid is only the stable grouping key.",
+ "description": "Pytest and Jest tests worth acting on now, from the per-test CI spans over a window (date_from default -7d, maximum 30 days), ranked by blast radius: master failures first, then how many distinct PRs the test broke. Use this for \"what is this failing test costing us\" and to pick quarantine candidates. It does not measure flake rates. This data sees the main Backend pytest and Frontend Jest suites; package-specific runners are not included. Evidence is counted per CI run, never per span or run attempt: one run fans a test across matrix legs, and re-run attempts re-test the same commit. classification is confirmed_flake only when one commit both failed and passed the test (same_commit_recovery_run_count > 0): a \"Re-run failed jobs\" attempt went green on the same commit, or an in-job pytest retry (tests hand-marked @pytest.mark.flaky(reruns=N)) recovered it. quarantined means a tolerated failure was recorded while the test was masked. suspected_regression means only failures were recorded, which is absence of proof, not proof of a real break: treat it as real until a recovery proves otherwise. A test qualifies on any same-commit recovery, any master/main failure, a quarantined failure, or failures on at least min_failed_prs distinct PRs (default 3). Failures from a CI setup break are not per-test evidence and are left out: a run attempt whose tests errored in three or more jobs or for three or more owning teams. Counts are absolute, never rates, because fast passing runs are not emitted. Use selector to run or quarantine the test with its runner; nodeid is only the stable grouping key.",
"category": "Engineering analytics",
"feature": "engineering_analytics",
"summary": "Active test health queue",
@@ -3715,7 +3715,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 and quarantined_failed_run_count count distinct CI runs across the team's owned tests, so one run with many failing tests counts once. 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. Each row also carries test_file_count (the daily owners.yaml census denominator, with a window-start twin) and merged_pr_count (merged PRs by the team's members, bots excluded); teams with census counts but no CI signal appear with zero signal counts and a null last_seen_at. 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 and quarantined_failed_run_count count distinct CI runs across the team's owned tests, so one run with many failing tests counts once. Failures from a CI setup break are not per-test evidence and are left out: a run attempt whose tests errored in three or more jobs or for three or more owning teams. 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. Each row also carries test_file_count (the daily owners.yaml census denominator, with a window-start twin) and merged_pr_count (merged PRs by the team's members, bots excluded); teams with census counts but no CI signal appear with zero signal counts and a null last_seen_at. 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/api/generated.ts b/services/mcp/src/api/generated.ts
index fd4918dfea12..89727715417a 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -44688,7 +44688,7 @@ export namespace Schemas {
}
export interface FlakyTestList {
- /** Tests worth acting on now, ranked by blast radius: master failures, then PRs hit, then runs. */
+ /** Tests worth acting on now, ranked by blast radius: master failures, then PRs hit, then runs. A CI setup break (a run attempt whose tests errored in 3 or more jobs or for 3 or more owning teams) excludes every trial of that attempt, not only its failures. */
items: FlakyTestItem[];
/** True when more tests qualified than the cap; `items` is the highest-ranked `limit` rows. */
truncated: boolean;
@@ -94047,7 +94047,7 @@ export namespace Schemas {
}
export interface TeamCIHealthList {
- /** Owning teams ranked by current flaky + failure signal, heaviest first, capped at `limit`. Teams are organizational owners of code surfaces; this never aggregates by author. */
+ /** Owning teams ranked by current flaky + failure signal, heaviest first, capped at `limit`. Teams are organizational owners of code surfaces; this never aggregates by author. A CI setup break (a run attempt whose tests errored in 3 or more jobs or for 3 or more owning teams) excludes every trial of that attempt, not only its failures. */
items: TeamCIHealthItem[];
/** True when more teams had signal than the cap. */
truncated: boolean;