from pathlib import Path from runtime_overlays import RuntimeOverlay, RuntimeSignal, RuntimeSignalKind, summarize_runtime from semantic_kernel import index_project def test_summarize_runtime_attaches_signals_to_nodes(tmp_path: Path): module = tmp_path / "demo_module.bsl" module.write_text("Процедура Проведение()\nКонецПроцедуры\n", encoding="utf-8") snapshot = index_project(tmp_path, project_id="demo") routine = next(node for node in snapshot.nodes if node.name == "Проведение") overlay = RuntimeOverlay( project_id="demo", signals=[ RuntimeSignal( signal_id="signal.1", lineage_id=routine.lineage_id, kind=RuntimeSignalKind.ERROR, duration_ms=120.0, ) ], ) summaries = summarize_runtime(snapshot, overlay) assert summaries[0].node.name == "Проведение" assert summaries[0].error_count == 1