feat(perception): qualify 1x realtime replay envelope

This commit is contained in:
DCCONSTRUCTIONS
2026-07-23 19:01:12 +03:00
parent ae2ce055c8
commit f1f8e21b78
13 changed files with 1425 additions and 141 deletions
+39
View File
@@ -1,6 +1,7 @@
from __future__ import annotations
import importlib.util
import io
import json
import sys
from argparse import Namespace
@@ -92,6 +93,7 @@ def test_persistent_worker_request_is_single_run_d_backed_and_token_bounded(
listen_host="127.0.0.1",
listen_port=18020,
command="serve",
max_duration_seconds=180.0,
marker="preserved",
)
@@ -101,6 +103,7 @@ def test_persistent_worker_request_is_single_run_d_backed_and_token_bounded(
"request_id": "physical-k1-shadow-001",
"output_name": "physical-k1-shadow-001",
"token": "a" * 64,
"max_duration_seconds": 90,
},
)
@@ -108,6 +111,7 @@ def test_persistent_worker_request_is_single_run_d_backed_and_token_bounded(
assert run.output == tmp_path / "physical-k1-shadow-001"
assert run.token == "a" * 64
assert run.token_stdin is False
assert run.max_duration_seconds == 90.0
assert run.marker == "preserved"
assert not hasattr(run, "listen_host")
assert not hasattr(run, "output_root")
@@ -121,6 +125,16 @@ def test_persistent_worker_request_is_single_run_d_backed_and_token_bounded(
"token": "short",
},
)
with pytest.raises(RuntimeError, match="request contract"):
module._persistent_run_arguments(
service,
{
"request_id": "physical-k1-shadow-004",
"output_name": "physical-k1-shadow-004",
"token": "b" * 64,
"max_duration_seconds": 181,
},
)
with pytest.raises(RuntimeError, match="request contract"):
module._persistent_run_arguments(
service,
@@ -130,3 +144,28 @@ def test_persistent_worker_request_is_single_run_d_backed_and_token_bounded(
"token": "b" * 64,
},
)
def test_runtime_telemetry_captures_bounded_queue_snapshots() -> None:
module = _module()
stream = io.StringIO()
telemetry = module._RuntimeTelemetry(
stream,
interval_seconds=1.0,
snapshotters={
"detector": lambda: {
"capacity": 2,
"maximum_depth": 1,
"final_depth": 0,
}
},
)
telemetry._sample()
summary = telemetry.summary()
assert summary["sample_count"] == 1
assert summary["final_queues"]["detector"]["capacity"] == 2
row = json.loads(stream.getvalue())
assert row["schema_version"] == "missioncore.worker-runtime-telemetry/v1"
assert row["queues"]["detector"]["maximum_depth"] == 1