feat: wire physical K1 surface shadow
This commit is contained in:
@@ -84,6 +84,138 @@ def test_e15_profile_rejects_command_authority(tmp_path: Path) -> None:
|
||||
module.read_live_profile(changed)
|
||||
|
||||
|
||||
def test_e28_profile_pins_physical_k1_local_surface_gate() -> None:
|
||||
module = _module()
|
||||
profile_path = (
|
||||
Path(__file__).resolve().parents[1]
|
||||
/ "experiments"
|
||||
/ "perception"
|
||||
/ "worker"
|
||||
/ "e28_physical_k1_local_surface_profile.json"
|
||||
)
|
||||
|
||||
profile, digest = module.read_live_profile(profile_path)
|
||||
|
||||
assert len(digest) == 64
|
||||
assert profile["mode"] == "physical-shadow-gate"
|
||||
assert profile["local_surface"] == {
|
||||
"enabled": True,
|
||||
"profile_id": "k1-vendor-map-dynamic-local-surface/v1",
|
||||
"profile_sha256": (
|
||||
"7a59edc8404d0177a39175578743589bfb6b7822837170cded38ca2b6698cc26"
|
||||
),
|
||||
"point_queue_capacity": 2,
|
||||
"pose_buffer_capacity": 16,
|
||||
"future_pose_wait_ms": 25.0,
|
||||
"retention_seconds": 3.0,
|
||||
"result_capacity": 8,
|
||||
"acceptance": {
|
||||
"minimum_bound_frames": 100,
|
||||
"maximum_pose_miss_fraction": 0.05,
|
||||
"maximum_point_drop_fraction": 0.01,
|
||||
"maximum_runtime_drop_fraction": 0.01,
|
||||
"maximum_p95_result_age_ms": 80.0,
|
||||
},
|
||||
}
|
||||
assert profile["authority"] == {
|
||||
"commands_enabled": False,
|
||||
"navigation_or_safety_accepted": False,
|
||||
}
|
||||
|
||||
|
||||
def test_e28_profile_rejects_unpinned_local_surface(tmp_path: Path) -> None:
|
||||
module = _module()
|
||||
source = (
|
||||
Path(__file__).resolve().parents[1]
|
||||
/ "experiments"
|
||||
/ "perception"
|
||||
/ "worker"
|
||||
/ "e28_physical_k1_local_surface_profile.json"
|
||||
)
|
||||
value = json.loads(source.read_text())
|
||||
value["local_surface"]["profile_sha256"] = "0" * 64
|
||||
changed = tmp_path / "unpinned-local-surface.json"
|
||||
changed.write_text(json.dumps(value))
|
||||
|
||||
with pytest.raises(RuntimeError, match="E28 physical local-surface"):
|
||||
module.read_live_profile(changed)
|
||||
|
||||
|
||||
def test_e28_local_surface_acceptance_requires_exact_bounded_accounting() -> None:
|
||||
module = _module()
|
||||
config = {
|
||||
"profile_id": "k1-vendor-map-dynamic-local-surface/v1",
|
||||
"point_queue_capacity": 2,
|
||||
"pose_buffer_capacity": 16,
|
||||
"acceptance": {
|
||||
"minimum_bound_frames": 100,
|
||||
"maximum_pose_miss_fraction": 0.05,
|
||||
"maximum_point_drop_fraction": 0.01,
|
||||
"maximum_runtime_drop_fraction": 0.01,
|
||||
"maximum_p95_result_age_ms": 80.0,
|
||||
},
|
||||
}
|
||||
authority = {
|
||||
"commands_enabled": False,
|
||||
"navigation_or_safety_accepted": False,
|
||||
}
|
||||
snapshot = {
|
||||
"closed": True,
|
||||
"authority": authority,
|
||||
"binder": {
|
||||
"points": {
|
||||
"capacity": 2,
|
||||
"depth": 0,
|
||||
"maximum_depth": 2,
|
||||
"published": 102,
|
||||
"bound": 100,
|
||||
"missed": 1,
|
||||
"dropped_overflow": 1,
|
||||
},
|
||||
"poses": {
|
||||
"capacity": 16,
|
||||
"maximum_depth": 12,
|
||||
},
|
||||
},
|
||||
"runtime": {
|
||||
"closed": True,
|
||||
"profile": {
|
||||
"profile_id": "k1-vendor-map-dynamic-local-surface/v1",
|
||||
},
|
||||
"queue": {
|
||||
"capacity": 2,
|
||||
"depth": 0,
|
||||
"maximum_depth": 2,
|
||||
"published": 100,
|
||||
"consumed": 100,
|
||||
"dropped_overflow": 0,
|
||||
},
|
||||
"results": {
|
||||
"published": 100,
|
||||
"failed": 0,
|
||||
"result_age_ms": {"p95": 40.0},
|
||||
},
|
||||
"occupancy_policy": {
|
||||
"absence_of_points_means_free": False,
|
||||
"unknown_is_traversable": False,
|
||||
},
|
||||
"authority": authority,
|
||||
},
|
||||
}
|
||||
|
||||
checks = module._local_surface_acceptance_checks(snapshot, config)
|
||||
|
||||
assert checks
|
||||
assert all(checks.values())
|
||||
snapshot["runtime"]["results"]["result_age_ms"]["p95"] = 90.0
|
||||
assert (
|
||||
module._local_surface_acceptance_checks(snapshot, config)[
|
||||
"local_surface_maximum_p95_result_age_ms"
|
||||
]
|
||||
is False
|
||||
)
|
||||
|
||||
|
||||
def test_persistent_worker_request_is_single_run_d_backed_and_token_bounded(
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
|
||||
Reference in New Issue
Block a user