style(ariadne): document testing triage scope helpers

This commit is contained in:
codex 2026-05-20 06:16:23 -03:00
parent f86f591db2
commit 76499d46e3

View File

@ -24,6 +24,8 @@ _TEST_SUITE_ALIASES = {
def metric_suite_names(quality: dict[str, Any]) -> set[str]:
"""Return canonical in-scope suite names found in quality metrics."""
suites: set[str] = set()
for bucket in quality.values():
if not isinstance(bucket, dict):
@ -39,6 +41,8 @@ def metric_suite_names(quality: dict[str, Any]) -> set[str]:
def jenkins_suites(jenkins: dict[str, Any]) -> set[str]:
"""Return canonical in-scope suite names found in Jenkins failures."""
suites: set[str] = set()
for item in jenkins.get("failed_builds") or []:
if not isinstance(item, dict):
@ -50,14 +54,20 @@ def jenkins_suites(jenkins: dict[str, Any]) -> set[str]:
def quality_items_in_scope(items: list[dict[str, Any]]) -> list[dict[str, Any]]:
"""Filter quality metric items to suites that should affect triage."""
return [item for item in items if _quality_item_in_scope(item)]
def suite_in_scope(value: Any) -> bool:
"""Return whether a raw suite-like value belongs in quality triage."""
return canonical_suite_name(value) in IN_SCOPE_TEST_SUITES
def canonical_suite_name(value: Any) -> str:
"""Normalize suite/job labels so dashboards and triage agree."""
name = str(value or "").strip().lower()
if "/" in name:
name = name.rsplit("/", 1)[-1]