Skip to content

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

feat(eng-analytics): surface jest flake signals (#73529)

Raúl Negrón-Otero53f458b9b499
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index 6692e89c5f10..d3d3d6cc7823 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -5835,9 +5835,9 @@ snapshots:
scenes-app-engineering-analytics-run-activity-chart--default--light:
hash: v1.k794b7964.f63752ff3ebf3bbee3be4ddc83d1ff657d9cdd11ee71e7283c30ce5a1aefde72.yTb8kpRqcG51TbM2CqgRmC5YvgE7-6pV1Trc7y5wuto
scenes-app-engineering-analytics-test-health--flaky-test-leaderboard--dark:
- hash: v1.k794b7964.c8a8c1d5961339dd76602d92f48e05ea11d10b19b8ca611dce24a4e71eed8a3b.BayfjT4SJzeM7T1GCHDLs1Pi1ZF6vTwvR87EbTGr34A
+ hash: v1.k794b7964.c98cc471c1295d40d038bf9c6a736938a5ec83a8a234c097d6ade53af5030e6b.Iw4Vnxse9g4724P6L0DE6v4VMaIK5iSA4Ff5qrn7QNY
scenes-app-engineering-analytics-test-health--flaky-test-leaderboard--light:
- hash: v1.k794b7964.5804098730db9c4faeb0bc5c4b43298e4e7fd3f77e5e1f43b65a4e03352c3132.b558b-H8LxsRoTNzDqhfKG4kbNprgpdaFRgoh6vB8_M
+ hash: v1.k794b7964.49559d09c657cd6bebf3727cacf099920163509135d94e6bec2083d985b660cd.olM5jO2nt6jwnO34JFgHbesl3JNJblIFf03bx7WUY7s
scenes-app-error-project-unavailable--access-revoked--dark:
hash: v1.k794b7964.30ace8f015100159e1dedbed07ff9f0b0b770535870d5c98ea764b10ff1f7621.dTVw9qLa7D_e7ZNme4tVuPZov-0Gg1o84aiDl5zihF0
scenes-app-error-project-unavailable--access-revoked--light:
diff --git a/posthog/settings/web.py b/posthog/settings/web.py
index 5fd278ab99f9..ccbcddb030c4 100644
--- a/posthog/settings/web.py
+++ b/posthog/settings/web.py
@@ -552,6 +552,7 @@ SPECTACULAR_SETTINGS = {
"SignalReportRefundReasonEnum": "products.signals.backend.models.SignalReportRefund.Reason",
"EngineeringAnalyticsPRStateEnum": "products.engineering_analytics.backend.facade.contracts.PRState",
"QuarantineModeEnum": "products.engineering_analytics.backend.facade.contracts.QuarantineMode",
+ "CITestRunnerEnum": "products.engineering_analytics.backend.facade.contracts.CITestRunner",
"RestrictionLevelEnum": "products.dashboards.backend.models.dashboard.Dashboard.RestrictionLevel",
"OrganizationMembershipLevelEnum": "posthog.models.organization.OrganizationMembership.Level",
"SetupTaskId": "posthog.models.team.setup_tasks.SetupTaskId",
diff --git a/products/engineering_analytics/README.md b/products/engineering_analytics/README.md
index fb15fcbbc927..755fae699b07 100644
--- a/products/engineering_analytics/README.md
+++ b/products/engineering_analytics/README.md
@@ -66,7 +66,7 @@ graph LR
subgraph "Data in"
WH[("warehouse: GitHub source<br/>pull_requests / workflow_runs<br/>workflow_jobs / team_members")]
LOGS[("Logs: github-ci-logs<br/>thinned CI failure lines")]
- TRACES[("Traces: per-test CI spans<br/>emitted by Backend CI")]
+ TRACES[("Traces: per-test CI spans<br/>emitted by Backend and Frontend CI")]
end
JL["Temporal job-logs pipeline<br/>fetches + thins failed jobs' logs"] --> LOGS
CUR["curated HogQL builders<br/>run privately, never global views"]
@@ -82,7 +82,7 @@ graph LR
- Job-level CI: per-job duration, queue time, runner tier, and dollar cost ride `workflow_jobs` (webhook stream plus bounded backfill).
- One write surface: test quarantine. The UI files a tracking issue plus a PR against the repo's checked-in `.test_quarantine.json` through the team's GitHub App. Everything else is read-only.
-- The test-health view is an active work queue, not a failure-rate leaderboard: evidence is counted per CI run, a test is called flaky only where the evidence proves it (one commit was seen both failing and passing it: a re-run attempt going green, or an in-job retry), and every other failure ranks as an honest suspected regression by blast radius.
+- The test-health view is an active work queue, not a failure-rate leaderboard: the main pytest and Jest suites emit failures and same-job re-run recovery evidence. Jest writes a small marker beside JUnit when quarantine tolerates a failure, so masking it does not erase the signal. Evidence is counted per CI run, a test is called flaky only where one commit was seen both failing and passing it, and every other failure ranks as an honest suspected regression by blast radius.
- Access control: per-user warehouse RBAC at the source resolver, `engineering_analytics:read` scopes on tools, feature-flag gated.
## The goal: CI Signals for PostHog Desktop
diff --git a/products/engineering_analytics/SPEC.md b/products/engineering_analytics/SPEC.md
index 2c94c2a5b2a3..df866f45627f 100644
--- a/products/engineering_analytics/SPEC.md
+++ b/products/engineering_analytics/SPEC.md
@@ -46,7 +46,7 @@ graph TB
subgraph Storage
WH[("warehouse: GitHub source<br/>pull_requests / workflow_runs<br/>workflow_jobs / team_members")]
LOGS[("Logs: github-ci-logs<br/>thinned CI failure lines")]
- TRACES[("Traces: per-test CI spans<br/>from Backend CI")]
+ TRACES[("Traces: per-test CI spans<br/>from Backend and Frontend CI")]
end
JL["Temporal job-logs pipeline"] --> LOGS
@@ -150,7 +150,7 @@ Warehouse tables (GitHub source):
Other products read as sources:
- Logs: the thinned CI failure lines this product's job-logs pipeline emits (`service.name = github-ci-logs`), keyed by `run_id`.
-- Traces: per-test CI spans emitted by Backend CI (`trace_spans`), behind flaky tests and team CI health.
+- Traces: per-test CI spans emitted by the main Backend pytest and Frontend Jest suites (`trace_spans`), behind flaky tests and team CI health. Jest covers both legacy `frontend/` tests and isolated product frontends through the shared root config; its quarantine adapter records tolerated failures beside JUnit so the trusted reporter can retain that evidence. Package-specific Jest and Vitest jobs are outside this signal.
**Freshness caveat:** a run's `conclusion` settles via the `workflow_run` webhook, which can lag or miss deliveries; the read layer surfaces `status` honestly rather than implying a settled conclusion.
diff --git a/products/engineering_analytics/backend/facade/contracts.py b/products/engineering_analytics/backend/facade/contracts.py
index 463839e7dd41..b93206735623 100644
--- a/products/engineering_analytics/backend/facade/contracts.py
+++ b/products/engineering_analytics/backend/facade/contracts.py
@@ -147,6 +147,17 @@ class QuarantineMode(StrEnum):
SKIP = "skip"
+class CITestRunner(StrEnum):
+ PYTEST = "pytest"
+ JEST = "jest"
+
+
+class QuarantineRunner(StrEnum):
+ PYTEST = "pytest"
+ JEST = "jest"
+ PLAYWRIGHT = "playwright"
+
+
class QuarantineLifecycle(StrEnum):
"""Where an entry sits relative to its expiry: ``active`` (more than 7 days
left), ``expiring_soon`` (7 days or fewer left), ``in_grace`` (expired up to
@@ -518,8 +529,8 @@ class CIFailureLogs:
# The one caveat that governs every flaky figure, defined once here (the canonical-types home)
# so the API/MCP description and any other consumer-facing copy read from it instead of drifting.
FLAKY_TEST_SIGNAL_CAVEAT = (
- "Counts are absolute, never rates: CI emits a span for every failure but only for passes slow "
- "enough to clear the emitter's duration threshold, so there is no execution denominator. "
+ "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."
)
@@ -529,14 +540,14 @@ class FlakyTestClassification(StrEnum):
CONFIRMED_FLAKE = "confirmed_flake"
# Only failures recorded, which is absence of proof, not proof of a regression.
SUSPECTED_REGRESSION = "suspected_regression"
- # Failing while masked as xfail.
+ # A tolerated failure recorded while the test is masked by quarantine.
QUARANTINED = "quarantined"
@classmethod
def from_run_evidence(
cls, *, quarantined_failed_run_count: int, same_commit_recovery_run_count: int
) -> "FlakyTestClassification":
- # Quarantine wins over a recovery proof: an xfail is already masked, so surface that first.
+ # Quarantine wins over a recovery proof: it is already masked, so surface that first.
if quarantined_failed_run_count > 0:
return cls.QUARANTINED
if same_commit_recovery_run_count > 0:
@@ -549,16 +560,16 @@ class FlakyTestItem:
"""One test in the active test-health queue, aggregated from the per-test CI spans in the Traces store.
Ranked by blast radius: what a failing test costs, not how often it flakes. This queue only
- sees Backend CI. 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, so only the run grain
- counts one failure once. See ``FLAKY_TEST_SIGNAL_CAVEAT`` for why every figure is an absolute
- count.
+ sees the main pytest and Jest CI suites. 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, so
+ only the run grain counts one failure once. See ``FLAKY_TEST_SIGNAL_CAVEAT`` for why every figure
+ is an absolute count.
"""
- # Reconstructed pytest nodeid (the span name), e.g. 'posthog/api/test/test_x/TestX::test_y'.
+ runner: CITestRunner
+ # Stable test identity (the span name), runner-specific and not necessarily runnable.
nodeid: str
- # Runnable pytest selector ('posthog/api/test/test_x.py::TestX::test_y'). Exact when the CI
- # reporter stamped it; reconstructed from the nodeid (file/class boundary guessed) for older spans.
+ # Runnable selector. Exact when the CI reporter stamped it; best-effort for older pytest spans.
selector: str
classification: FlakyTestClassification
# Runs where one commit both failed and passed the test: a later run attempt going green, or an
@@ -578,7 +589,7 @@ class FlakyTestList:
"""The active test-health queue for a window: tests with a live failure signal, ranked by blast
radius (trunk first, then PRs, then runs), capped at ``limit`` with an explicit truncation flag
(same shape as ``PullRequestList``). A test qualifies on any same-commit recovery, any
- default-branch failure, failures on at least ``min_failed_prs`` distinct PRs, or an xfail.
+ default-branch failure, failures on at least ``min_failed_prs`` distinct PRs, or a quarantined failure.
"""
items: list[FlakyTestItem]
@@ -611,10 +622,10 @@ class TeamCIHealthItem:
failed_run_count_prior: int
same_commit_recovery_run_count: int
same_commit_recovery_run_count_prior: int
- # Runs where an owned test failed while quarantined (xfail): already masked, still failing.
+ # Runs where an owned test recorded a tolerated failure while quarantined: already masked, still failing.
quarantined_failed_run_count: int
quarantined_failed_run_count_prior: int
- # Most recent failure, recovery, or xfail run across the team's owned tests, either window.
+ # Most recent failure, recovery, or quarantined-failure run across the team's owned tests, either window.
last_seen_at: datetime
@@ -634,9 +645,10 @@ class TeamCIHealthList:
class TeamTestSignal:
"""One owned test's flaky signal across the current window and its equal-length prior
window, the pair behind a before-vs-after slope reading. Signal = failed + error +
- pass-on-retry spans (xfail excluded: already-quarantined noise).
+ pass-on-retry spans (quarantined failures excluded: already-masked noise).
"""
+ runner: CITestRunner
nodeid: str
selector: str
signal_count: int
@@ -857,6 +869,7 @@ class QuarantineRequest:
# serializers' 'action' enums in the OpenAPI spec and churns their generated types.
operation: QuarantineRequestAction
selector: str
+ runner: QuarantineRunner | None = None
repo: str | None = None
reason: str = ""
owner: str = ""
diff --git a/products/engineering_analytics/backend/logic/quarantine.py b/products/engineering_analytics/backend/logic/quarantine.py
index dbac8a3acf7a..7e4d73ff93ed 100644
--- a/products/engineering_analytics/backend/logic/quarantine.py
+++ b/products/engineering_analytics/backend/logic/quarantine.py
@@ -48,6 +48,7 @@ from products.engineering_analytics.backend.facade.contracts import (
QuarantineRequest,
QuarantineRequestAction,
QuarantineRequestResult,
+ QuarantineRunner,
QuarantineSelectorKind,
QuarantineWriteError,
RepoRef,
@@ -415,6 +416,7 @@ def _open_quarantine_pr(
commit_message = f"chore(ci): unquarantine {selector}"
pr_body = _remove_pr_body(selector, request)
else:
+ runner = _resolve_request_runner(request, selector, entries)
today = datetime.now(UTC).date()
expires = request.expires or today + timedelta(days=_DEFAULT_QUARANTINE_DAYS)
_validate_quarantine_inputs(request, today=today, expires=expires)
@@ -428,7 +430,7 @@ def _open_quarantine_pr(
new_entry = _canonical_entry(
{
"id": selector,
- "runner": _DEFAULT_RUNNER,
+ "runner": runner.value,
"reason": request.reason.strip(),
"owner": request.owner.strip(),
"issue": issue_url,
@@ -619,6 +621,26 @@ def _upsert_entry(entries: list[dict], new_entry: dict) -> list[dict]:
return [e for e in entries if (e["id"], e["runner"]) != key] + [new_entry]
+def _resolve_request_runner(request: QuarantineRequest, selector: str, entries: list[dict]) -> QuarantineRunner:
+ """Preserve old clients while refusing to guess across ambiguous existing entries."""
+ if request.runner is not None:
+ return request.runner
+ matching_runners = {entry["runner"] for entry in entries if entry["id"] == selector}
+ if len(matching_runners) == 1:
+ try:
+ return QuarantineRunner(next(iter(matching_runners)))
+ except ValueError as exc:
+ raise QuarantineWriteError(
+ f"'{selector}' uses an unsupported runner; update it in the quarantine file."
+ ) from exc
+ if matching_runners:
+ raise QuarantineWriteError(f"'{selector}' is quarantined for multiple runners; specify which runner.")
+ test_file = selector.partition("::")[0]
+ if PurePosixPath(test_file).suffix in (".js", ".jsx", ".ts", ".tsx"):
+ return QuarantineRunner.JEST
+ return QuarantineRunner.PYTEST
+
+
def _remove_entry(entries: list[dict], selector: str) -> list[dict]:
"""Drop the selector for every runner, matching the CLI's `remove`."""
return [e for e in entries if e["id"] != selector]
@@ -644,7 +666,7 @@ _GATE_FRESHNESS_NOTE = (
def _issue_body(selector: str, request: QuarantineRequest, expires: date) -> str:
mode_line = (
- "runs but cannot fail the suite (xfail)"
+ "runs, but tolerated failures do not fail the suite"
if request.mode == QuarantineMode.RUN
else "is skipped entirely (not collected)"
)
diff --git a/products/engineering_analytics/backend/logic/queries/_test_spans.py b/products/engineering_analytics/backend/logic/queries/_test_spans.py
index ee6d2e6a2f1d..45a6357ba56f 100644
--- a/products/engineering_analytics/backend/logic/queries/_test_spans.py
+++ b/products/engineering_analytics/backend/logic/queries/_test_spans.py
@@ -1,7 +1,7 @@
"""The one definition of the per-test CI span scan and what it proves (domain rules defined once, APOSD).
-Backend CI emits one OTel span per test into the Traces store (span name = reconstructed
-pytest nodeid, ``test.*`` attributes, ``ci.*`` resource attributes; see
+Backend and Frontend CI emit one OTel span per signal-bearing test into the Traces store
+(span name = runner-specific test identity, ``test.*`` attributes, ``ci.*`` resource attributes; see
``.github/scripts/report_test_timings.py``). Every query over that signal (the test-health
queue and the per-team rollups) embeds ``run_evidence()``, so the service fence, the signal
outcomes, the repository scoping, the ownership fallback, and above all the **grain** cannot
@@ -10,15 +10,16 @@ and they disagreed.
The grain is the CI run, not the span and not the run attempt:
-- One run fans a test out across matrix legs (person-on-events, compat, and friends), so span-grain
+- One run fans a test out across matrix legs (person-on-events, FOSS/EE, and friends), so span-grain
counting multiplies a single failure by the number of legs that ran it. At run grain a failure in
any leg counts once, and outweighs a pass in another.
- Every attempt of a run tests the same commit, so attempts are repeated trials: a run that both
failed and passed a test has proven it nondeterministic, whichever attempt failed first. That is
- what ``recovered_in_run`` means. Backend CI runs pytest without ``--reruns`` deliberately (failures
- stay visible instead of being retried away), so a "re-run failed jobs" recovery is where that proof
- comes from; ``rerun_passed`` is the same proof from the handful of tests hand-marked
- ``@pytest.mark.flaky(reruns=N)``.
+ what ``recovered_in_run`` means. Recovery must happen in the same stable matrix job as the failure;
+ a pass under a different configuration proves nothing. Backend CI runs pytest without ``--reruns``
+ deliberately (failures stay visible instead of being retried away), so a "re-run failed jobs"
+ recovery is where that proof comes from; ``rerun_passed`` is the same proof from the handful of
+ tests hand-marked ``@pytest.mark.flaky(reruns=N)``.
Failures with no recovery prove nothing about determinism. This surface answers how much a failing
test costs us, so unproven failures are ranked by blast radius and never called flaky.
@@ -36,7 +37,9 @@ SIGNAL_OUTCOMES = ["failed", "error", "rerun_passed", "xfailed"]
# Scope to the CI test-timing emitter (report_test_timings.py sets this as service.name);
# without it any team span carrying a test.outcome attribute would pollute.
-CI_SERVICE_NAME = "ci-backend"
+PYTEST_CI_SERVICE_NAME = "ci-backend"
+JEST_CI_SERVICE_NAME = "ci-frontend"
+CI_SERVICE_NAMES = [PYTEST_CI_SERVICE_NAME, JEST_CI_SERVICE_NAME]
# Spans emitted before the owner stamp existed (or from paths with no owner) group here.
UNOWNED_TEAM = "unowned"
@@ -44,41 +47,63 @@ UNOWNED_TEAM = "unowned"
_RUN_EVIDENCE = """
SELECT
+ runner,
nodeid,
run_id,
- argMax(owner_team, trial_at) AS owner_team,
+ argMax(owner_team, job_at) AS owner_team,
anyIf(selector, selector != '') AS selector,
anyIf(pr_number, pr_number != '') AS pr_number,
anyIf(branch, branch != '') AS branch,
max(is_current) AS is_current,
- max(trial_failed) AS failed_in_run,
- max(trial_quarantined) AS quarantined_in_run,
- -- Proof of nondeterminism either way it lands: an in-job retry recovered the test, or one
- -- attempt of the run failed it and another attempt (same commit) passed it.
- max(trial_rerun_passed) OR (max(trial_failed) AND max(trial_passed)) AS recovered_in_run,
+ max(job_failed) AS failed_in_run,
+ max(job_quarantined) AS quarantined_in_run,
+ max(job_recovered) AS recovered_in_run,
-- Recovery passes are not signal, so recency comes from the signal trials alone.
- maxIf(trial_at, trial_failed OR trial_rerun_passed OR trial_quarantined) AS run_signal_at
+ max(job_signal_at) AS run_signal_at
FROM (
- -- One row per (test, run attempt). A test can appear in several matrix legs of one attempt
- -- (and older data re-reported shards an attempt never re-executed); a failure in any leg
- -- outweighs a pass in another, so a cross-leg pass never reads as recovery.
+ -- One row per stable matrix job and run. Recovery can only pair trials from this job; a
+ -- FOSS pass cannot recover an EE failure, nor can one backend matrix leg recover another.
SELECT
+ runner,
nodeid,
run_id,
- argMax(owner_team, span_timestamp) AS owner_team,
+ argMax(owner_team, trial_at) AS owner_team,
anyIf(selector, selector != '') AS selector,
anyIf(pr_number, pr_number != '') AS pr_number,
anyIf(branch, branch != '') AS branch,
max(is_current) AS is_current,
- max(outcome IN ('failed', 'error')) AS trial_failed,
- max(outcome = 'rerun_passed') AS trial_rerun_passed,
- max(outcome = 'xfailed') AS trial_quarantined,
- max(outcome = 'passed') AND NOT trial_failed AS trial_passed,
- max(span_timestamp) AS trial_at
- FROM (__SPAN_SCAN__)
- GROUP BY nodeid, run_id, attempt
+ max(trial_failed) AS job_failed,
+ max(trial_quarantined) AS job_quarantined,
+ -- Proof of nondeterminism either way it lands: an in-job retry recovered the test, or
+ -- one attempt of this job failed it and another attempt (same commit) passed it.
+ max(trial_rerun_passed) OR (max(trial_failed) AND max(trial_passed)) AS job_recovered,
+ maxIf(trial_at, trial_failed OR trial_rerun_passed OR trial_quarantined) AS job_signal_at,
+ max(trial_at) AS job_at
+ FROM (
+ -- One row per (test, stable job, run attempt). A failure in one duplicate span
+ -- outweighs a pass in that same trial.
+ SELECT
+ runner,
+ nodeid,
+ run_id,
+ job_key,
+ argMax(owner_team, span_timestamp) AS owner_team,
+ anyIf(selector, selector != '') AS selector,
+ anyIf(pr_number, pr_number != '') AS pr_number,
+ anyIf(branch, branch != '') AS branch,
+ max(is_current) AS is_current,
+ max(outcome IN ('failed', 'error')) AS trial_failed,
+ max(outcome = 'rerun_passed') AS trial_rerun_passed,
+ max(outcome = 'xfailed') AS trial_quarantined,
+ max(outcome = 'passed') AND NOT trial_failed AS trial_passed,
+ max(span_timestamp) AS trial_at
+ FROM (__SPAN_SCAN__)
+ GROUP BY runner, nodeid, run_id, job_key, attempt
+ )
+ GROUP BY runner, nodeid, run_id, job_key
+ HAVING job_failed OR job_recovered OR job_quarantined
)
- GROUP BY nodeid, run_id
+ GROUP BY runner, nodeid, run_id
-- The scan admits re-run passes so they can pair with a failure above; unpaired they are not
-- evidence, and a pass-only row would surface as an all-zero test everywhere downstream.
HAVING failed_in_run OR recovered_in_run OR quarantined_in_run
@@ -102,6 +127,7 @@ def run_evidence(*, bounded: bool) -> str:
# caller without a prior window passes scan_from = date_from and ignores the column.
_SCAN = """
SELECT
+ if(attributes['test.runner'] = 'jest' OR service_name = 'ci-frontend', 'jest', 'pytest') AS runner,
name AS nodeid,
attributes['test.selector'] AS selector,
attributes['test.outcome'] AS outcome,
@@ -112,10 +138,11 @@ _SCAN = """
-- unstamped span from merging every execution of its test into one phantom run.
coalesce(nullIf(resource_attributes['ci.run_id'], ''), trace_id) AS run_id,
ifNull(accurateCastOrNull(resource_attributes['ci.run_attempt'], 'Int64'), 1) AS attempt,
+ coalesce(nullIf(attributes['test.job_key'], ''), 'legacy') AS job_key,
timestamp AS span_timestamp,
timestamp >= {date_from} AS is_current
FROM posthog.trace_spans
- WHERE service_name = {service_name}
+ WHERE service_name IN {service_names}
AND lower(resource_attributes['ci.repository']) = lower({repository})
AND timestamp >= {scan_from}__DATE_TO__
-- Only re-run attempts' passes are read. Reading first-attempt passes too would mean
@@ -139,7 +166,7 @@ def scan_placeholders(
date_to: datetime | None = None,
) -> dict[str, ast.Expr]:
placeholders: dict[str, ast.Expr] = {
- "service_name": ast.Constant(value=CI_SERVICE_NAME),
+ "service_names": ast.Constant(value=CI_SERVICE_NAMES),
"signal_outcomes": ast.Constant(value=SIGNAL_OUTCOMES),
"unowned_team": ast.Constant(value=UNOWNED_TEAM),
"repository": ast.Constant(value=repository),
diff --git a/products/engineering_analytics/backend/logic/queries/flaky_tests.py b/products/engineering_analytics/backend/logic/queries/flaky_tests.py
index 41615c8d44f6..a316d8293244 100644
--- a/products/engineering_analytics/backend/logic/queries/flaky_tests.py
+++ b/products/engineering_analytics/backend/logic/queries/flaky_tests.py
@@ -22,6 +22,7 @@ from posthog.hogql import ast
from posthog.clickhouse.workload import Workload
from products.engineering_analytics.backend.facade.contracts import (
+ CITestRunner,
FlakyTestClassification,
FlakyTestItem,
FlakyTestList,
@@ -35,6 +36,7 @@ from products.engineering_analytics.backend.logic.queries._test_spans import (
_SELECT = """
SELECT
+ runner,
nodeid,
anyIf(selector, selector != '') AS selector,
countIf(recovered_in_run) AS same_commit_recovery_run_count,
@@ -44,7 +46,7 @@ _SELECT = """
countIf(quarantined_in_run) AS quarantined_failed_run_count,
max(run_signal_at) AS last_signal_at
FROM (__RUN_EVIDENCE__)
- GROUP BY nodeid
+ GROUP BY runner, nodeid
HAVING same_commit_recovery_run_count > 0
OR quarantined_failed_run_count > 0
OR master_failed_run_count > 0
@@ -54,7 +56,8 @@ _SELECT = """
failed_pr_count DESC,
failed_run_count DESC,
last_signal_at DESC,
- nodeid ASC
+ nodeid ASC,
+ runner ASC
LIMIT {limit_plus_one}
"""
@@ -90,6 +93,7 @@ def query_flaky_tests(
return FlakyTestList(
items=[
FlakyTestItem(
+ runner=CITestRunner(runner),
nodeid=nodeid,
# Prefer the emitter's exact selector; reconstruct from the nodeid for older spans.
selector=selector or selector_from_nodeid(nodeid),
@@ -105,6 +109,7 @@ def query_flaky_tests(
last_signal_at=last_signal_at,
)
for (
+ runner,
nodeid,
selector,
same_commit_recovery_run_count,
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 3b84946f711f..e5e4e67ffd34 100644
--- a/products/engineering_analytics/backend/logic/queries/team_ci_health.py
+++ b/products/engineering_analytics/backend/logic/queries/team_ci_health.py
@@ -24,6 +24,7 @@ from posthog.hogql import ast
from posthog.clickhouse.workload import Workload
from products.engineering_analytics.backend.facade.contracts import (
+ CITestRunner,
TeamCIActivity,
TeamCIHealthItem,
TeamCIHealthList,
@@ -58,6 +59,7 @@ _ROSTER_SELECT = f"""
max(last_signal) AS last_seen_at
FROM (
SELECT
+ runner,
nodeid,
argMax(owner_team, run_signal_at) AS owner_team,
countIf(recovered_in_run AND is_current) AS recovery_runs_current,
@@ -74,7 +76,7 @@ _ROSTER_SELECT = f"""
AS blast_radius_prior,
max(run_signal_at) AS last_signal
FROM ({_RUN_EVIDENCE})
- GROUP BY nodeid
+ GROUP BY runner, nodeid
)
GROUP BY owner_team
ORDER BY
@@ -86,18 +88,19 @@ _ROSTER_SELECT = f"""
_TEST_SIGNAL_SELECT = f"""
SELECT
+ runner,
nodeid,
anyIf(selector, selector != '') AS selector,
countIf(is_current AND (failed_in_run OR recovered_in_run)) AS signal_count,
countIf(NOT is_current AND (failed_in_run OR recovered_in_run)) AS signal_count_prior,
max(run_signal_at) AS last_seen_at
FROM ({_RUN_EVIDENCE})
- GROUP BY nodeid
+ GROUP BY runner, nodeid
-- Latest stamp owns the whole test, exactly as the roster counts it, so this drill-in never
-- shows different rows than the summary that opened it.
HAVING argMax(owner_team, run_signal_at) = {{owner_team}}
AND (signal_count > 0 OR signal_count_prior > 0)
- ORDER BY greatest(signal_count, signal_count_prior) DESC, signal_count DESC, nodeid ASC
+ ORDER BY greatest(signal_count, signal_count_prior) DESC, signal_count DESC, nodeid ASC, runner ASC
LIMIT {{test_limit_plus_one}}
"""
@@ -198,13 +201,14 @@ def query_team_ci_activity(
owner_team=owner_team,
tests=[
TeamTestSignal(
+ runner=CITestRunner(runner),
nodeid=nodeid,
selector=selector or selector_from_nodeid(nodeid),
signal_count=signal_count,
signal_count_prior=signal_count_prior,
last_seen_at=last_seen_at,
)
- for nodeid, selector, signal_count, signal_count_prior, last_seen_at in test_rows[:test_limit]
+ for runner, nodeid, selector, signal_count, signal_count_prior, last_seen_at in test_rows[:test_limit]
],
truncated_tests=len(test_rows) > test_limit,
)
diff --git a/products/engineering_analytics/backend/management/commands/seed_engineering_analytics.py b/products/engineering_analytics/backend/management/commands/seed_engineering_analytics.py
index f6cc0f2266d6..1efcd8e56ebd 100644
--- a/products/engineering_analytics/backend/management/commands/seed_engineering_analytics.py
+++ b/products/engineering_analytics/backend/management/commands/seed_engineering_analytics.py
@@ -45,7 +45,7 @@ from posthog.models.scoping import team_scope
from posthog.storage import object_storage
from products.engineering_analytics.backend.logic.job_logs.constants import CI_LOGS_SERVICE_NAME
-from products.engineering_analytics.backend.logic.queries._test_spans import CI_SERVICE_NAME
+from products.engineering_analytics.backend.logic.queries._test_spans import PYTEST_CI_SERVICE_NAME
from products.engineering_analytics.backend.logic.sources import (
PULL_REQUESTS_SCHEMA,
TEAM_MEMBERS_SCHEMA,
@@ -710,7 +710,7 @@ def _seed_trace_spans(team: Team) -> int:
rows.append(
f"('{_SPAN_TRACE_PREFIX}-{span_index:06d}', {team.pk}, "
f"'{_SPAN_TRACE_PREFIX}-trace-{span_index}', 'span-{span_index}', 'parent', "
- f"'{nodeid}', 1, '{ts}', '{ts}', '{ts}', 0, '{CI_SERVICE_NAME}', "
+ f"'{nodeid}', 1, '{ts}', '{ts}', '{ts}', 0, '{PYTEST_CI_SERVICE_NAME}', "
f"map({', '.join(attr_pairs)}), map({', '.join(resource_pairs)}))"
)
diff --git a/products/engineering_analytics/backend/presentation/serializers/suite_health.py b/products/engineering_analytics/backend/presentation/serializers/suite_health.py
index 67d52f8f6b14..d9e42c47ab97 100644
--- a/products/engineering_analytics/backend/presentation/serializers/suite_health.py
+++ b/products/engineering_analytics/backend/presentation/serializers/suite_health.py
@@ -19,21 +19,20 @@ class FlakyTestItemSerializer(DataclassSerializer):
class Meta:
dataclass = FlakyTestItem
extra_kwargs = {
+ "runner": {"help_text": "Test runner that emitted this signal: 'pytest' or 'jest'."},
"nodeid": {
- "help_text": "Reconstructed pytest nodeid (the CI span name), e.g. "
- "'posthog/api/test/test_event/TestEvents::test_x'. A stable grouping key, not a runnable "
- "selector — use `selector` to run or quarantine the test.",
+ "help_text": "Runner-specific stable test identity (the CI span name). This is a grouping key, "
+ "not necessarily runnable; use `selector` to run or quarantine the test.",
},
"selector": {
- "help_text": "Runnable pytest selector, e.g. "
- "'posthog/api/test/test_event.py::TestEvents::test_x'. Exact when the CI reporter emitted it; "
- "otherwise reconstructed from the nodeid, where the file/class boundary is a best-effort guess.",
+ "help_text": "Runnable pytest or Jest selector. Exact when the CI reporter emitted it; older "
+ "pytest spans use a best-effort reconstruction from the nodeid.",
},
"classification": {
"help_text": "confirmed_flake: one commit both failed and passed the test (a re-run attempt went "
- "green, or an in-job retry recovered it), so it is provably nondeterministic. quarantined: it "
- "fails while masked as xfail. suspected_regression: only failures were recorded, which is "
- "absence of proof, not proof that it is a real break.",
+ "green, or an in-job retry recovered it), so it is provably nondeterministic. quarantined: a "
+ "tolerated failure was recorded while it was masked. suspected_regression: only failures were "
+ "recorded, which is absence of proof, not proof that it is a real break.",
},
"same_commit_recovery_run_count": {
"help_text": "Runs where one commit both failed and passed the test: a 'Re-run failed jobs' "
@@ -54,11 +53,11 @@ class FlakyTestItemSerializer(DataclassSerializer):
"now' signal that a test is breaking the trunk, not just PR branches.",
},
"quarantined_failed_run_count": {
- "help_text": "Runs where the test failed while quarantined (xfail): already masked in CI, still "
- "failing.",
+ "help_text": "Runs where the test recorded a tolerated failure while quarantined: already masked "
+ "in CI, still failing.",
},
"last_signal_at": {
- "help_text": "Most recent failure, recovery, or xfail run for this test in the window.",
+ "help_text": "Most recent failure, recovery, or quarantined-failure run for this test in the window.",
},
}
@@ -218,6 +217,13 @@ class QuarantineRequestSerializer(DataclassSerializer):
"help_text": "Test selector to act on: an exact test id, a file, a directory, a class prefix, or "
"'product:<dashed-name>'.",
},
+ "runner": {
+ "help_text": "Test runner the selector targets: 'pytest', 'jest', or 'playwright'. Existing entries "
+ "and Jest file extensions are inferred for older clients that omit it; other selectors default to "
+ "'pytest'.",
+ "required": False,
+ "allow_null": True,
+ },
"repo": {
"help_text": "Optional 'owner/name' repository override; defaults to the team's most active repo.",
"allow_null": True,
diff --git a/products/engineering_analytics/backend/presentation/serializers/teams.py b/products/engineering_analytics/backend/presentation/serializers/teams.py
index a325f7f1445f..88e71c44034a 100644
--- a/products/engineering_analytics/backend/presentation/serializers/teams.py
+++ b/products/engineering_analytics/backend/presentation/serializers/teams.py
@@ -45,11 +45,13 @@ class TeamCIHealthItemSerializer(DataclassSerializer):
},
"same_commit_recovery_run_count_prior": {"help_text": "Same count over the prior window."},
"quarantined_failed_run_count": {
- "help_text": "Runs where an owned test failed while quarantined (xfail): masked in CI, still failing.",
+ "help_text": "Runs where an owned test recorded a tolerated failure while quarantined: masked in "
+ "CI, still failing.",
},
"quarantined_failed_run_count_prior": {"help_text": "Same count over the prior window."},
"last_seen_at": {
- "help_text": "Most recent failure, recovery, or xfail run across the team's owned tests, either window."
+ "help_text": "Most recent failure, recovery, or quarantined-failure run across the team's owned "
+ "tests, either window."
},
}
@@ -73,14 +75,17 @@ class TeamTestSignalSerializer(DataclassSerializer):
class Meta:
dataclass = TeamTestSignal
extra_kwargs = {
- "nodeid": {"help_text": "Reconstructed pytest nodeid (the CI span name), a stable grouping key."},
- "selector": {"help_text": "Runnable pytest selector; exact when the CI reporter emitted it."},
+ "runner": {"help_text": "Test runner that emitted this signal: 'pytest' or 'jest'."},
+ "nodeid": {"help_text": "Runner-specific test identity (the CI span name), a stable grouping key."},
+ "selector": {"help_text": "Runnable pytest or Jest selector; exact for newly emitted spans."},
"signal_count": {
"help_text": "Runs in the current window where the test failed, errored, or a retry "
- "recovered it (xfail excluded).",
+ "recovered it (quarantined failures excluded).",
},
"signal_count_prior": {"help_text": "Same count over the equal-length window before date_from."},
- "last_seen_at": {"help_text": "Most recent failure, recovery, or xfail run for this test, either window."},
+ "last_seen_at": {
+ "help_text": "Most recent failure, recovery, or quarantined-failure run for this test, either window."
+ },
}
diff --git a/products/engineering_analytics/backend/presentation/views/suite_health.py b/products/engineering_analytics/backend/presentation/views/suite_health.py
index 2dea6c9ee826..a82e20ddba63 100644
--- a/products/engineering_analytics/backend/presentation/views/suite_health.py
+++ b/products/engineering_analytics/backend/presentation/views/suite_health.py
@@ -69,13 +69,14 @@ class SuiteHealthActionsMixin(EngineeringAnalyticsViewSetBase):
),
},
description=(
- "The active test-health queue: backend tests worth acting on now, from the per-test CI spans, over a "
+ "The active test-health queue: pytest and Jest tests worth acting on now, from the per-test CI spans, "
+ "over a "
"window (default -7d, maximum 30 days). Evidence is counted per CI run, never per span or run "
"attempt. A test is a 'confirmed_flake' when one commit both failed and passed it (a 'Re-run failed "
- "jobs' attempt went green, or an in-job retry recovered it); 'quarantined' when it fails while "
- "masked as xfail; otherwise 'suspected_regression'. It qualifies on any same-commit recovery, any "
- "master/main failure, an xfail, or failures on at least min_failed_prs distinct PRs. "
- + FLAKY_TEST_SIGNAL_CAVEAT
+ "jobs' attempt went green, or an in-job retry recovered it); 'quarantined' when a tolerated failure "
+ "is recorded while it is masked; otherwise 'suspected_regression'. It qualifies on any same-commit "
+ "recovery, any master/main failure, a quarantined failure, or failures on at least min_failed_prs "
+ "distinct PRs. " + FLAKY_TEST_SIGNAL_CAVEAT
),
)
@action(detail=False, methods=["get"], pagination_class=None)
diff --git a/products/engineering_analytics/backend/tests/test_flaky_tests.py b/products/engineering_analytics/backend/tests/test_flaky_tests.py
index d1001a6350c6..4ce0ac328d8e 100644
--- a/products/engineering_analytics/backend/tests/test_flaky_tests.py
+++ b/products/engineering_analytics/backend/tests/test_flaky_tests.py
@@ -30,6 +30,8 @@ T_TIE_A = "posthog/api/test/test_tie_a/TestTie::test_retry"
T_TIE_B = "posthog/api/test/test_tie_b/TestTie::test_retry"
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"
class TestFlakyTestsAPI(ClickhouseTestMixin, APIBaseTest):
@@ -118,6 +120,54 @@ class TestFlakyTestsAPI(ClickhouseTestMixin, APIBaseTest):
cls._span(22, T_OTHER_REPO, "rerun_passed", ts=recent, run="1200", pr="1201", repo="PostHog/posthog.com"),
# 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"),
+ # Main Jest spans share the same evidence model. Recovery only counts within the
+ # stable FOSS/EE + shard job that failed.
+ cls._span(
+ 30,
+ T_JEST_RECOVERY,
+ "failed",
+ ts=earlier,
+ run="1500",
+ branch="master",
+ selector=T_JEST_RECOVERY,
+ service="ci-frontend",
+ job="frontend:EE:1",
+ ),
+ cls._span(
+ 31,
+ T_JEST_RECOVERY,
+ "passed",
+ ts=recent,
+ run="1500",
+ attempt="2",
+ branch="master",
+ selector=T_JEST_RECOVERY,
+ service="ci-frontend",
+ job="frontend:EE:1",
+ ),
+ cls._span(
+ 32,
+ T_JEST_CROSS_LEG,
+ "failed",
+ ts=earlier,
+ run="1600",
+ branch="master",
+ selector=T_JEST_CROSS_LEG,
+ service="ci-frontend",
+ job="frontend:EE:1",
+ ),
+ cls._span(
+ 33,
+ T_JEST_CROSS_LEG,
+ "passed",
+ ts=recent,
+ run="1600",
+ attempt="2",
+ branch="master",
+ selector=T_JEST_CROSS_LEG,
+ service="ci-frontend",
+ job="frontend:FOSS:1",
+ ),
]
sync_execute(
"INSERT INTO trace_spans (uuid, team_id, trace_id, span_id, parent_span_id, name, kind, "
@@ -148,6 +198,7 @@ class TestFlakyTestsAPI(ClickhouseTestMixin, APIBaseTest):
selector: str = "",
service: str = "ci-backend",
repo: str = "PostHog/posthog",
+ job: str = "",
) -> str:
# Physical attributes carry a type suffix ('test.outcome__str'); the `attributes` ALIAS
# column strips it. Resource attributes are stored as-is; attempt="" drops the
@@ -155,6 +206,8 @@ class TestFlakyTestsAPI(ClickhouseTestMixin, APIBaseTest):
attr_pairs = ([f"'test.outcome__str', '{outcome}'"] if outcome else []) + (
[f"'test.selector__str', '{selector}'"] if selector else []
)
+ if job:
+ attr_pairs.append(f"'test.job_key__str', '{job}'")
attrs = f"map({', '.join(attr_pairs)})" if attr_pairs else "map()"
resource_pairs = [
f"'{key}', '{value}'"
@@ -200,6 +253,8 @@ class TestFlakyTestsAPI(ClickhouseTestMixin, APIBaseTest):
T_TIE_A,
T_TIE_B,
T_NO_RUN_ID,
+ T_JEST_RECOVERY,
+ T_JEST_CROSS_LEG,
}
assert data["truncated"] is False
assert data["limit"] == 50
@@ -216,6 +271,8 @@ class TestFlakyTestsAPI(ClickhouseTestMixin, APIBaseTest):
("pass_in_another_matrix_leg", T_MATRIX_LEGS, "suspected_regression"),
("no_recovery_recorded", T_THREE_PRS, "suspected_regression"),
("failing_while_xfailed", T_QUARANTINED, "quarantined"),
+ ("jest_same_job_recovery", T_JEST_RECOVERY, "confirmed_flake"),
+ ("jest_cross_job_pass", T_JEST_CROSS_LEG, "suspected_regression"),
]
)
def test_classification_needs_proof_to_call_a_test_flaky(self, _name: str, nodeid: str, expected: str) -> None:
@@ -261,6 +318,15 @@ class TestFlakyTestsAPI(ClickhouseTestMixin, APIBaseTest):
assert quarantined["quarantined_failed_run_count"] == 1
assert (quarantined["failed_run_count"], quarantined["master_failed_run_count"]) == (0, 0)
+ jest_recovered = rows[T_JEST_RECOVERY]
+ assert jest_recovered["runner"] == "jest"
+ assert jest_recovered["selector"] == T_JEST_RECOVERY
+ assert jest_recovered["same_commit_recovery_run_count"] == 1
+
+ jest_cross_leg = rows[T_JEST_CROSS_LEG]
+ assert jest_cross_leg["runner"] == "jest"
+ assert jest_cross_leg["same_commit_recovery_run_count"] == 0
+
def test_ranking_leads_with_trunk_breakage_and_breaks_ties_on_nodeid(self) -> None:
nodeids = [item["nodeid"] for item in self._get()["items"]]
diff --git a/products/engineering_analytics/backend/tests/test_quarantine.py b/products/engineering_analytics/backend/tests/test_quarantine.py
index e56fe7eea551..8b56a4f1408c 100644
--- a/products/engineering_analytics/backend/tests/test_quarantine.py
+++ b/products/engineering_analytics/backend/tests/test_quarantine.py
@@ -22,6 +22,7 @@ from products.engineering_analytics.backend.logic.quarantine import (
_canonical_entry,
_lifecycle_for,
_remove_entry,
+ _resolve_request_runner,
_selector_kind,
_upsert_entry,
build_quarantine,
@@ -119,6 +120,7 @@ def _request(**overrides: Any) -> contracts.QuarantineRequest:
fields: dict[str, Any] = {
"operation": contracts.QuarantineRequestAction.QUARANTINE,
"selector": "posthog/api/test/test_foo.py::TestFoo::test_bar",
+ "runner": contracts.QuarantineRunner.PYTEST,
"repo": "PostHog/posthog",
"reason": "flaky under shards",
"owner": "@PostHog/team-foo",
@@ -470,6 +472,47 @@ class TestQuarantineRender(TestCase):
result = _remove_entry([keep, drop], _entry()["id"])
assert [e["id"] for e in result] == ["other"]
+ @parameterized.expand(
+ [
+ ("jest_extension", "frontend/src/x.test.ts::suite test", [], contracts.QuarantineRunner.JEST),
+ ("pytest_fallback", "product:surveys", [], contracts.QuarantineRunner.PYTEST),
+ (
+ "existing_entry",
+ "product:surveys",
+ [_canonical_entry(_entry(id="product:surveys", runner="jest"))],
+ contracts.QuarantineRunner.JEST,
+ ),
+ ]
+ )
+ def test_resolve_request_runner_for_older_clients(
+ self,
+ _name: str,
+ selector: str,
+ entries: list[dict],
+ expected: contracts.QuarantineRunner,
+ ) -> None:
+ request = _request(selector=selector, runner=None)
+ assert _resolve_request_runner(request, selector, entries) == expected
+
+ @parameterized.expand(
+ [
+ ("extend", contracts.QuarantineRequestAction.EXTEND),
+ ("quarantine", contracts.QuarantineRequestAction.QUARANTINE),
+ ]
+ )
+ def test_resolve_request_runner_rejects_ambiguous(
+ self, _name: str, operation: contracts.QuarantineRequestAction
+ ) -> None:
+ selector = "product:surveys"
+ entries = [
+ _canonical_entry(_entry(id=selector, runner="pytest")),
+ _canonical_entry(_entry(id=selector, runner="jest")),
+ ]
+ request = _request(operation=operation, selector=selector, runner=None)
+
+ with self.assertRaisesRegex(contracts.QuarantineWriteError, "multiple runners"):
+ _resolve_request_runner(request, selector, entries)
+
class TestQuarantineRequest(BaseTest):
def _install(self, github: mock.Mock, *, has_integration: bool = True, connected: bool = True) -> mock.Mock:
@@ -504,6 +547,7 @@ class TestQuarantineRequest(BaseTest):
committed = github.update_file.call_args.args[2]
entry = json.loads(committed)["entries"][0]
assert entry["id"] == _request().selector
+ assert entry["runner"] == "pytest"
assert entry["mode"] == "run"
assert entry["expires"] == "2026-06-26"
assert entry["issue"] == "https://github.com/PostHog/posthog/issues/4242"
@@ -517,6 +561,13 @@ class TestQuarantineRequest(BaseTest):
entry = json.loads(github.update_file.call_args.args[2])["entries"][0]
assert entry["mode"] == "skip"
+ @freeze_time("2026-06-12")
+ def test_jest_runner_is_persisted(self) -> None:
+ github = self._install(_github_mock())
+ request_quarantine(team=self.team, request=_request(runner=contracts.QuarantineRunner.JEST))
+ entry = json.loads(github.update_file.call_args.args[2])["entries"][0]
+ assert entry["runner"] == "jest"
+
@freeze_time("2026-06-12")
def test_extend_reuses_existing_issue_and_files_no_new_one(self) -> None:
existing = _text(_entry(expires="2026-06-15", issue="https://github.com/PostHog/posthog/issues/7"))
diff --git a/products/engineering_analytics/frontend/components/QuarantineTestModal.tsx b/products/engineering_analytics/frontend/components/QuarantineTestModal.tsx
index 488e4b3fbc88..e8b0052bd708 100644
--- a/products/engineering_analytics/frontend/components/QuarantineTestModal.tsx
+++ b/products/engineering_analytics/frontend/components/QuarantineTestModal.tsx
@@ -8,6 +8,7 @@ import { LemonCalendarSelectInput } from 'lib/lemon-ui/LemonCalendar/LemonCalend
import {
QuarantineModalState,
QuarantineSubmitInput,
+ TestRunner,
inferOwnerFromSelector,
} from '../scenes/engineeringAnalyticsLogic'
@@ -47,6 +48,7 @@ export function QuarantineTestModal({
const isExtend = modal?.action === 'extend'
const [selector, setSelector] = useState('')
+ const [runner, setRunner] = useState<TestRunner>('pytest')
// A picked category, or OTHER_REASON when the reason is free-text (held in customReason).
const [reasonChoice, setReasonChoice] = useState('')
const [customReason, setCustomReason] = useState('')
@@ -61,6 +63,7 @@ export function QuarantineTestModal({
return
}
setSelector(modal.selector)
+ setRunner(modal.runner)
// An existing reason that isn't one of the buckets falls into the 'Other' free-text path.
const isKnown = REASON_OPTIONS.includes(modal.reason)
setReasonChoice(modal.reason ? (isKnown ? modal.reason : OTHER_REASON) : '')
@@ -95,11 +98,12 @@ export function QuarantineTestModal({
onSubmit({
action: modal.action,
selector: selector.trim(),
+ runner,
reason,
owner: owner.trim(),
issue: modal.issue,
expires: expires.format('YYYY-MM-DD'),
- // Mode isn't editable here: new quarantines run as xfail; extend keeps the entry's mode.
+ // Mode isn't editable here: new quarantines tolerate failures; extend keeps the entry's mode.
mode: modal.mode,
})
}
@@ -165,6 +169,10 @@ export function QuarantineTestModal({
{selector}
</div>
</div>
+ <div>
+ <div className="mb-1 text-sm font-medium">Test runner</div>
+ <div className="text-sm">{runner}</div>
+ </div>
<div>
<div className="mb-1 text-sm font-medium">Reason</div>
<div className="text-sm text-secondary">{reason}</div>
@@ -182,6 +190,22 @@ export function QuarantineTestModal({
</div>
) : (
<div className="flex flex-col gap-4">
+ {!isExtend && (
+ <div>
+ <label className="mb-1 block text-sm font-medium">Test runner</label>
+ <LemonSelect<TestRunner>
+ value={runner}
+ onChange={(value) => value && setRunner(value)}
+ options={[
+ { value: 'pytest', label: 'pytest' },
+ { value: 'jest', label: 'Jest' },
+ { value: 'playwright', label: 'Playwright' },
+ ]}
+ fullWidth
+ data-attr="eng-analytics-quarantine-runner"
+ />
+ </div>
+ )}
<div>
<label className="mb-1 block text-sm font-medium">Test selector</label>
{isExtend ? (
diff --git a/products/engineering_analytics/frontend/generated/api.schemas.ts b/products/engineering_analytics/frontend/generated/api.schemas.ts
index 32d59765c6df..2716b47d43c0 100644
--- a/products/engineering_analytics/frontend/generated/api.schemas.ts
+++ b/products/engineering_analytics/frontend/generated/api.schemas.ts
@@ -198,6 +198,17 @@ export interface CurrentBranchHealthApi {
failing_workflow_names: string[]
}
+/**
+ * * `pytest` - PYTEST
+ * * `jest` - JEST
+ */
+export type CITestRunnerEnumApi = (typeof CITestRunnerEnumApi)[keyof typeof CITestRunnerEnumApi]
+
+export const CITestRunnerEnumApi = {
+ Pytest: 'pytest',
+ Jest: 'jest',
+} as const
+
/**
* * `confirmed_flake` - CONFIRMED_FLAKE
* * `suspected_regression` - SUSPECTED_REGRESSION
@@ -213,11 +224,16 @@ export const FlakyTestItemClassificationEnumApi = {
} as const
export interface FlakyTestItemApi {
- /** Reconstructed pytest nodeid (the CI span name), e.g. 'posthog/api/test/test_event/TestEvents::test_x'. A stable grouping key, not a runnable selector — use `selector` to run or quarantine the test. */
+ /** Test runner that emitted this signal: 'pytest' or 'jest'.
+ *
+ * * `pytest` - PYTEST
+ * * `jest` - JEST */
+ runner: CITestRunnerEnumApi
+ /** Runner-specific stable test identity (the CI span name). This is a grouping key, not necessarily runnable; use `selector` to run or quarantine the test. */
nodeid: string
- /** Runnable pytest selector, e.g. 'posthog/api/test/test_event.py::TestEvents::test_x'. Exact when the CI reporter emitted it; otherwise reconstructed from the nodeid, where the file/class boundary is a best-effort guess. */
+ /** Runnable pytest or Jest selector. Exact when the CI reporter emitted it; older pytest spans use a best-effort reconstruction from the nodeid. */
selector: string
- /** confirmed_flake: one commit both failed and passed the test (a re-run attempt went green, or an in-job retry recovered it), so it is provably nondeterministic. quarantined: it fails while masked as xfail. suspected_regression: only failures were recorded, which is absence of proof, not proof that it is a real break.
+ /** confirmed_flake: one commit both failed and passed the test (a re-run attempt went green, or an in-job retry recovered it), so it is provably nondeterministic. quarantined: a tolerated failure was recorded while it was masked. suspected_regression: only failures were recorded, which is absence of proof, not proof that it is a real break.
*
* * `confirmed_flake` - CONFIRMED_FLAKE
* * `suspected_regression` - SUSPECTED_REGRESSION
@@ -231,9 +247,9 @@ export interface FlakyTestItemApi {
failed_pr_count: number
/** Failed runs on the default branch (master/main approximation): the 'matters right now' signal that a test is breaking the trunk, not just PR branches. */
master_failed_run_count: number
- /** Runs where the test failed while quarantined (xfail): already masked in CI, still failing. */
+ /** Runs where the test recorded a tolerated failure while quarantined: already masked in CI, still failing. */
quarantined_failed_run_count: number
- /** Most recent failure, recovery, or xfail run for this test in the window. */
+ /** Most recent failure, recovery, or quarantined-failure run for this test in the window. */
last_signal_at: string
}
@@ -721,6 +737,20 @@ export const OperationEnumApi = {
Remove: 'remove',
} as const
+/**
+ * * `pytest` - PYTEST
+ * * `jest` - JEST
+ * * `playwright` - PLAYWRIGHT
+ */
+export type QuarantineRequestRunnerEnumApi =
+ (typeof QuarantineRequestRunnerEnumApi)[keyof typeof QuarantineRequestRunnerEnumApi]
+
+export const QuarantineRequestRunnerEnumApi = {
+ Pytest: 'pytest',
+ Jest: 'jest',
+ Playwright: 'playwright',
+} as const
+
export interface QuarantineRequestApi {
/** What to do: 'quarantine' (add or replace an entry and file a tracking issue), 'extend' (re-stamp an existing entry's expiry, reusing its issue), or 'remove' (delete the entry). All three open a pull request.
*
@@ -730,6 +760,12 @@ export interface QuarantineRequestApi {
operation: OperationEnumApi
/** Test selector to act on: an exact test id, a file, a directory, a class prefix, or 'product:<dashed-name>'. */
selector: string
+ /** Test runner the selector targets: 'pytest', 'jest', or 'playwright'. Existing entries and Jest file extensions are inferred for older clients that omit it; other selectors default to 'pytest'.
+ *
+ * * `pytest` - PYTEST
+ * * `jest` - JEST
+ * * `playwright` - PLAYWRIGHT */
+ runner?: QuarantineRequestRunnerEnumApi | null
/**
* Optional 'owner/name' repository override; defaults to the team's most active repo.
* @nullable
@@ -956,15 +992,20 @@ export interface GitHubSourceApi {
}
export interface TeamTestSignalApi {
- /** Reconstructed pytest nodeid (the CI span name), a stable grouping key. */
+ /** Test runner that emitted this signal: 'pytest' or 'jest'.
+ *
+ * * `pytest` - PYTEST
+ * * `jest` - JEST */
+ runner: CITestRunnerEnumApi
+ /** Runner-specific test identity (the CI span name), a stable grouping key. */
nodeid: string
- /** Runnable pytest selector; exact when the CI reporter emitted it. */
+ /** Runnable pytest or Jest selector; exact for newly emitted spans. */
selector: string
- /** Runs in the current window where the test failed, errored, or a retry recovered it (xfail excluded). */
+ /** Runs in the current window where the test failed, errored, or a retry recovered it (quarantined failures excluded). */
signal_count: number
/** Same count over the equal-length window before date_from. */
signal_count_prior: number
- /** Most recent failure, recovery, or xfail run for this test, either window. */
+ /** Most recent failure, recovery, or quarantined-failure run for this test, either window. */
last_seen_at: string
}
@@ -996,11 +1037,11 @@ export interface TeamCIHealthItemApi {
same_commit_recovery_run_count: number
/** Same count over the prior window. */
same_commit_recovery_run_count_prior: number
- /** Runs where an owned test failed while quarantined (xfail): masked in CI, still failing. */
+ /** Runs where an owned test recorded a tolerated failure while quarantined: masked in CI, still failing. */
quarantined_failed_run_count: number
/** Same count over the prior window. */
quarantined_failed_run_count_prior: number
- /** Most recent failure, recovery, or xfail run across the team's owned tests, either window. */
+ /** Most recent failure, recovery, or quarantined-failure run across the team's owned tests, either window. */
last_seen_at: string
}
diff --git a/products/engineering_analytics/frontend/generated/api.ts b/products/engineering_analytics/frontend/generated/api.ts
index 2891afe0db85..26c12c4b6e01 100644
--- a/products/engineering_analytics/frontend/generated/api.ts
+++ b/products/engineering_analytics/frontend/generated/api.ts
@@ -284,7 +284,7 @@ export const getEngineeringAnalyticsFlakyTestsUrl = (
}
/**
- * The active test-health queue: backend tests worth acting on now, from the per-test CI spans, over a window (default -7d, maximum 30 days). Evidence is counted per CI run, never per span or run attempt. A test is a 'confirmed_flake' when one commit both failed and passed it (a 'Re-run failed jobs' attempt went green, or an in-job retry recovered it); 'quarantined' when it fails while masked as xfail; otherwise 'suspected_regression'. It qualifies on any same-commit recovery, any master/main failure, an xfail, or failures on at least min_failed_prs distinct PRs. Counts are absolute, never rates: CI emits a span for every failure but only for passes slow enough to clear the emitter's duration threshold, so there is no execution denominator. 'suspected_regression' means no recovery was recorded in this data, not that the test never flakes.
+ * The active test-health queue: pytest and Jest tests worth acting on now, from the per-test CI spans, over a window (default -7d, maximum 30 days). Evidence is counted per CI run, never per span or run attempt. A test is a 'confirmed_flake' when one commit both failed and passed it (a 'Re-run failed jobs' attempt went green, or an in-job retry recovered it); 'quarantined' when a tolerated failure is recorded while it is masked; otherwise 'suspected_regression'. It qualifies on any same-commit recovery, any master/main failure, a quarantined failure, or failures on at least min_failed_prs distinct PRs. 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 engineeringAnalyticsFlakyTests = async (
projectId: string,
@@ -713,7 +713,7 @@ export const getEngineeringAnalyticsTeamCiActivityUrl = (
}
/**
- * One owning team's CI test activity: per-test current-vs-prior signal pairs (the before/after comparison) over the window and its equal-length prior twin. Signal = runs where an owned test failed, errored, or a retry recovered it. Counts are absolute, never rates: CI emits a span for every failure but only for passes slow enough to clear the emitter's duration threshold, so there is no execution denominator. 'suspected_regression' means no recovery was recorded in this data, not that the test never flakes.
+ * One owning team's CI test activity: per-test current-vs-prior signal pairs (the before/after comparison) over the window and its equal-length prior twin. Signal = runs where an owned test failed, errored, or a retry recovered it. 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 engineeringAnalyticsTeamCiActivity = async (
projectId: string,
@@ -746,7 +746,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 a span for every failure but only for passes slow enough to clear the emitter's duration threshold, 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 (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.
*/
export const engineeringAnalyticsTeamCiHealth = async (
projectId: string,
diff --git a/products/engineering_analytics/frontend/generated/api.zod.ts b/products/engineering_analytics/frontend/generated/api.zod.ts
index 601525b0a70b..7483e287ddaf 100644
--- a/products/engineering_analytics/frontend/generated/api.zod.ts
+++ b/products/engineering_analytics/frontend/generated/api.zod.ts
@@ -32,6 +32,17 @@ export const EngineeringAnalyticsQuarantineRequestBody = /* @__PURE__ */ zod.obj
.describe(
"Test selector to act on: an exact test id, a file, a directory, a class prefix, or 'product:<dashed-name>'."
),
+ runner: zod
+ .union([
+ zod
+ .enum(['pytest', 'jest', 'playwright'])
+ .describe('\* `pytest` - PYTEST\n\* `jest` - JEST\n\* `playwright` - PLAYWRIGHT'),
+ zod.null(),
+ ])
+ .optional()
+ .describe(
+ "Test runner the selector targets: 'pytest', 'jest', or 'playwright'. Existing entries and Jest file extensions are inferred for older clients that omit it; other selectors default to 'pytest'.\n\n\* `pytest` - PYTEST\n\* `jest` - JEST\n\* `playwright` - PLAYWRIGHT"
+ ),
repo: zod
.string()
.nullish()
diff --git a/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsTeamScene.tsx b/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsTeamScene.tsx
index 29342d532836..86833b6dae1d 100644
--- a/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsTeamScene.tsx
+++ b/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsTeamScene.tsx
@@ -148,7 +148,7 @@ export function EngineeringAnalyticsTeamScene(): JSX.Element {
size="small"
columns={testColumns}
dataSource={activity?.tests ?? []}
- rowKey={(row) => row.nodeid}
+ rowKey={(row) => `${row.runner}:${row.nodeid}`}
loading={activityLoading}
pagination={{ pageSize: 25 }}
useURLForSorting={false}
diff --git a/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsTestHealth.stories.tsx b/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsTestHealth.stories.tsx
index 5ea52b1390bc..60efaffcb07b 100644
--- a/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsTestHealth.stories.tsx
+++ b/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsTestHealth.stories.tsx
@@ -19,6 +19,7 @@ const spark = (tail: number[]): number[] => [...new Array(24 - tail.length).fill
const FLAKY_TESTS: FlakyTestListApi = {
items: [
{
+ runner: 'pytest',
nodeid: 'posthog/api/test/test_decide/TestDecide::test_flag_rollout_consistency',
selector: 'posthog/api/test/test_decide.py::TestDecide::test_flag_rollout_consistency',
classification: 'confirmed_flake',
@@ -30,6 +31,7 @@ const FLAKY_TESTS: FlakyTestListApi = {
last_signal_at: '2026-07-01T18:30:00Z',
},
{
+ runner: 'pytest',
nodeid: 'posthog/tasks/test/test_usage_report/TestUsageReport::test_full_report',
selector: 'posthog/tasks/test/test_usage_report.py::TestUsageReport::test_full_report',
classification: 'suspected_regression',
@@ -41,6 +43,7 @@ const FLAKY_TESTS: FlakyTestListApi = {
last_signal_at: '2026-07-01T09:12:00Z',
},
{
+ runner: 'pytest',
nodeid: 'posthog/hogql/test/test_resolver/TestResolver::test_asterisk_expander',
selector: 'posthog/hogql/test/test_resolver.py::TestResolver::test_asterisk_expander',
classification: 'quarantined',
@@ -52,6 +55,7 @@ const FLAKY_TESTS: FlakyTestListApi = {
last_signal_at: '2026-06-30T22:45:00Z',
},
{
+ runner: 'pytest',
nodeid: 'posthog/temporal/tests/batch_exports/test_backfill::test_workflow_timeout',
selector: 'posthog/temporal/tests/batch_exports/test_backfill.py::test_workflow_timeout',
classification: 'confirmed_flake',
diff --git a/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsTestHealth.tsx b/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsTestHealth.tsx
index c3d0357f117c..b7058ef958ed 100644
--- a/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsTestHealth.tsx
+++ b/products/engineering_analytics/frontend/scenes/EngineeringAnalyticsTestHealth.tsx
@@ -42,12 +42,9 @@ import {
QuarantineModeFilter,
engineeringAnalyticsLogic,
flakyEvidenceReason,
+ isTestRunner,
} from './engineeringAnalyticsLogic'
-// Runners with an enforcement adapter; mirrors ADAPTED_RUNNERS in the quarantine
-// contract (tools/hogli-commands/hogli_commands/quarantine/core.py), which the frontend can't import.
-const ENFORCED_RUNNERS = ['pytest', 'jest', 'playwright']
-
function relativeExpiry(daysUntilExpiry: number): string {
if (daysUntilExpiry === 0) {
return 'today'
@@ -85,7 +82,7 @@ function ModeTag({ mode }: { mode: QuarantineEntryRow['mode'] }): JSX.Element {
)
}
return (
- <Tooltip title="Runs as xfail: the test still executes but cannot fail the suite.">
+ <Tooltip title="Runs: the test still executes but cannot fail the suite.">
<LemonTag type="muted">Runs, can't fail</LemonTag>
</Tooltip>
)
@@ -358,7 +355,7 @@ const FLAKY_CLASSIFICATION: Record<FlakyTestClassification, { label: string; typ
quarantined: {
label: 'Quarantined, still failing',
type: 'muted',
- tooltip: 'Already masked as xfail in CI and still failing. Fix it, then remove the quarantine.',
+ tooltip: 'Already masked in CI with a tolerated failure recorded. Fix it, then remove the quarantine.',
},
}
@@ -402,9 +399,9 @@ function ActiveTestHealthQueue(): JSX.Element {
</span>
)}
{row.quarantinedFailedRunCount > 0 && (
- <span>Failed in {pluralize(row.quarantinedFailedRunCount, 'quarantined run')} (xfail)</span>
+ <span>Failed in {pluralize(row.quarantinedFailedRunCount, 'quarantined run')}</span>
)}
- {/* An xfail row has no recovery question to answer: it is masked, not racing. */}
+ {/* A quarantined row has no recovery question to answer: it is masked, not racing. */}
{row.classification !== 'quarantined' && (
<span className="text-secondary">
{row.sameCommitRecoveryRunCount > 0
@@ -445,6 +442,7 @@ function ActiveTestHealthQueue(): JSX.Element {
openQuarantineModal({
action: 'quarantine',
selector: row.selector,
+ runner: row.runner,
// The evidence is the reason; the cause is the tracking issue's job to find.
reason: flakyEvidenceReason(row, flakyTestWindow),
owner: '',
@@ -467,8 +465,8 @@ function ActiveTestHealthQueue(): JSX.Element {
<div className="flex flex-col gap-0.5">
<h3 className="m-0 text-base font-semibold">Active test health queue</h3>
<p className="m-0 text-xs text-tertiary">
- Backend tests worth acting on now, ranked by blast radius: how many PRs they broke and how often
- they broke master.
+ CI tests worth acting on now, ranked by blast radius: how many PRs they broke and how often they
+ broke master.
</p>
</div>
<LemonSegmentedButton
@@ -491,7 +489,7 @@ function ActiveTestHealthQueue(): JSX.Element {
size="small"
columns={columns}
dataSource={flakyTests?.rows ?? []}
- rowKey={(row) => row.nodeid}
+ rowKey={(row) => `${row.runner}:${row.nodeid}`}
loading={flakyTestsLoading}
pagination={{ pageSize: 10 }}
useURLForSorting={false}
@@ -565,17 +563,30 @@ function QuarantineRegister(): JSX.Element {
} = useActions(engineeringAnalyticsLogic)
const openNewQuarantine = (): void =>
- openQuarantineModal({ action: 'quarantine', selector: '', reason: '', owner: '', issue: '', mode: 'run' })
+ openQuarantineModal({
+ action: 'quarantine',
+ selector: '',
+ runner: 'pytest',
+ reason: '',
+ owner: '',
+ issue: '',
+ mode: 'run',
+ })
- const openExtend = (row: QuarantineEntryRow): void =>
+ const openExtend = (row: QuarantineEntryRow): void => {
+ if (!isTestRunner(row.runner)) {
+ return
+ }
openQuarantineModal({
action: 'extend',
selector: row.id,
+ runner: row.runner,
reason: row.reason,
owner: row.owner,
issue: row.issue,
mode: row.mode,
})
+ }
const confirmRemove = (row: QuarantineEntryRow): void => {
LemonDialog.open({
@@ -653,7 +664,7 @@ function QuarantineRegister(): JSX.Element {
title: 'Selector',
key: 'id',
render: (_, row) => {
- const isEnforced = ENFORCED_RUNNERS.includes(row.runner)
+ const isEnforced = isTestRunner(row.runner)
return (
<div className="flex max-w-[28rem] flex-col gap-0.5">
<Tooltip title={row.id}>
@@ -759,7 +770,13 @@ function QuarantineRegister(): JSX.Element {
render: (_, row) => (
<LemonMenu
items={[
- { label: 'Extend…', onClick: () => openExtend(row) },
+ {
+ label: 'Extend…',
+ onClick: () => openExtend(row),
+ disabledReason: isTestRunner(row.runner)
+ ? undefined
+ : `Runner '${row.runner}' is not supported here`,
+ },
{ label: 'Remove…', status: 'danger', onClick: () => confirmRemove(row) },
...(row.issue ? [{ label: 'Open issue', to: row.issue, targetBlank: true }] : []),
]}
diff --git a/products/engineering_analytics/frontend/scenes/engineeringAnalyticsLogic.test.ts b/products/engineering_analytics/frontend/scenes/engineeringAnalyticsLogic.test.ts
index 40e56151a907..eb272bab0efe 100644
--- a/products/engineering_analytics/frontend/scenes/engineeringAnalyticsLogic.test.ts
+++ b/products/engineering_analytics/frontend/scenes/engineeringAnalyticsLogic.test.ts
@@ -906,6 +906,7 @@ describe('engineeringAnalyticsLogic', () => {
logic.actions.openQuarantineModal({
action: 'extend',
selector: 'a/b.py::T::t',
+ runner: 'pytest',
reason: 'flaky',
owner: '@team/x',
issue: 'https://github.com/PostHog/posthog/issues/7',
@@ -925,7 +926,8 @@ describe('engineeringAnalyticsLogic', () => {
logic.actions.openQuarantineModal({
action: 'quarantine',
- selector: 'a/b.py::T::t',
+ selector: 'frontend/src/a.test.ts::renders',
+ runner: 'jest',
reason: 'flaky',
owner: '@team/x',
issue: '',
@@ -934,7 +936,8 @@ describe('engineeringAnalyticsLogic', () => {
logic.actions.submitQuarantine({
input: {
action: 'quarantine',
- selector: 'a/b.py::T::t',
+ selector: 'frontend/src/a.test.ts::renders',
+ runner: 'jest',
reason: 'flaky',
owner: '@team/x',
issue: '',
@@ -948,12 +951,35 @@ describe('engineeringAnalyticsLogic', () => {
// The viewed repo is threaded into the write so the PR targets it.
expect(mockQuarantineRequest).toHaveBeenCalledWith(
'1',
- expect.objectContaining({ operation: 'quarantine', repo: 'PostHog/posthog' })
+ expect.objectContaining({ operation: 'quarantine', repo: 'PostHog/posthog', runner: 'jest' })
)
expect(logic.values.quarantineModal).toBeNull()
expect(logic.values.quarantineSubmitLoading).toBe(false)
})
+ it('omits the runner when removing a forward-compatible quarantine entry', async () => {
+ logic = engineeringAnalyticsLogic()
+ logic.mount()
+
+ logic.actions.submitQuarantine({
+ input: {
+ action: 'remove',
+ selector: 'future/runner/test',
+ reason: '',
+ owner: '',
+ issue: '',
+ expires: null,
+ mode: 'run',
+ },
+ })
+ await expectLogic(logic).toDispatchActions(['submitQuarantineSuccess'])
+
+ expect(mockQuarantineRequest).toHaveBeenCalledWith(
+ '1',
+ expect.not.objectContaining({ runner: expect.anything() })
+ )
+ })
+
it('a failed submit keeps the modal open so the user can retry', async () => {
silenceKeaLoadersErrors() // the submit failure is the scenario under test
mockQuarantineRequest.mockRejectedValue({ detail: "The App isn't installed on PostHog." })
@@ -963,6 +989,7 @@ describe('engineeringAnalyticsLogic', () => {
logic.actions.openQuarantineModal({
action: 'quarantine',
selector: 'a/b.py::T::t',
+ runner: 'pytest',
reason: 'flaky',
owner: '@team/x',
issue: '',
@@ -972,6 +999,7 @@ describe('engineeringAnalyticsLogic', () => {
input: {
action: 'quarantine',
selector: 'a/b.py::T::t',
+ runner: 'pytest',
reason: 'flaky',
owner: '@team/x',
issue: '',
diff --git a/products/engineering_analytics/frontend/scenes/engineeringAnalyticsLogic.ts b/products/engineering_analytics/frontend/scenes/engineeringAnalyticsLogic.ts
index 89ac88a52e56..05987b92d627 100644
--- a/products/engineering_analytics/frontend/scenes/engineeringAnalyticsLogic.ts
+++ b/products/engineering_analytics/frontend/scenes/engineeringAnalyticsLogic.ts
@@ -448,11 +448,18 @@ export function quarantineCountsOf(rows: QuarantineEntryRow[]): QuarantineCounts
export type FlakyTestWindow = '-7d' | '-14d' | '-30d'
export const DEFAULT_FLAKY_TEST_WINDOW: FlakyTestWindow = '-7d'
export type FlakyTestClassification = FlakyTestItemClassificationEnumApi
+export type TestRunner = NonNullable<QuarantineRequestApi['runner']>
+export const TEST_RUNNERS: readonly TestRunner[] = ['pytest', 'jest', 'playwright']
+
+export function isTestRunner(runner: string): runner is TestRunner {
+ return TEST_RUNNERS.some((candidate) => candidate === runner)
+}
export interface FlakyTestRow {
- /** Reconstructed pytest nodeid (the CI span name): a stable grouping/display key. */
+ runner: TestRunner
+ /** Runner-specific test identity (the CI span name): a stable grouping/display key. */
nodeid: string
- /** Runnable pytest selector for the quarantine action; exact when the CI reporter emitted it. */
+ /** Runnable selector for the quarantine action; exact when the CI reporter emitted it. */
selector: string
classification: FlakyTestClassification
/** Runs where one commit both failed and passed the test (re-run attempt or in-job retry): the flake proof. */
@@ -533,6 +540,7 @@ export type QuarantineRequestAction = 'quarantine' | 'extend' | 'remove'
export interface QuarantineSubmitInput {
action: QuarantineRequestAction
selector: string
+ runner?: TestRunner
reason: string
owner: string
/** Existing tracking issue, carried forward on extend/remove. */
@@ -546,6 +554,7 @@ export interface QuarantineSubmitInput {
export interface QuarantineModalState {
action: 'quarantine' | 'extend'
selector: string
+ runner: TestRunner
reason: string
owner: string
issue: string
@@ -588,6 +597,7 @@ function toRequestBody(input: QuarantineSubmitInput, repo: string | null): Quara
// Wire field is 'operation' (a bare 'action' enum collides in the OpenAPI spec).
operation: input.action,
selector: input.selector,
+ ...(input.runner ? { runner: input.runner } : {}),
// The repo being viewed, so the PR lands there. Null in local dev.
repo,
reason: input.reason,
@@ -1180,6 +1190,7 @@ export const engineeringAnalyticsLogic: LogicWrapper<engineeringAnalyticsLogicTy
return {
rows: data.items.map(
(it): FlakyTestRow => ({
+ runner: it.runner,
nodeid: it.nodeid,
selector: it.selector,
classification: it.classification,
diff --git a/products/engineering_analytics/frontend/scenes/teamDetailLogic.ts b/products/engineering_analytics/frontend/scenes/teamDetailLogic.ts
index 7b92cd46ca7c..78fd4d838983 100644
--- a/products/engineering_analytics/frontend/scenes/teamDetailLogic.ts
+++ b/products/engineering_analytics/frontend/scenes/teamDetailLogic.ts
@@ -5,6 +5,7 @@ import { ApiConfig } from 'lib/api'
import { Dayjs, dayjs } from 'lib/dayjs'
import { engineeringAnalyticsTeamCiActivity, engineeringAnalyticsTeamMergeTrend } from '../generated/api'
+import type { TeamTestSignalApi } from '../generated/api.schemas'
import { DEFAULT_TEAMS_WINDOW, TeamsWindow, UNOWNED_TEAM } from './teamsLogic'
const projectId = (): string => String(ApiConfig.getCurrentProjectId())
@@ -16,6 +17,7 @@ export interface TeamDetailLogicProps {
}
export interface TeamTestSignalRow {
+ runner: TeamTestSignalApi['runner']
nodeid: string
selector: string
signalCount: number
@@ -133,6 +135,7 @@ export const teamDetailLogic = kea<teamDetailLogicType>([
})
return {
tests: data.tests.map((t) => ({
+ runner: t.runner,
nodeid: t.nodeid,
selector: t.selector,
signalCount: t.signal_count,
diff --git a/products/engineering_analytics/mcp/tools.yaml b/products/engineering_analytics/mcp/tools.yaml
index e492aac08cd5..e46b9b8a6f02 100644
--- a/products/engineering_analytics/mcp/tools.yaml
+++ b/products/engineering_analytics/mcp/tools.yaml
@@ -81,19 +81,20 @@ tools:
list: true
title: Active test health queue
description: >
- Backend 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, and this data only sees Backend CI. 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 the test fails while masked as xfail.
+ 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, an xfail, 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; nodeid is only the stable grouping key.
+ 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.
feature_flag: engineering-analytics
engineering-analytics-job-aggregates:
operation: engineering_analytics_job_aggregates
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 8704ed9f7b20..f780283f47d7 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
@@ -41,12 +41,12 @@ autonomous agents (e.g. PostHog Desktop) reasoning about their own PRs.
window (`date_from` default `-7d`, max 30 days). Evidence is counted per CI run, never per span or run attempt.
`classification` is `confirmed_flake` only where the evidence proves nondeterminism
(`same_commit_recovery_run_count > 0`: one commit both failed and passed the test, via a "Re-run failed jobs"
- attempt going green or an in-job retry); `quarantined` means failing while masked as xfail;
+ attempt going green or an in-job retry); `quarantined` means a tolerated failure was recorded while masked;
`suspected_regression` means only failures were recorded, which is absence of proof, not proof of a real break.
- A test qualifies on any same-commit recovery, an xfail, any master/main failure, or failures on ≥
+ A test qualifies on any same-commit recovery, a quarantined failure, any master/main failure, or failures on ≥
`min_failed_prs` distinct PRs (`failed_pr_count`). Answers "what is this failing test costing us" and picks
- quarantine candidates. **It does not answer "which tests are flaky"**: this queue only sees Backend CI, and
- recovery proof only arrives when someone re-runs failed jobs (or a test is hand-marked
+ 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.
diff --git a/services/mcp/schema/generated-tool-definitions.json b/services/mcp/schema/generated-tool-definitions.json
index cb19e23b0577..e0bb32a1d373 100644
--- a/services/mcp/schema/generated-tool-definitions.json
+++ b/services/mcp/schema/generated-tool-definitions.json
@@ -3161,7 +3161,7 @@
"feature_flag": "engineering-analytics"
},
"engineering-analytics-flaky-tests": {
- "description": "Backend 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, and this data only sees Backend CI. 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 the test fails while masked as xfail. 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, an xfail, 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; 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). 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",
diff --git a/services/mcp/schema/tool-definitions-all.json b/services/mcp/schema/tool-definitions-all.json
index 014409e81886..b8ab34d3560a 100644
--- a/services/mcp/schema/tool-definitions-all.json
+++ b/services/mcp/schema/tool-definitions-all.json
@@ -3204,7 +3204,7 @@
"feature_flag": "engineering-analytics"
},
"engineering-analytics-flaky-tests": {
- "description": "Backend 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, and this data only sees Backend CI. 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 the test fails while masked as xfail. 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, an xfail, 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; 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). 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",
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index 590d706aec11..6c36be3bb104 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -13456,6 +13456,18 @@ export namespace Schemas {
failing_workflows?: string[];
}
+ /**
+ * * `pytest` - PYTEST
+ * * `jest` - JEST
+ */
+ export type CITestRunnerEnum = typeof CITestRunnerEnum[keyof typeof CITestRunnerEnum];
+
+
+ export const CITestRunnerEnum = {
+ Pytest: 'pytest',
+ Jest: 'jest',
+ } as const;
+
export interface EventsHeatMapColumnAggregationResult {
column: number;
value: number;
@@ -31401,11 +31413,16 @@ export namespace Schemas {
} as const;
export interface FlakyTestItem {
- /** Reconstructed pytest nodeid (the CI span name), e.g. 'posthog/api/test/test_event/TestEvents::test_x'. A stable grouping key, not a runnable selector — use `selector` to run or quarantine the test. */
+ /** Test runner that emitted this signal: 'pytest' or 'jest'.
+ *
+ * * `pytest` - PYTEST
+ * * `jest` - JEST */
+ runner: CITestRunnerEnum;
+ /** Runner-specific stable test identity (the CI span name). This is a grouping key, not necessarily runnable; use `selector` to run or quarantine the test. */
nodeid: string;
- /** Runnable pytest selector, e.g. 'posthog/api/test/test_event.py::TestEvents::test_x'. Exact when the CI reporter emitted it; otherwise reconstructed from the nodeid, where the file/class boundary is a best-effort guess. */
+ /** Runnable pytest or Jest selector. Exact when the CI reporter emitted it; older pytest spans use a best-effort reconstruction from the nodeid. */
selector: string;
- /** confirmed_flake: one commit both failed and passed the test (a re-run attempt went green, or an in-job retry recovered it), so it is provably nondeterministic. quarantined: it fails while masked as xfail. suspected_regression: only failures were recorded, which is absence of proof, not proof that it is a real break.
+ /** confirmed_flake: one commit both failed and passed the test (a re-run attempt went green, or an in-job retry recovered it), so it is provably nondeterministic. quarantined: a tolerated failure was recorded while it was masked. suspected_regression: only failures were recorded, which is absence of proof, not proof that it is a real break.
*
* * `confirmed_flake` - CONFIRMED_FLAKE
* * `suspected_regression` - SUSPECTED_REGRESSION
@@ -31419,9 +31436,9 @@ export namespace Schemas {
failed_pr_count: number;
/** Failed runs on the default branch (master/main approximation): the 'matters right now' signal that a test is breaking the trunk, not just PR branches. */
master_failed_run_count: number;
- /** Runs where the test failed while quarantined (xfail): already masked in CI, still failing. */
+ /** Runs where the test recorded a tolerated failure while quarantined: already masked in CI, still failing. */
quarantined_failed_run_count: number;
- /** Most recent failure, recovery, or xfail run for this test in the window. */
+ /** Most recent failure, recovery, or quarantined-failure run for this test in the window. */
last_signal_at: string;
}
@@ -56361,6 +56378,20 @@ export namespace Schemas {
expires_at?: string | null;
}
+ /**
+ * * `pytest` - PYTEST
+ * * `jest` - JEST
+ * * `playwright` - PLAYWRIGHT
+ */
+ export type QuarantineRequestRunnerEnum = typeof QuarantineRequestRunnerEnum[keyof typeof QuarantineRequestRunnerEnum];
+
+
+ export const QuarantineRequestRunnerEnum = {
+ Pytest: 'pytest',
+ Jest: 'jest',
+ Playwright: 'playwright',
+ } as const;
+
export interface QuarantineRequest {
/** What to do: 'quarantine' (add or replace an entry and file a tracking issue), 'extend' (re-stamp an existing entry's expiry, reusing its issue), or 'remove' (delete the entry). All three open a pull request.
*
@@ -56370,6 +56401,12 @@ export namespace Schemas {
operation: OperationEnum;
/** Test selector to act on: an exact test id, a file, a directory, a class prefix, or 'product:<dashed-name>'. */
selector: string;
+ /** Test runner the selector targets: 'pytest', 'jest', or 'playwright'. Existing entries and Jest file extensions are inferred for older clients that omit it; other selectors default to 'pytest'.
+ *
+ * * `pytest` - PYTEST
+ * * `jest` - JEST
+ * * `playwright` - PLAYWRIGHT */
+ runner?: QuarantineRequestRunnerEnum | null;
/**
* Optional 'owner/name' repository override; defaults to the team's most active repo.
* @nullable
@@ -68529,15 +68566,20 @@ export namespace Schemas {
}
export interface TeamTestSignal {
- /** Reconstructed pytest nodeid (the CI span name), a stable grouping key. */
+ /** Test runner that emitted this signal: 'pytest' or 'jest'.
+ *
+ * * `pytest` - PYTEST
+ * * `jest` - JEST */
+ runner: CITestRunnerEnum;
+ /** Runner-specific test identity (the CI span name), a stable grouping key. */
nodeid: string;
- /** Runnable pytest selector; exact when the CI reporter emitted it. */
+ /** Runnable pytest or Jest selector; exact for newly emitted spans. */
selector: string;
- /** Runs in the current window where the test failed, errored, or a retry recovered it (xfail excluded). */
+ /** Runs in the current window where the test failed, errored, or a retry recovered it (quarantined failures excluded). */
signal_count: number;
/** Same count over the equal-length window before date_from. */
signal_count_prior: number;
- /** Most recent failure, recovery, or xfail run for this test, either window. */
+ /** Most recent failure, recovery, or quarantined-failure run for this test, either window. */
last_seen_at: string;
}
@@ -68569,11 +68611,11 @@ export namespace Schemas {
same_commit_recovery_run_count: number;
/** Same count over the prior window. */
same_commit_recovery_run_count_prior: number;
- /** Runs where an owned test failed while quarantined (xfail): masked in CI, still failing. */
+ /** Runs where an owned test recorded a tolerated failure while quarantined: masked in CI, still failing. */
quarantined_failed_run_count: number;
/** Same count over the prior window. */
quarantined_failed_run_count_prior: number;
- /** Most recent failure, recovery, or xfail run across the team's owned tests, either window. */
+ /** Most recent failure, recovery, or quarantined-failure run across the team's owned tests, either window. */
last_seen_at: string;
}
diff --git a/services/mcp/src/generated/engineering_analytics/api.ts b/services/mcp/src/generated/engineering_analytics/api.ts
index 1cca760998fb..4ac313609bd5 100644
--- a/services/mcp/src/generated/engineering_analytics/api.ts
+++ b/services/mcp/src/generated/engineering_analytics/api.ts
@@ -57,7 +57,7 @@ export const EngineeringAnalyticsCiFailureLogsQueryParams = /* @__PURE__ */ zod.
})
/**
- * The active test-health queue: backend tests worth acting on now, from the per-test CI spans, over a window (default -7d, maximum 30 days). Evidence is counted per CI run, never per span or run attempt. A test is a 'confirmed_flake' when one commit both failed and passed it (a 'Re-run failed jobs' attempt went green, or an in-job retry recovered it); 'quarantined' when it fails while masked as xfail; otherwise 'suspected_regression'. It qualifies on any same-commit recovery, any master/main failure, an xfail, or failures on at least min_failed_prs distinct PRs. Counts are absolute, never rates: CI emits a span for every failure but only for passes slow enough to clear the emitter's duration threshold, so there is no execution denominator. 'suspected_regression' means no recovery was recorded in this data, not that the test never flakes.
+ * The active test-health queue: pytest and Jest tests worth acting on now, from the per-test CI spans, over a window (default -7d, maximum 30 days). Evidence is counted per CI run, never per span or run attempt. A test is a 'confirmed_flake' when one commit both failed and passed it (a 'Re-run failed jobs' attempt went green, or an in-job retry recovered it); 'quarantined' when a tolerated failure is recorded while it is masked; otherwise 'suspected_regression'. It qualifies on any same-commit recovery, any master/main failure, a quarantined failure, or failures on at least min_failed_prs distinct PRs. 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 EngineeringAnalyticsFlakyTestsParams = /* @__PURE__ */ zod.object({
project_id: zod
@@ -207,7 +207,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 a span for every failure but only for passes slow enough to clear the emitter's duration threshold, 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 (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.
*/
export const EngineeringAnalyticsTeamCiHealthParams = /* @__PURE__ */ zod.object({
project_id: zod