feat: show runtime diagnostics in management summary
This commit is contained in:
@@ -77,6 +77,37 @@ class ManageApiTests(unittest.TestCase):
|
||||
self.assertEqual(summary["metrics"]["event_count"], 2)
|
||||
self.assertEqual(summary["metrics"]["violation_count"], 1)
|
||||
|
||||
def test_summary_reads_runtime_diagnostics(self) -> None:
|
||||
with tempfile.TemporaryDirectory() as tmpdir:
|
||||
root = Path(tmpdir)
|
||||
config_path = root / "config" / "local.toml"
|
||||
save_config_document(
|
||||
config_path,
|
||||
{
|
||||
"runtime": {"diagnostics_path": "logs/runtime_diagnostics.jsonl"},
|
||||
"event_sink": {"path": "logs/events.jsonl"},
|
||||
"layout": {"rows": 1, "cols": 1, "zone_ids": ["r1c1"]},
|
||||
},
|
||||
)
|
||||
diagnostics_path = root / "logs" / "runtime_diagnostics.jsonl"
|
||||
diagnostics_path.parent.mkdir()
|
||||
diagnostics_path.write_text(
|
||||
json.dumps(
|
||||
{
|
||||
"ts": "2026-04-28T10:00:00+08:00",
|
||||
"zone_counts": {"r1c1": 1},
|
||||
"diagnostics": {"baseline_ready": True},
|
||||
}
|
||||
),
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
summary = build_summary(ManageContext(config_path=config_path, project_root=root))
|
||||
|
||||
self.assertEqual(summary["metrics"]["diagnostics_count"], 1)
|
||||
self.assertEqual(summary["metrics"]["latest_zone_counts"], {"r1c1": 1})
|
||||
self.assertTrue(summary["metrics"]["baseline_ready"])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user