feat(lab): seal full RAVNOVES004TREE semantic review

This commit is contained in:
DCCONSTRUCTIONS
2026-08-29 13:37:57 +03:00
parent 24b65926fe
commit 9dec37a8a9
12 changed files with 1494 additions and 30 deletions
@@ -104,3 +104,20 @@ def test_e4_class_fractions_use_only_valid_fov_pixels() -> None:
assert {item["id"]: item["pixels"] for item in classes} == {1: 1, 4: 2, 7: 1}
assert sum(float(item["fraction_of_valid_fov"]) for item in classes) == 1.0
def test_e4_orchestrator_seals_a_single_decoder_gap_without_frame_shift() -> None:
path = (
Path(__file__).parents[1]
/ "experiments"
/ "perception"
/ "worker"
/ "Invoke-E4FullSessionSegmentation.ps1"
)
source = path.read_text(encoding="utf-8")
assert "-c:v h264_cuvid" in source
assert "-frame_pts 1" in source
assert '$decodedPath = Join-Path $decodedFramesRoot ("frame-{0}.png" -f $pts)' in source
assert "$repairs.Count -ge 1" in source
assert 'method = "duplicate-previous-decoded-frame"' in source
assert 'schema_version = "missioncore.recorded-video-decode-repair/v1"' in source
@@ -25,6 +25,12 @@ POWERSHELL_PATH = (
/ "worker"
/ "Invoke-LabV1VegetationGooseBenchmark.ps1"
)
RAV004_SOURCE_PATH = (
REPOSITORY_ROOT
/ "config"
/ "perception"
/ "lab-v1-ravnoves004tree-full-video-source-v1.json"
)
def test_benchmark_contract_is_bounded_and_fail_closed() -> None:
@@ -93,3 +99,21 @@ def test_worker_wrapper_is_isolated_from_canonical_triton() -> None:
assert '"--cap-drop", "ALL"' in source
assert '"--security-opt", "no-new-privileges"' in source
assert "if ($canonicalAfter -ne $canonicalBefore)" in source
def test_rav004_full_video_profile_and_decoder_gap_are_explicit() -> None:
profile = json.loads(RAV004_SOURCE_PATH.read_text(encoding="utf-8"))
source_profile = profile["source"]
assert profile["schema_version"] == "missioncore.lab-v1-ravnoves-source/v1"
assert source_profile["source_job_id"] == (
"recorded-camera-eb2783c5480d56bda07c8af0"
)
assert source_profile["expected_frame_count"] == 6830
assert source_profile["base_m4_result_id"] is None
source = POWERSHELL_PATH.read_text(encoding="utf-8")
assert "-c:v h264_cuvid" in source
assert 'schema_version = "missioncore.recorded-video-decode-repair/v1"' in source
assert 'method = "duplicate-previous-decoded-frame"' in source
assert "$repairs.Count -ge 1" in source
assert '& docker @arguments 2>&1 | ForEach-Object { Write-Output $_ }' in source
assert 'if ($dockerExitCode -ne 0)' in source
+61
View File
@@ -270,6 +270,67 @@ def test_vegetation_shadow_lab_seals_autonomous_visual_evidence(
assert mask.content == b"\x89PNG\r\n\x1a\n"
assert mask.headers["cache-control"].endswith("immutable")
full_archive_payloads = (b"\x89PNG\r\n\x1a\ncity", b"\x89PNG\r\n\x1a\nvegetation")
full_identity = dict(manifest["identity"])
full_route = {
"frame_count": 2,
"layers": {
layer: {"mask_archive": {"path": "video/full-route-masks.zip"}}
for layer in ("city", "vegetation")
},
}
full_identity["route_full_review"] = full_route
full_identity_sha = hashlib.sha256(
json.dumps(
full_identity,
ensure_ascii=False,
sort_keys=True,
separators=(",", ":"),
).encode("utf-8")
).hexdigest()
full_result_id = f"lab-v1-vegetation-shadow-{full_identity_sha}"
full_root = result_root.parent / full_result_id
shutil.copytree(result_root, full_root)
full_archive = full_root / "video" / "full-route-masks.zip"
full_archive.parent.mkdir(exist_ok=True)
with zipfile.ZipFile(full_archive, "x", compression=zipfile.ZIP_STORED) as frozen:
for sequence, payload in enumerate(full_archive_payloads, start=1):
frozen.writestr(f"masks/frame-{sequence:06d}.png", payload)
full_manifest = dict(manifest)
full_manifest["result_id"] = full_result_id
full_manifest["identity"] = full_identity
full_manifest["identity_sha256"] = full_identity_sha
full_manifest["route_full_review"] = full_route
full_manifest["artifacts"] = [
*manifest["artifacts"],
{
"role": "full-route-mask-fixture",
"path": "video/full-route-masks.zip",
"byte_length": full_archive.stat().st_size,
"sha256": _sha256(full_archive),
"media_type": "application/zip",
},
]
(full_root / "result.json").write_text(
json.dumps(full_manifest, ensure_ascii=False, sort_keys=True, separators=(",", ":"))
+ "\n",
encoding="utf-8",
)
for layer, sequence, expected in (
("city", 0, full_archive_payloads[0]),
("vegetation", 1, full_archive_payloads[1]),
):
response = client.get(
f"/api/v1/laboratory/vegetation-shadow/{full_result_id}"
f"/route-masks/{layer}/{sequence}"
)
assert response.status_code == 200
assert response.content == expected
assert response.headers["cache-control"].endswith("immutable")
assert client.get(
f"/api/v1/laboratory/vegetation-shadow/{full_result_id}/route-masks/city/2"
).status_code == 404
(result_root / asset_path).write_bytes(b"tampered")
assert (
client.get(f"/api/v1/laboratory/vegetation-shadow/{result_root.name}").status_code