Fix async telemetry coverage audit

This commit is contained in:
2026-07-14 22:23:43 +08:00
parent c5ab073af5
commit 3facb18bcf
2 changed files with 52 additions and 11 deletions

View File

@@ -81,6 +81,25 @@ def main() -> None:
assert summary["waiting_unresolved_count"] == 1
assert summary["waiting_count"] == 4
# A per-step stream may have a submit gap above one second when the
# preceding model execution itself spans that interval. Such a gap is
# covered telemetry, not a dropped-record interval.
asynchronous = [
{"submit_mono_ns": 0, "complete_mono_ns": 1_200_000_000},
{"submit_mono_ns": 1_100_000_000, "complete_mono_ns": 1_300_000_000},
]
coverage, covered = analysis.telemetry_coverage(
asynchronous, start_ns=0, end_ns=1_100_000_000
)
assert coverage["max_internal_submit_gap_s"] == 1.1
assert coverage["max_uncovered_gap_s"] == 0.0
assert covered
missing = copy.deepcopy(asynchronous)
missing[0]["complete_mono_ns"] = 0
assert not analysis.telemetry_coverage(
missing, start_ns=0, end_ns=1_100_000_000
)[1]
manifest = {
"repetitions": {str(index): {} for index in (1, 2, 3)},
"regimes": {