:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(ci): jest support in test-timings reporter (#73528)
Raúl Negrón-Otero940ac53d381c
diff --git a/.github/scripts/report_test_timings.py b/.github/scripts/report_test_timings.pyindex 9cac35a29506..e8fdd94f1aca 100644--- a/.github/scripts/report_test_timings.py+++ b/.github/scripts/report_test_timings.py@@ -12,13 +12,14 @@# [tool.uv.sources]# posthog-owners = { path = "../../tools/owners" }# ///-"""Emit OTLP traces from Backend CI JUnit XML artifacts.+"""Emit OTLP traces from CI JUnit XML artifacts.-Reads the JUnit artifacts downloaded by the workflow (`junit-results-backend-*`-and `product-junit-results-*`) and emits one trace per job (shard) shaped:+Reads the JUnit artifacts downloaded by the workflow (`junit-results-backend-*`,+`junit-results-frontend-*`, and `product-junit-results-*`) and emits one trace+per job (shard) shaped:<workflow> / <job> (root, one trace per job)- ├── <pytest nodeid> (test)+ ├── <runner-specific test id> (test)└── ...Trace ID is deterministic per (run_id, run_attempt, job) so each job in each@@ -43,16 +44,18 @@ import osimport reimport sysimport json+import mathimport hashlibimport loggingimport secretsimport argparse+import posixpathfrom collections.abc import Callable, Mappingfrom dataclasses import dataclass, replacefrom datetime import UTC, datetime, timedeltafrom functools import cachefrom pathlib import Path-from typing import Any+from typing import Any, Literalimport defusedxml.ElementTree as ET # XXE-safe stdlib drop-infrom opentelemetry import trace@@ -67,9 +70,14 @@ from posthog_owners import OwnersResolverlogger = logging.getLogger("report_test_timings")DEFAULT_OTLP_ENDPOINT = "https://us.i.posthog.com/i/v1/traces"-SERVICE_NAME = "ci-backend"+Runner = Literal["pytest", "jest"]++DEFAULT_RUNNER: Runner = "pytest"+SERVICE_NAMES: dict[Runner, str] = {"pytest": "ci-backend", "jest": "ci-frontend"}INSTRUMENTATION_NAME = "posthog-ci-test-timings"INSTRUMENTATION_VERSION = "0.1.0"+JEST_QUARANTINE_SIGNAL_GLOB = "posthog-jest-quarantine-*.jsonl"+MAX_QUARANTINE_SIGNAL_BYTES = 10 * 1024 * 1024# ~150 KB serialized at this size — well under capture-logs' 2 MiB body limit.SPAN_BATCH_SIZE = 1000@@ -84,8 +92,8 @@ class TestCase:end: datetimeoutcome: str # passed | failed | error | skipped | xfailed | rerun_passedattempts: int # 1 + number of pytest-rerunfailures retries before final outcome- file: str # repo-relative test file from JUnit's `file`; '' when absent (external shards)- selector: str # runnable 'path/test.py::Class::test' from JUnit's `file`; '' when file is absent+ file: str # normalized repo-relative test file; '' when JUnit omitted or escaped the repo+ selector: str # runnable runner-specific selector; '' when JUnit omitted the file@dataclass(frozen=True)@@ -123,8 +131,8 @@ class Shard:def split_artifact_name(name_parts: list[str]) -> tuple[str, str]:if not name_parts:return "", ""- if name_parts[0] == "backend" and len(name_parts) > 1:- return "backend", "-".join(name_parts[1:])+ if name_parts[0] in ("backend", "frontend") and len(name_parts) > 1:+ return name_parts[0], "-".join(name_parts[1:])return "-".join(name_parts), "-".join(name_parts)@@ -170,7 +178,7 @@ def collect_artifact_infos(artifacts_root: Path) -> list[ArtifactInfo]:groups_by_shard_key.setdefault((suite, segment), set()).add(group)shard_totals = {- key: max(groups) if groups == set(range(1, max(groups) + 1)) else None+ key: max(groups) if min(groups) == 1 and len(groups) == max(groups) else Nonefor key, groups in groups_by_shard_key.items()}@@ -223,7 +231,7 @@ def classify_testcase(testcase: Any) -> tuple[str, int]:return final_outcome, 1 + rerun_count-def to_nodeid(classname: str, name: str) -> str:+def to_pytest_nodeid(classname: str, name: str) -> str:"""`posthog.hogql.test.test_resolver.TestResolver`, `test_x` → `posthog/hogql/test/test_resolver/TestResolver::test_x`.JUnit drops the `.py` and the file/class boundary; this is a best-effort@@ -232,7 +240,7 @@ def to_nodeid(classname: str, name: str) -> str:return f"{classname.replace('.', '/')}::{name}" if classname else name-def to_selector(file: str, classname: str, name: str) -> str:+def to_pytest_selector(file: str, classname: str, name: str) -> str:"""Runnable pytest selector 'path/to/test_x.py::TestClass::test_y' from JUnit's `file` + `classname`.Unlike `to_nodeid`, JUnit's `file` gives the exact module boundary, so nothing is guessed: the@@ -250,6 +258,27 @@ def to_selector(file: str, classname: str, name: str) -> str:return ""+def normalize_jest_file(file: str) -> str:+ """Normalize Jest's frontend-working-directory path into a repo-relative path."""+ if not file:+ return ""+ normalized = posixpath.normpath(posixpath.join("frontend", file.replace("\\", "/")))+ if normalized == ".." or normalized.startswith("../") or normalized.startswith("/"):+ return ""+ return normalized+++def test_identity(runner: Runner, file: str, classname: str, name: str) -> tuple[str, str, str]:+ """Return normalized (file, stable id, runnable selector) for one runner's JUnit shape."""+ if runner == "jest":+ normalized_file = normalize_jest_file(file)+ selector = f"{normalized_file}::{name}" if normalized_file and name else ""+ return normalized_file, selector or name, selector+ # Products run pytest with `--rootdir ../..`, so `file`/`classname` are already+ # repo-relative (`products/<name>/...`) — no prefixing needed here.+ return file, to_pytest_nodeid(classname, name), to_pytest_selector(file, classname, name)++def product_name(junit_filename: str) -> str:"""`junit-product-<name>.xml` → `<name>`; '' for any other junit filename."""if not junit_filename.startswith("junit-product-") or not junit_filename.endswith(".xml"):@@ -301,7 +330,36 @@ def parse_testsuite_properties(suite_elem: Any) -> dict[str, str]:return result-def parse_shard(xml_path: Path, info: ArtifactInfo) -> Shard | None:+def load_jest_quarantine_signals(artifact_path: Path) -> frozenset[str]:+ """Read best-effort tolerated-failure markers emitted by Jest workers in this artifact."""+ test_ids: set[str] = set()+ bytes_read = 0+ for signal_path in sorted(artifact_path.glob(JEST_QUARANTINE_SIGNAL_GLOB)):+ try:+ bytes_read += signal_path.stat().st_size+ if bytes_read > MAX_QUARANTINE_SIGNAL_BYTES:+ logger.warning("ignored oversized Jest quarantine signals in %s", artifact_path)+ return frozenset(test_ids)+ with signal_path.open() as signals:+ for line in signals:+ try:+ signal = json.loads(line)+ except json.JSONDecodeError:+ continue+ test_id = signal.get("test_id") if isinstance(signal, dict) else None+ if isinstance(test_id, str) and 0 < len(test_id) <= 16_384:+ test_ids.add(test_id)+ except OSError as exc:+ logger.warning("failed to read %s: %s", signal_path, exc)+ return frozenset(test_ids)+++def parse_shard(+ xml_path: Path,+ info: ArtifactInfo,+ runner: Runner = DEFAULT_RUNNER,+ quarantined_test_ids: frozenset[str] = frozenset(),+) -> Shard | None:"""One Shard per junit XML file. Tolerant of malformed input."""try:root = ET.parse(xml_path).getroot()@@ -309,64 +367,70 @@ def parse_shard(xml_path: Path, info: ArtifactInfo) -> Shard | None:logger.warning("failed to parse %s: %s", xml_path, exc)return None- suite_elem = root if root.tag == "testsuite" else root.find("testsuite")- if suite_elem is None:- return None-- start = parse_iso_utc(suite_elem.get("timestamp", ""))- if start is None:+ suite_elements = [root] if root.tag == "testsuite" else root.findall("testsuite")+ if not suite_elements:return None- try:- wall_seconds = float(suite_elem.get("time", "0"))- except ValueError:- wall_seconds = 0.0-- properties = parse_testsuite_properties(suite_elem)- try:- setup_seconds = max(0.0, float(properties.get("posthog.setup_seconds", "0")))- except ValueError:- setup_seconds = 0.0- # Clamp to wall time so a clock skew or malformed property can't push tests past `end`.- setup_seconds = min(setup_seconds, wall_seconds)tests: list[TestCase] = []- cursor = start + timedelta(seconds=setup_seconds)- for tc in suite_elem.iter("testcase"):- classname = tc.get("classname", "")- name = tc.get("name", "")- # Products run pytest with `--rootdir ../..`, so `file`/`classname` are already- # repo-relative (`products/<name>/...`) — no prefixing needed here.- file = tc.get("file", "")- outcome, attempts = classify_testcase(tc)+ suite_windows: list[tuple[datetime, datetime]] = []+ setup_seconds = 0.0+ for suite_elem in suite_elements:+ suite_start = parse_iso_utc(suite_elem.get("timestamp", ""))+ if suite_start is None:+ continuetry:- duration = float(tc.get("time", "0"))+ wall_seconds = max(0.0, float(suite_elem.get("time", "0")))except ValueError:- duration = 0.0- for child in tc:- if is_retry_attempt(child.tag):- try:- duration += max(0.0, float(child.get("time", "0")))- except ValueError:- pass- test_start = cursor- test_end = cursor + timedelta(seconds=duration)- cursor = test_end- tests.append(- TestCase(- nodeid=to_nodeid(classname, name),- classname=classname,- name=name,- file=file,- selector=to_selector(file, classname, name),- duration_seconds=duration,- start=test_start,- end=test_end,- outcome=outcome,- attempts=attempts,+ wall_seconds = 0.0+ properties = parse_testsuite_properties(suite_elem)+ try:+ suite_setup_seconds = max(0.0, float(properties.get("posthog.setup_seconds", "0")))+ except ValueError:+ suite_setup_seconds = 0.0+ suite_setup_seconds = min(suite_setup_seconds, wall_seconds)+ setup_seconds += suite_setup_seconds+ cursor = suite_start + timedelta(seconds=suite_setup_seconds)+ for tc in suite_elem.iter("testcase"):+ classname = tc.get("classname", "")+ name = tc.get("name", "")+ file, nodeid, selector = test_identity(runner, tc.get("file", ""), classname, name)+ outcome, attempts = classify_testcase(tc)+ if outcome == "passed" and nodeid in quarantined_test_ids:+ outcome = "xfailed"+ try:+ duration = max(0.0, float(tc.get("time", "0")))+ except ValueError:+ duration = 0.0+ for child in tc:+ if is_retry_attempt(child.tag):+ try:+ duration += max(0.0, float(child.get("time", "0")))+ except ValueError:+ pass+ test_start = cursor+ test_end = cursor + timedelta(seconds=duration)+ cursor = test_end+ tests.append(+ TestCase(+ nodeid=nodeid,+ classname=classname,+ name=name,+ file=file,+ selector=selector,+ duration_seconds=duration,+ start=test_start,+ end=test_end,+ outcome=outcome,+ attempts=attempts,+ ))- )+ suite_windows.append((suite_start, suite_start + timedelta(seconds=wall_seconds)))- end = start + timedelta(seconds=wall_seconds)+ if not suite_windows:+ return None+ start = min(window[0] for window in suite_windows)+ end = max(window[1] for window in suite_windows)+ wall_seconds = (end - start).total_seconds()testcase_seconds = sum(t.duration_seconds for t in tests)return Shard(info=product_shard_info(info, xml_path.name),@@ -380,11 +444,12 @@ def parse_shard(xml_path: Path, info: ArtifactInfo) -> Shard | None:)-def collect_shards(artifacts_root: Path) -> list[Shard]:+def collect_shards(artifacts_root: Path, runner: Runner = DEFAULT_RUNNER) -> list[Shard]:shards: list[Shard] = []for artifact in collect_artifact_infos(artifacts_root):+ quarantined_test_ids = load_jest_quarantine_signals(artifact.path) if runner == "jest" else frozenset()for xml_path in sorted(artifact.path.rglob("junit*.xml")):- shard = parse_shard(xml_path, artifact)+ shard = parse_shard(xml_path, artifact, runner, quarantined_test_ids)if shard is not None:shards.append(shard)return shards@@ -586,14 +651,15 @@ def owner_team_lookup() -> Callable[[str], str]:return lookup-def emit_traces(shards: list[Shard], endpoint: str, token: str) -> None:+def emit_traces(shards: list[Shard], endpoint: str, token: str, runner: Runner = DEFAULT_RUNNER) -> None:"""Emit one trace per job: a `<workflow> / <job>` root span with test children, shipped via OTLP HTTP."""run_id = os.environ.get("GITHUB_RUN_ID", "0")run_attempt = os.environ.get("GITHUB_RUN_ATTEMPT", "1")- workflow = os.environ.get("GITHUB_WORKFLOW", "") or SERVICE_NAME+ service_name = SERVICE_NAMES[runner]+ workflow = os.environ.get("GITHUB_WORKFLOW", "") or service_nameid_generator = _FixedTraceIdGenerator()- resource = Resource.create({"service.name": SERVICE_NAME, **workflow_resource_attributes()})+ resource = Resource.create({"service.name": service_name, **workflow_resource_attributes()})provider = TracerProvider(resource=resource, id_generator=id_generator)exporter = OTLPSpanExporter(endpoint=endpoint, headers={"Authorization": f"Bearer {token}"})provider.add_span_processor(BatchSpanProcessor(exporter, max_export_batch_size=SPAN_BATCH_SIZE))@@ -608,12 +674,18 @@ def emit_traces(shards: list[Shard], endpoint: str, token: str) -> None:# Mutate the shared generator before each job so its root span (and the test# children that inherit the active parent's trace ID) form a distinct trace.id_generator.trace_id = deterministic_trace_id(run_id, run_attempt, job_trace_key(shard.info))- _emit_shard_span(tracer, shard, job_trace_name(workflow, shard.info), owner_of)+ _emit_shard_span(tracer, shard, job_trace_name(workflow, shard.info), owner_of, runner)provider.shutdown()-def _emit_shard_span(tracer: trace.Tracer, shard: Shard, root_name: str, owner_of: Callable[[str], str]) -> bool:+def _emit_shard_span(+ tracer: trace.Tracer,+ shard: Shard,+ root_name: str,+ owner_of: Callable[[str], str],+ runner: Runner = DEFAULT_RUNNER,+) -> bool:"""Emit the job's root span and its test children. Returns True iff any child has Error."""info = shard.infoshard_span = tracer.start_span(root_name, start_time=_to_ns(shard.start))@@ -643,6 +715,8 @@ def _emit_shard_span(tracer: trace.Tracer, shard: Shard, root_name: str, owner_o# that stay stable even after threshold filtering.for test in shard.tests:test_span = tracer.start_span(test.nodeid, start_time=_to_ns(test.start))+ test_span.set_attribute("test.runner", runner)+ test_span.set_attribute("test.job_key", job_trace_key(info))test_span.set_attribute("test.outcome", test.outcome)test_span.set_attribute("test.attempts", test.attempts)test_span.set_attribute("test.classname", test.classname)@@ -681,8 +755,10 @@ def parse_args(argv: list[str]) -> argparse.Namespace:parser.add_argument("artifacts_root",type=Path,- help="directory of downloaded JUnit artifacts (junit-results-backend-* and product-junit-results-*)",+ help="directory of downloaded JUnit artifacts (junit-results-backend-*, junit-results-frontend-*, "+ "and product-junit-results-*)",)+ parser.add_argument("--runner", choices=tuple(SERVICE_NAMES), default=DEFAULT_RUNNER, help="JUnit producer")parser.add_argument("--min-duration-seconds",type=float,@@ -695,6 +771,11 @@ def parse_args(argv: list[str]) -> argparse.Namespace:help=f"OTLP /v1/traces endpoint (default: $POSTHOG_OTLP_TRACES_ENDPOINT or {DEFAULT_OTLP_ENDPOINT})",)parser.add_argument("--dry-run", action="store_true", help="parse and summarize, do not emit")+ parser.add_argument(+ "--signals-only",+ action="store_true",+ help="emit failures and recovery evidence, but omit ordinary passing tests",+ )return parser.parse_args(argv)@@ -707,7 +788,7 @@ def main(argv: list[str] | None = None) -> int:return 0try:- shards = collect_shards(args.artifacts_root)+ shards = collect_shards(args.artifacts_root, args.runner)except Exception:logger.exception("failed to collect shards")return 0@@ -724,14 +805,17 @@ def main(argv: list[str] | None = None) -> int:)pre_filter = sum(len(s.tests) for s in shards)- shards = filter_shards(shards, args.min_duration_seconds, prior_failed_by_job)+ min_duration_seconds = math.inf if args.signals_only else args.min_duration_seconds+ shards = filter_shards(shards, min_duration_seconds, prior_failed_by_job)+ if args.signals_only:+ shards = [shard for shard in shards if shard.tests]post_filter = sum(len(s.tests) for s in shards)logger.info("collected %d shards, %d testcases (%d after %.2fs threshold filter)",len(shards),pre_filter,post_filter,- args.min_duration_seconds,+ min_duration_seconds,)if not shards:@@ -757,7 +841,7 @@ def main(argv: list[str] | None = None) -> int:for token in tokens:# Per-token isolation: one project's ingest failing must not block the other's.try:- emit_traces(shards, args.otlp_endpoint, token)+ emit_traces(shards, args.otlp_endpoint, token, args.runner)logger.info("emitted %d testcase spans to %s", post_filter, args.otlp_endpoint)except Exception:logger.exception("failed to emit traces")diff --git a/.github/scripts/test_report_test_timings.py b/.github/scripts/test_report_test_timings.pyindex 7dd7a82fd6c5..de282f876890 100644--- a/.github/scripts/test_report_test_timings.py+++ b/.github/scripts/test_report_test_timings.py@@ -65,8 +65,8 @@ def _testcase(("pkg/test_a.py", "totally.unrelated.Thing", "test_y", ""),],)-def test_to_selector(file: str, classname: str, name: str, expected: str) -> None:- assert report_test_timings.to_selector(file, classname, name) == expected+def test_to_pytest_selector(file: str, classname: str, name: str, expected: str) -> None:+ assert report_test_timings.to_pytest_selector(file, classname, name) == expected# ---------- artifact name parsing ----------@@ -76,6 +76,7 @@ def test_to_selector(file: str, classname: str, name: str, expected: str) -> Non"dir_name,expected",[("junit-results-backend-core-29", ("backend", "core", 29)),+ ("junit-results-frontend-FOSS-4", ("frontend", "FOSS", 4)),("junit-results-llm-gateway", ("llm-gateway", "llm-gateway", None)),("junit-results-hogli", ("hogli", "hogli", None)),],@@ -99,6 +100,16 @@ def test_split_attempt_suffix(dir_name: str, expected: tuple[str, int]) -> None:assert report_test_timings.split_attempt_suffix(dir_name) == expected+def test_collect_artifact_infos_does_not_expand_large_sparse_group(tmp_path: Path) -> None:+ artifact_dir = tmp_path / "junit-results-frontend-FOSS-8574803097"+ artifact_dir.mkdir()++ info = report_test_timings.collect_artifact_infos(tmp_path)[0]++ assert info.group == 8_574_803_097+ assert info.total is None++# ---------- shard parsing end-to-end ----------@@ -175,6 +186,90 @@ def test_collect_shards_builds_test_windows_and_overhead(tmp_path: Path) -> Noneassert shard.tests[3].outcome == "failed"+def test_collect_jest_shard_reads_legacy_and_isolated_product_suites(tmp_path: Path) -> None:+ artifact_dir = tmp_path / "junit-results-frontend-EE-1"+ artifact_dir.mkdir()+ (artifact_dir / "junit-EE-1.xml").write_text(+ textwrap.dedent(+ """\+ <?xml version="1.0"?>+ <testsuites name="jest tests" tests="2" failures="1" time="4.0">+ <testsuite name="src/scenes/legacy.test.ts" timestamp="2026-05-04T10:00:00" time="2.0">+ <testcase classname="legacy scene renders" name="legacy scene renders" time="0.2"+ file="src/scenes/legacy.test.ts"><failure message="x"/></testcase>+ </testsuite>+ <testsuite name="../products/surveys/frontend/surveyLogic.test.ts"+ timestamp="2026-05-04T10:00:01" time="3.0">+ <testcase classname="surveyLogic saves" name="surveyLogic saves" time="0.3"+ file="../products/surveys/frontend/surveyLogic.test.ts"/>+ </testsuite>+ </testsuites>+ """+ )+ )++ shard = report_test_timings.collect_shards(tmp_path, "jest")[0]++ assert (shard.info.suite, shard.info.segment, shard.info.group) == ("frontend", "EE", 1)+ assert [test.file for test in shard.tests] == [+ "frontend/src/scenes/legacy.test.ts",+ "products/surveys/frontend/surveyLogic.test.ts",+ ]+ assert [test.selector for test in shard.tests] == [+ "frontend/src/scenes/legacy.test.ts::legacy scene renders",+ "products/surveys/frontend/surveyLogic.test.ts::surveyLogic saves",+ ]+ assert [test.nodeid for test in shard.tests] == [test.selector for test in shard.tests]+ assert [test.outcome for test in shard.tests] == ["failed", "passed"]+ assert shard.start == datetime(2026, 5, 4, 10, 0, tzinfo=UTC)+ assert shard.end == datetime(2026, 5, 4, 10, 0, 4, tzinfo=UTC)+++def test_collect_jest_shard_marks_tolerated_failures_as_quarantined(tmp_path: Path) -> None:+ artifact_dir = tmp_path / "junit-results-frontend-FOSS-1"+ _write_shard_xml(+ artifact_dir,+ filename="junit-FOSS-1.xml",+ timestamp="2026-05-04T10:00:00",+ time="1.0",+ body=(+ '<testcase classname="suite flaky" name="suite flaky" time="0.1" '+ 'file="src/flaky.test.ts"/>'+ '<testcase classname="suite healthy" name="suite healthy" time="0.1" '+ 'file="src/flaky.test.ts"/>'+ ),+ )+ (artifact_dir / "posthog-jest-quarantine-123.jsonl").write_text(+ f"{json.dumps({'test_id': 'frontend/src/flaky.test.ts::suite flaky'})}\n"+ )++ shard = report_test_timings.collect_shards(tmp_path, "jest")[0]++ assert [test.outcome for test in shard.tests] == ["xfailed", "passed"]+ assert report_test_timings.should_emit(shard.tests[0], float("inf")) is True+++def test_load_jest_quarantine_signals_rejects_oversized_artifacts(+ tmp_path: Path, monkeypatch: pytest.MonkeyPatch+) -> None:+ monkeypatch.setattr(report_test_timings, "MAX_QUARANTINE_SIGNAL_BYTES", 10)+ (tmp_path / "posthog-jest-quarantine-123.jsonl").write_text('{"test_id":"too-large"}\n')++ assert report_test_timings.load_jest_quarantine_signals(tmp_path) == frozenset()+++ "junit_file,expected",+ [+ ("src/test/example.test.ts", "frontend/src/test/example.test.ts"),+ ("../products/web_analytics/frontend/example.test.ts", "products/web_analytics/frontend/example.test.ts"),+ ("../../outside.test.ts", ""),+ ],+)+def test_normalize_jest_file(junit_file: str, expected: str) -> None:+ assert report_test_timings.normalize_jest_file(junit_file) == expected++# ---------- rerun classification (posthog.reruns testcase property) ----------@@ -333,6 +428,18 @@ def test_filter_shards_preserves_parse_time_test_windows(tmp_path: Path) -> Noneassert filtered[0].tests[2].start == datetime(2026, 5, 4, 10, 0, 2, 300000, tzinfo=UTC)+def test_signals_only_threshold_keeps_failures_and_same_job_recovery() -> None:+ tests = [+ _testcase(name="slow_pass", duration=30.0),+ _testcase(name="failure", outcome="failed", duration=0.1),+ _testcase(name="recovery", duration=0.1),+ ]++ assert [+ test.name for test in tests if report_test_timings.should_emit(test, float("inf"), frozenset({"m::recovery"}))+ ] == ["failure", "recovery"]++# ---------- re-run attempts ----------@@ -463,6 +570,8 @@ def test_emit_shard_span_uses_stored_test_windows(monkeypatch: pytest.MonkeyPatcassert tracer.spans[2].end_time == report_test_timings._to_ns(start + timedelta(seconds=2.4))assert tracer.spans[0].attributes["shard.testcase_seconds"] == pytest.approx(2.1)assert tracer.spans[0].attributes["shard.overhead_seconds"] == pytest.approx(7.9)+ assert tracer.spans[1].attributes["test.runner"] == "pytest"+ assert tracer.spans[1].attributes["test.job_key"] == "backend:core:1"def test_emit_shard_span_emits_setup_span_when_setup_seconds_positive(monkeypatch: pytest.MonkeyPatch) -> None: