| 123456789101112131415161718192021222324252627282930313233 |
- """Real AMT zero-algorithm BLOCK summaries must remain readable over native gRPC."""
- from pathlib import Path
- from google.protobuf.json_format import MessageToDict
- from stl_backend.diagnostics import DiagnosticConsole
- from stl_backend.generated import bench_pb2 as pb
- from stl_backend.parsers import IncrementalSolParser
- from stl_backend.service import message
- class ConsoleDescriptionOnly:
- def console_description(self):
- return "fixture"
- def test_real_amt_block_summary_roundtrips_diagnostic_grpc(tmp_path):
- raw = (Path(__file__).parent / "fixtures/live_amt_block_20261026.log").read_bytes()
- parser = IncrementalSolParser()
- events = parser.feed(raw) + parser.flush()
- summary = next(e for e in events if e["kind"] == "test_result" and e["details"].get("scope") == "summary")
- assert summary["details"]["outcome"] == "block"
- assert summary["details"]["algorithms_executed"] == 0
- assert summary["details"]["verdict_supported"] is False
- diag = DiagnosticConsole({"station_id":"S1","mode":"hardware","cpu_count":2,"channels_per_cpu":12},
- ConsoleDescriptionOnly(), tmp_path)
- diag.state["state"] = "online"
- for event in events:
- diag._parsed(event)
- wire = message(pb.DiagnosticSnapshot, diag.snapshot())
- restored = MessageToDict(wire, preserving_proto_field_name=True)
- summaries = [o for o in restored["observations"] if o.get("details",{}).get("scope") == "summary"]
- assert summaries
- assert summaries[-1]["details"]["algorithm_counts"] == {"0":0.0,"1":0.0}
- assert summaries[-1]["details"]["execution_blocked"] is True
|