feat(archive): complete recorded session lifecycle

This commit is contained in:
DCCONSTRUCTIONS
2026-07-19 01:07:21 +03:00
parent ffffee1879
commit 71c85e9894
22 changed files with 922 additions and 144 deletions
+35
View File
@@ -433,3 +433,38 @@ def test_launch_reservation_blocks_eviction_until_lease_expires(tmp_path: Path)
assert not first_recording.path.exists()
finally:
manager.close()
def test_first_recording_get_pin_consumes_launch_reservation(tmp_path: Path) -> None:
command = _command(tmp_path / "session")
def exporter(source: Path, destination: Path) -> dict[str, object]:
return _summary(source, destination, b"recording")
materializer = SessionRecordingMaterializer(
tmp_path / "private",
exporter=exporter,
free_space_reserve_bytes=0,
)
manager = SessionRecordingPreparationManager(materializer)
try:
materializer.materialize(command)
resolved = manager.resolve_cached(command)
assert resolved is not None and resolved.state == "ready"
reserved = manager.reserve_cached(command, lease_seconds=60.0)
assert reserved is not None
pinned = manager.pin_ready(
command.session_id,
preparation_id=reserved.preparation_id,
)
assert pinned is not None
_, release_response = pinned
assert manager.release_launch_reservation(command.session_id) is False
assert materializer.delete_cached(command.session_id) is False
release_response()
assert materializer.delete_cached(command.session_id) is True
finally:
manager.close()