from __future__ import annotations from pathlib import Path from k1link.perception.geometry_replay import read_geometry_replay_result REPOSITORY_ROOT = Path(__file__).resolve().parents[1] RESULT_ROOT = ( REPOSITORY_ROOT / ".runtime/perception-m4/geometry-results" / "m4-geometry-replay-8daf3109e3cf30b960b4b376032ff3b5ec58ca42a1e5899b841cf29fbcf14ad8" ) def test_full_source_geometry_result_closes_m4_4_contract() -> None: result = read_geometry_replay_result(RESULT_ROOT) assert result.accepted is True assert result.metrics["frames"] == { "failed": 0, "source_available": 3928, "source_unavailable": 561, "total": 4489, } proposals = result.metrics["proposals"] assert isinstance(proposals, dict) assert proposals["total"] == 15499 assert proposals["with_range"] == 5341 assert proposals["eligible_for_range"] == 13298 assert proposals["ownership_collision"] == 146 assert result.metrics["geometry_only_observations"] == 21958 assert result.metrics["published_source_point_rows"] == 2164767 def test_geometry_result_binds_the_accepted_m4_3_e32_and_e53_evidence() -> None: result = read_geometry_replay_result(RESULT_ROOT) identity = result.manifest["identity"] assert isinstance(identity, dict) assert identity["detector_result_id"] == ( "m4-detector-replay-" "11f83f2e0b81758ac2a5a5fc54e9d293b501678df5f6ef97b5c6069ba08605c5" ) assert identity["geometry_profile_sha256"] == ( "420d989aab5918e0f98e3439cadb8b7251332d51b48f4f2c25d77a385bea49f8" ) assert identity["historical_references"] == { "e32": { "manifest_sha256": ( "f4b57c9f7619c43414adf1d10488b05df466226a523a0c001671102ced0e9ab8" ), "result_id": ( "e32-track-geometry-" "a14ca0e7fb3850ca0dfa3c41634e1b490a2d58ab74d101afc6d6921fbdb0e6fd" ), }, "e53": { "manifest_sha256": ( "fc5b4ae69aae0098b7075c539d25b563dff1bbb09209a49030edda6cba9ee544" ), "result_id": ( "e53-camera-first-shadow-" "e6f03cf8bfb15db86100239b060e13f914532618b7b99e811866e4e6a555186c" ), }, }