fix(lab): restore canonical vegetation evidence layers
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import os
|
||||
from pathlib import Path, PurePosixPath
|
||||
from types import SimpleNamespace
|
||||
|
||||
@@ -151,6 +152,72 @@ def test_advanced_index_projects_one_most_mature_lifecycle_phase(tmp_path: Path)
|
||||
]
|
||||
|
||||
|
||||
def test_advanced_index_skips_noncanonical_vegetation_viewers(tmp_path: Path) -> None:
|
||||
root = tmp_path / "vegetation"
|
||||
|
||||
def publish(digest: str, *, canonical: bool) -> Path:
|
||||
result_id = f"lab-v1-vegetation-shadow-{digest}"
|
||||
candidate = root / result_id
|
||||
candidate.mkdir(parents=True)
|
||||
route_video = {
|
||||
"view_kind": "coarse-material-policy-review",
|
||||
"base_m4_result_id": f"m4-threat-replay-{'1' * 64}",
|
||||
"linked_tgs_result_id": f"m49-tgs-full-shadow-{'2' * 64}",
|
||||
"fusion": {
|
||||
"mode": "synchronised-multilayer-review",
|
||||
"pixel_raster_fusion": False,
|
||||
},
|
||||
} if canonical else None
|
||||
(candidate / "manifest.json").write_text(
|
||||
json.dumps(
|
||||
{
|
||||
"schema_version": "missioncore.lab-v1-vegetation-shadow/v1",
|
||||
"result_id": result_id,
|
||||
"identity_sha256": digest,
|
||||
"identity": {
|
||||
"authority": {
|
||||
"commands_enabled": False,
|
||||
"navigation_or_safety_accepted": False,
|
||||
}
|
||||
},
|
||||
"created_at_utc": "2026-08-29T10:00:00Z",
|
||||
"ground_truth": False,
|
||||
"route_video": route_video,
|
||||
"route_review": None,
|
||||
"route_full_review": None if canonical else {"frame_count": 6830},
|
||||
}
|
||||
),
|
||||
encoding="utf-8",
|
||||
)
|
||||
return candidate
|
||||
|
||||
canonical = publish("a" * 64, canonical=True)
|
||||
incomplete = publish("b" * 64, canonical=False)
|
||||
os.utime(canonical, ns=(10_000_000_000, 10_000_000_000))
|
||||
os.utime(incomplete, ns=(20_000_000_000, 20_000_000_000))
|
||||
registry = _evidence_registry(
|
||||
root,
|
||||
work_id="lab-v1-vegetation-shadow",
|
||||
result_id_prefix="lab-v1-vegetation-shadow",
|
||||
schema_version="missioncore.lab-v1-vegetation-shadow/v1",
|
||||
)
|
||||
router = build_advanced_laboratory_router(
|
||||
evidence_registry=registry,
|
||||
evidence_runtime_root_provider=lambda: root.parent,
|
||||
)
|
||||
|
||||
index = _endpoint(router, "/api/v1/laboratory/advanced-index")()
|
||||
|
||||
assert index["items"] == [ # type: ignore[index]
|
||||
{
|
||||
"work_id": "lab-v1-vegetation-shadow",
|
||||
"result_id": canonical.name,
|
||||
"created_at_utc": "2026-08-29T10:00:00Z",
|
||||
"access": "read-only",
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
def test_advanced_index_includes_valid_l31_identity(
|
||||
tmp_path: Path,
|
||||
monkeypatch: MonkeyPatch,
|
||||
|
||||
Reference in New Issue
Block a user