feat(perception): integrate calibrated operator pipeline
Add calibrated K1 projection, recorded and near-live perception qualification, unified Rerun operator layers, bounded replay admission, audited viewer controls, worker experiments, and lab evidence.
This commit is contained in:
@@ -16,6 +16,8 @@ import k1link.sessions.recording as recording_module
|
||||
from k1link.sessions.models import ReplayArtifact, ReplayCommand
|
||||
from k1link.sessions.recording import (
|
||||
CACHE_SCHEMA,
|
||||
RECORDING_CACHE_FILENAME,
|
||||
RECORDING_CACHE_SIDECAR_FILENAME,
|
||||
RERUN_RECORDING_MEDIA_TYPE,
|
||||
RecordingMaterializationError,
|
||||
SessionRecordingMaterializer,
|
||||
@@ -113,7 +115,7 @@ def test_materializer_reuses_only_a_digest_validated_private_cache(tmp_path: Pat
|
||||
assert first.timeline_end_ns == 2_500_000_000
|
||||
assert first.path.is_relative_to(materializer.recordings_root)
|
||||
assert first.path.stat().st_mode & 0o777 == 0o600
|
||||
sidecar = first.path.with_name("scene.rrd.cache.json")
|
||||
sidecar = first.path.with_name(RECORDING_CACHE_SIDECAR_FILENAME)
|
||||
assert sidecar.stat().st_mode & 0o777 == 0o600
|
||||
document = json.loads(sidecar.read_text(encoding="utf-8"))
|
||||
assert document["schema_version"] == CACHE_SCHEMA
|
||||
@@ -129,6 +131,20 @@ def test_materializer_reuses_only_a_digest_validated_private_cache(tmp_path: Pat
|
||||
assert exporter.calls == 1
|
||||
|
||||
|
||||
def test_default_recording_cache_has_no_application_byte_quota(
|
||||
tmp_path: Path,
|
||||
monkeypatch: pytest.MonkeyPatch,
|
||||
) -> None:
|
||||
monkeypatch.delenv("MISSIONCORE_RRD_CACHE_MAX_BYTES", raising=False)
|
||||
|
||||
materializer = SessionRecordingMaterializer(
|
||||
tmp_path / "private",
|
||||
exporter=FakeExporter(),
|
||||
)
|
||||
|
||||
assert materializer.cache_max_bytes is None
|
||||
|
||||
|
||||
def test_delete_cached_refuses_a_live_lease_then_removes_the_exact_cache(
|
||||
tmp_path: Path,
|
||||
) -> None:
|
||||
@@ -199,7 +215,7 @@ def test_materializer_rebuilds_incompatible_recording_cache_schema(
|
||||
exporter = FakeExporter()
|
||||
private_root = tmp_path / "private"
|
||||
first = SessionRecordingMaterializer(private_root, exporter=exporter).materialize(command)
|
||||
sidecar = first.path.with_name("scene.rrd.cache.json")
|
||||
sidecar = first.path.with_name(RECORDING_CACHE_SIDECAR_FILENAME)
|
||||
document = json.loads(sidecar.read_text(encoding="utf-8"))
|
||||
document["schema_version"] = obsolete_schema
|
||||
sidecar.write_text(json.dumps(document), encoding="utf-8")
|
||||
@@ -217,7 +233,7 @@ def test_failed_rebuild_preserves_previously_published_cache(tmp_path: Path) ->
|
||||
materializer = SessionRecordingMaterializer(tmp_path / "private", exporter=exporter)
|
||||
first = materializer.materialize(command)
|
||||
published_bytes = first.path.read_bytes()
|
||||
sidecar = first.path.with_name("scene.rrd.cache.json")
|
||||
sidecar = first.path.with_name(RECORDING_CACHE_SIDECAR_FILENAME)
|
||||
published_sidecar = sidecar.read_bytes()
|
||||
command.primary_artifact.path.write_bytes(b"new-source-that-requires-rebuild")
|
||||
changed = _replace_primary(
|
||||
@@ -300,9 +316,9 @@ def test_materializer_never_follows_cache_symlinks_outside_private_root(
|
||||
assert list(outside.iterdir()) == []
|
||||
session_cache.unlink()
|
||||
session_cache.mkdir()
|
||||
outside_recording = outside / "scene.rrd"
|
||||
outside_recording = outside / RECORDING_CACHE_FILENAME
|
||||
outside_recording.write_bytes(b"do-not-touch")
|
||||
(session_cache / "scene.rrd").symlink_to(outside_recording)
|
||||
(session_cache / RECORDING_CACHE_FILENAME).symlink_to(outside_recording)
|
||||
|
||||
recording = materializer.materialize(command)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user