Three fenced worker Pods claim Hermes Kanban runs through a coordinator that owns every state transition, with per-ordinal HMAC authority, a mediated broker-only SCM path, and durable per-ordinal workspaces. Content is the reviewed head of PR #18 (689bcb6e) with PR 16's and PR 19's contributions removed: they were merged in only to validate co-existence and are not prerequisites, so this branch no longer carries them as ancestors. Only PR 14 and PR 15 remain, because the broker boundary and the cli_lane_* decomposition are load-bearing for two of the fixed P0 boundaries. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
128 lines
5.5 KiB
Python
128 lines
5.5 KiB
Python
"""Detailed Atlas Jobs dashboard collapse and drilldown contracts."""
|
|
|
|
from scripts.tests.test_dashboard_render_support import load_module
|
|
|
|
|
|
def test_jobs_dashboard_collapses_heavy_drilldowns_for_light_first_paint():
|
|
mod = load_module()
|
|
dashboard = mod.build_jobs_dashboard()
|
|
panels = dashboard["panels"]
|
|
rows = [panel for panel in panels if panel["type"] == "row"]
|
|
visible_query_panels = [panel for panel in panels if panel["type"] != "row"]
|
|
nested_panels_by_title = {
|
|
child["title"]: child for row in rows for child in row.get("panels", [])
|
|
}
|
|
|
|
assert len(panels) == 18
|
|
assert len(visible_query_panels) == 12
|
|
assert sum(len(panel.get("targets", [])) for panel in visible_query_panels) == 12
|
|
assert all(
|
|
panel["title"] != "Coverage Gap to 95% by Suite"
|
|
for panel in visible_query_panels
|
|
)
|
|
assert [row["title"] for row in rows] == [
|
|
"CI Runs And Test Result History",
|
|
"Check Failure Rates By Suite",
|
|
"Check Healthy Rates By Suite",
|
|
"Test Drilldowns And Problem Tests",
|
|
"Telemetry Completeness And Branches",
|
|
"SonarQube Project Health",
|
|
]
|
|
assert all(row["collapsed"] for row in rows)
|
|
|
|
assert "Coverage Failure Rate" in nested_panels_by_title
|
|
assert "Supply Chain Healthy Rate" in nested_panels_by_title
|
|
assert "Test Category Health History" in nested_panels_by_title
|
|
assert "Selected Test Pass Rate History" in nested_panels_by_title
|
|
assert "Coverage Metrics Present by Suite" in nested_panels_by_title
|
|
assert "SonarQube API Up" in nested_panels_by_title
|
|
|
|
failure_rate_panel = nested_panels_by_title["Coverage Failure Rate"]
|
|
assert failure_rate_panel["type"] == "state-timeline"
|
|
assert failure_rate_panel["fieldConfig"]["defaults"]["unit"] == "percent"
|
|
assert failure_rate_panel["fieldConfig"]["defaults"]["max"] == 100
|
|
assert (
|
|
failure_rate_panel["fieldConfig"]["defaults"]["thresholds"]["steps"][0]["color"]
|
|
== "dark-blue"
|
|
)
|
|
assert "increase(" not in failure_rate_panel["targets"][0]["expr"]
|
|
assert (
|
|
"platform_quality:check_failed_flag:present_1h"
|
|
in failure_rate_panel["targets"][0]["expr"]
|
|
)
|
|
assert (
|
|
"platform_quality:check_seen_flag:present_1h"
|
|
in failure_rate_panel["targets"][0]["expr"]
|
|
)
|
|
assert (
|
|
"platform_quality:check_status:present_1h"
|
|
not in failure_rate_panel["targets"][0]["expr"]
|
|
)
|
|
assert (
|
|
".*_quality_gate_checks_total" not in failure_rate_panel["targets"][0]["expr"]
|
|
)
|
|
assert "last_over_time" not in failure_rate_panel["targets"][0]["expr"]
|
|
assert "label_replace" not in failure_rate_panel["targets"][0]["expr"]
|
|
assert "0 *" in failure_rate_panel["targets"][0]["expr"]
|
|
assert "and on(suite)" not in failure_rate_panel["targets"][0]["expr"]
|
|
|
|
pass_rate_panel = nested_panels_by_title["Selected Test Pass Rate History"]
|
|
assert pass_rate_panel["type"] == "state-timeline"
|
|
assert (
|
|
"platform_quality:test_case_pass_rate:percent_1h"
|
|
in pass_rate_panel["targets"][0]["expr"]
|
|
)
|
|
assert (
|
|
"platform_quality_gate_test_case_result"
|
|
not in pass_rate_panel["targets"][0]["expr"]
|
|
)
|
|
|
|
pass_fail_panel = nested_panels_by_title["Selected Test Pass/Fail History"]
|
|
assert pass_fail_panel["fieldConfig"]["defaults"]["custom"]["drawStyle"] == "bars"
|
|
assert all(
|
|
"platform_quality:test_case_status:count_1h" in target["expr"]
|
|
for target in pass_fail_panel["targets"]
|
|
)
|
|
|
|
problematic_panel = nested_panels_by_title[
|
|
"Problematic Tests Over Time (Top failures)"
|
|
]
|
|
assert problematic_panel["type"] == "state-timeline"
|
|
assert problematic_panel["gridPos"]["w"] == 24
|
|
assert 'test!=""' in problematic_panel["targets"][0]["expr"]
|
|
assert "vector(0)" not in problematic_panel["targets"][0]["expr"]
|
|
assert problematic_panel["fieldConfig"]["defaults"]["thresholds"]["steps"] == [
|
|
{"color": "dark-blue", "value": None},
|
|
{"color": "dark-green", "value": 2},
|
|
{"color": "dark-yellow", "value": 3},
|
|
{"color": "dark-orange", "value": 5},
|
|
{"color": "dark-red", "value": 8},
|
|
]
|
|
assert "rolling 24h failure count" in problematic_panel["description"]
|
|
assert "at least two recent failures" in problematic_panel["description"]
|
|
|
|
sonar_mix_panel = nested_panels_by_title["Sonar Gate Status Mix (Selected)"]
|
|
sonar_health_panel = nested_panels_by_title["Sonar Gate Health by Project"]
|
|
assert sonar_mix_panel["gridPos"]["w"] == 4
|
|
assert sonar_health_panel["gridPos"]["w"] == 8
|
|
assert sonar_health_panel["type"] == "state-timeline"
|
|
assert (
|
|
"platform_quality:sonar_gate_health_percent:latest_1h"
|
|
in sonar_health_panel["targets"][0]["expr"]
|
|
)
|
|
assert (
|
|
"sonarqube_project_quality_gate_pass"
|
|
not in sonar_health_panel["targets"][0]["expr"]
|
|
)
|
|
|
|
branch_panel = nested_panels_by_title["Primary Branch Clean by Suite (7d)"]
|
|
recent_branch_panel = nested_panels_by_title["Recent Branch Evidence by Suite (7d)"]
|
|
assert branch_panel["gridPos"]["x"] == 12
|
|
assert recent_branch_panel["gridPos"]["x"] == 18
|
|
assert "[7d:1h]" in recent_branch_panel["targets"][0]["expr"]
|
|
assert "[7d:1h]" in branch_panel["targets"][0]["expr"]
|
|
assert branch_panel["fieldConfig"]["defaults"]["unit"] == "percent"
|
|
assert "unless on(suite)" in branch_panel["targets"][0]["expr"]
|
|
assert "> bool 0" in branch_panel["targets"][0]["expr"]
|
|
assert branch_panel["targets"][0]["expr"].startswith("sort(")
|