feat(perception): seal detector replay evidence

This commit is contained in:
DCCONSTRUCTIONS
2026-08-05 14:36:55 +03:00
parent a680debfaf
commit 95ac235122
12 changed files with 1754 additions and 31 deletions
+87 -25
View File
@@ -30,6 +30,9 @@ BASELINE_SOURCE_PACK_ID: Final = (
BASELINE_SOURCE_PACK_SHA256: Final = (
"0685d24219d8236caf8b7f1685e93f6d6b59e7fd015a768d88a92bbe8b154944"
)
BASELINE_PREPROCESS_PROFILE_SHA256: Final = (
"19c17dbc23f2b1c539eb6b8214e69fa487ea3fec8db9d88768dffc714895fb88"
)
_SHA256 = re.compile(r"^[a-f0-9]{64}$")
_EXPECTED_EVIDENCE_ROLES: Final = {
@@ -72,6 +75,60 @@ _SOURCE_KEYS: Final = {
"source_pack_id",
"source_pack_artifact_sha256",
}
_EXPECTED_CALIBRATION: Final[dict[str, object]] = {
"slot": "camera_1",
"model": "KB4",
"sha256": "05f3ad9b38b3a4fc95388a8ec83da83c745e217709e51787b3d5aad0969f6fa9",
"valid_fov_result_id": (
"valid-fov-mask-b4dd8ddf2b87c1d520ee8a0868c4fea062d7c14d1bae73ccabd3abe1f3acbac2"
),
"valid_fov_mask_sha256": (
"a40cee06b7c6f69b6a09a11563dcfd237f3de833b1ccd31459e66692e528ba63"
),
}
_EXPECTED_DETECTOR: Final[dict[str, object]] = {
"provider_id": "triton-yolox-s-raw-kb4/v1",
"model_id": "yolox_s",
"model_version": 1,
"model_sha256": "c5c2d13e59ae883e6af3b45daea64af4833a4951c92d116ec270d9ddbe998063",
"config_sha256": "5795c737a7935a655961b069e8404d336d891f9762fb6dffb93956a076479604",
"preprocess_profile_sha256": BASELINE_PREPROCESS_PROFILE_SHA256,
"minimum_score": 0.5,
"nms_iou_threshold": 0.45,
"runtime": "NVIDIA Triton 2.70.0 ONNX Runtime GPU backend",
}
_EXPECTED_NON_GOALS: Final = (
"semantic-class-quality",
"persistent-reidentification",
"physical-live-k1",
"physical-threat-authority",
"navigation-or-command-authority",
"second-source-transfer",
"second-worker-bootstrap",
"ros2-nav2-px4-gazebo-integration",
"deepstream-migration",
)
_EXPECTED_ROLLBACK: Final[dict[str, object]] = {
"worker_id": "worker-006",
"worker_node": "DESKTOP-OPJ8J04",
"container_name": "ndc-mission-core-perception-worker",
"container_image": (
"nvcr.io/nvidia/tritonserver:26.06-py3@"
"sha256:58df7489c3f2276f9591d500a012dee03e23d35543ce3c390b4c001e6bf90794"
),
"worker_package_id": (
"e15-worker-package-dbf55ccb75664b778a2e0f5d34284af10ec0971945bbbee67b27bc264b765b51"
),
"runner_sha256": "86e9b25c80908a520ed483541b708cde1d1c74605e094053fcb62b610ecefb20",
"orchestrator_sha256": (
"82de50ae83debe26fc5463799b1e1e15217a8db8cc090671ba2993200b8ed95c"
),
"entrypoint": "python3 /runner/run_e15_shadow_inference.py serve",
"observed_container_id": (
"db2024d05098a6beb6b73bbf43f02c88ede586a4664b2c91182f436a42b3e3ff"
),
"observed_at_utc": "2026-08-05T10:30:00Z",
}
class BaselineContractError(ValueError):
@@ -129,25 +186,37 @@ def load_m4_baseline(path: Path) -> BaselineProfile:
raise BaselineContractError("M4 source pack artifact identity changed")
if source.get("camera_stream_sha256") != BASELINE_CAMERA_STREAM_SHA256:
raise BaselineContractError("M4 camera stream identity changed")
modalities = _string_array(source.get("modalities"), "source modalities")
if set(modalities) != {"image", "registered-point-increment", "pose"}:
raise BaselineContractError("baseline source must bind image, points and pose")
if _integer(source.get("frame_count"), "source frame count") != 4489:
if source.get("frame_count") != 4489:
raise BaselineContractError("baseline source frame count changed")
if source.get("duration_seconds") != 448.723:
raise BaselineContractError("baseline source duration changed")
if source.get("frame_rate") != 10.003944527024467:
raise BaselineContractError("baseline source frame rate changed")
modalities = _string_array(source.get("modalities"), "source modalities")
if modalities != ("image", "registered-point-increment", "pose"):
raise BaselineContractError("baseline source must bind image, points and pose")
calibration = _object(document.get("calibration"), "calibration")
if calibration != _EXPECTED_CALIBRATION:
raise BaselineContractError("baseline calibration identity changed")
detector = _object(document.get("detector"), "detector")
if detector != _EXPECTED_DETECTOR:
raise BaselineContractError("baseline detector identity changed")
authority = _object(document.get("authority"), "authority")
if authority.get("mode") != "replay-simulated":
raise BaselineContractError("M4 authority must remain replay-simulated")
for key in (
"ground_truth",
"physical_live",
"physical_collision_accepted",
"commands_enabled",
"actuation_allowed",
"navigation_or_safety_accepted",
):
if authority.get(key) is not False:
raise BaselineContractError(f"baseline authority {key} must remain false")
if authority != {
"mode": "replay-simulated",
"ground_truth": False,
"physical_live": False,
"physical_collision_accepted": False,
"commands_enabled": False,
"actuation_allowed": False,
"navigation_or_safety_accepted": False,
}:
raise BaselineContractError("M4 authority must remain replay-simulated and false")
if _string_array(document.get("non_goals"), "non-goals") != _EXPECTED_NON_GOALS:
raise BaselineContractError("baseline non-goals changed")
evidence_items = document.get("evidence")
if not isinstance(evidence_items, list):
@@ -161,15 +230,8 @@ def load_m4_baseline(path: Path) -> BaselineProfile:
raise BaselineContractError("baseline evidence paths must be unique")
rollback = _object(document.get("rollback"), "rollback")
if rollback.get("worker_id") != "worker-006":
raise BaselineContractError("rollback worker identity changed")
if rollback.get("worker_node") != "DESKTOP-OPJ8J04":
raise BaselineContractError("rollback worker node changed")
entrypoint = rollback.get("entrypoint")
if not isinstance(entrypoint, str) or "run_e15_shadow_inference.py serve" not in entrypoint:
raise BaselineContractError("rollback E15 process identity is missing")
_digest(rollback.get("runner_sha256"), "rollback runner digest")
_digest(rollback.get("orchestrator_sha256"), "rollback orchestrator digest")
if rollback != _EXPECTED_ROLLBACK:
raise BaselineContractError("rollback E15 identity changed")
return BaselineProfile(path=path, document=document, evidence=evidence)