chore(storage): bound build retention, caches and test resources

Track build ownership, qualified pins and bounded cache/log lifecycles. Move Vite fixtures to a job-owned server helper and preserve private outputs outside Git.
This commit is contained in:
DCCONSTRUCTIONS
2026-10-29 09:09:58 +03:00
parent 55f64f195b
commit 70ef3f9f1c
119 changed files with 3128 additions and 331 deletions
@@ -32,6 +32,8 @@ import rerun as rr
import rerun_bindings as bindings
from PIL import Image
from k1link.cache_budget import cache_publication, require_cache_room
APPLICATION_ID: Final = "nodedc_mission_core_recorded"
SESSION_TIMELINE: Final = "session_time"
RENDERER_VERSION: Final = "upstream-rerun-0.36.3-encoded-optimized-v6"
@@ -223,6 +225,12 @@ def canonical_lab_overlay(
_memory_cache[key] = restored
return restored
require_cache_room(
cache,
MAX_OVERLAY_BYTES,
kind="laboratory-rerun-overlays",
error_type=CanonicalLabOverlayError,
)
temporary = cache / f".{identity}.{uuid4().hex}.rrd"
proxy: Path | None = None
source: Path | None = None
@@ -237,20 +245,23 @@ def canonical_lab_overlay(
raise CanonicalLabOverlayError("canonical LAB overlay size is invalid")
digest = _sha256(temporary)
os.chmod(temporary, 0o600)
os.replace(temporary, output)
_write_json_atomic(
sidecar,
{
"schema_version": "missioncore.canonical-lab-rerun-overlay/v1",
"renderer_version": RENDERER_VERSION,
"result_id": result_id,
"result_sha256": result_sha256,
"recording_id": recording_id,
"base_generation_sha256": base_generation_sha256,
"byte_length": stat.st_size,
"sha256": digest,
},
)
with cache_publication(
cache, 65536, kind="laboratory-rerun-overlays", error_type=CanonicalLabOverlayError
):
os.replace(temporary, output)
_write_json_atomic(
sidecar,
{
"schema_version": "missioncore.canonical-lab-rerun-overlay/v1",
"renderer_version": RENDERER_VERSION,
"result_id": result_id,
"result_sha256": result_sha256,
"recording_id": recording_id,
"base_generation_sha256": base_generation_sha256,
"byte_length": stat.st_size,
"sha256": digest,
},
)
artifact = CanonicalLabOverlayArtifact(output, stat.st_size, digest)
_memory_cache[key] = artifact
return artifact
@@ -327,6 +338,12 @@ def canonical_lab_replay(
_replay_memory_cache[key] = restored
return restored
require_cache_room(
cache,
MAX_REPLAY_BYTES,
kind="laboratory-rerun-overlays",
error_type=CanonicalLabOverlayError,
)
temporary = cache / f".{identity}.{uuid4().hex}.replay.rrd"
try:
completed = subprocess.run(
@@ -371,20 +388,23 @@ def canonical_lab_replay(
stat = temporary.stat()
digest = _sha256(temporary)
os.chmod(temporary, 0o600)
os.replace(temporary, output)
_write_json_atomic(
sidecar,
{
"schema_version": "missioncore.canonical-lab-rerun-replay/v1",
"renderer_version": REPLAY_RENDERER_VERSION,
"result_id": result_id,
"recording_id": recording_id,
"base_generation_sha256": base_generation_sha256,
"overlay_sha256": overlay.sha256,
"byte_length": stat.st_size,
"sha256": digest,
},
)
with cache_publication(
cache, 65536, kind="laboratory-rerun-overlays", error_type=CanonicalLabOverlayError
):
os.replace(temporary, output)
_write_json_atomic(
sidecar,
{
"schema_version": "missioncore.canonical-lab-rerun-replay/v1",
"renderer_version": REPLAY_RENDERER_VERSION,
"result_id": result_id,
"recording_id": recording_id,
"base_generation_sha256": base_generation_sha256,
"overlay_sha256": overlay.sha256,
"byte_length": stat.st_size,
"sha256": digest,
},
)
artifact = CanonicalLabReplayArtifact(output, stat.st_size, digest)
_replay_memory_cache[key] = artifact
return artifact