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
+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