fix(runtime): fail closed on offline artifact misses
This commit is contained in:
@@ -19,12 +19,14 @@ from k1link.artifact_gateway import (
|
||||
ArtifactGateway,
|
||||
ArtifactManifest,
|
||||
ArtifactMember,
|
||||
ArtifactStoreUnavailable,
|
||||
ResolvedArtifact,
|
||||
)
|
||||
from k1link.compute.integrated_perception import (
|
||||
IntegratedPerceptionOverlayStore,
|
||||
_CuboidPresentationState,
|
||||
)
|
||||
from k1link.compute.results import RecordedPerceptionOverlayError
|
||||
|
||||
|
||||
def _write_result_descriptor(
|
||||
@@ -303,6 +305,54 @@ def test_integrated_overlay_uses_verified_central_cache_before_local_result_scan
|
||||
assert artifact.sha256 == member.sha256
|
||||
|
||||
|
||||
def test_integrated_overlay_does_not_render_when_central_store_is_offline(
|
||||
tmp_path: Path,
|
||||
monkeypatch: pytest.MonkeyPatch,
|
||||
) -> None:
|
||||
for name in ("jobs", "results", "lidar-packs"):
|
||||
(tmp_path / name).mkdir()
|
||||
|
||||
class OfflineGateway:
|
||||
def resolve_role(
|
||||
self,
|
||||
namespace: str,
|
||||
key: str,
|
||||
role: str,
|
||||
) -> object:
|
||||
assert (namespace, key, role) == (
|
||||
"sessions",
|
||||
"session-1",
|
||||
"integrated-overlay:recording-1",
|
||||
)
|
||||
raise ArtifactStoreUnavailable("offline cache miss")
|
||||
|
||||
store = IntegratedPerceptionOverlayStore(
|
||||
jobs_root=tmp_path / "jobs",
|
||||
results_root=tmp_path / "results",
|
||||
lidar_packs_root=tmp_path / "lidar-packs",
|
||||
cache_root=tmp_path / "cache",
|
||||
ffmpeg_path=tmp_path / "ffmpeg",
|
||||
artifact_gateway=OfflineGateway(), # type: ignore[arg-type]
|
||||
)
|
||||
monkeypatch.setattr(
|
||||
store,
|
||||
"_latest",
|
||||
lambda _session_id: (_ for _ in ()).throw(
|
||||
AssertionError("offline CAS miss must not scan local results")
|
||||
),
|
||||
)
|
||||
|
||||
with pytest.raises(
|
||||
RecordedPerceptionOverlayError,
|
||||
match="not present in the local artifact cache",
|
||||
):
|
||||
store.materialize(
|
||||
"session-1",
|
||||
application_id="nodedc_mission_core_recorded",
|
||||
recording_id="recording-1",
|
||||
)
|
||||
|
||||
|
||||
def test_e10_profile_pins_integrated_realtime_budget() -> None:
|
||||
_fusion, runner = _worker_modules()
|
||||
profile_path = (
|
||||
|
||||
Reference in New Issue
Block a user