fix(archive): preserve prepared sessions across restarts

This commit is contained in:
DCCONSTRUCTIONS
2026-07-18 11:08:27 +03:00
parent aa3680948f
commit 574a494759
13 changed files with 398 additions and 132 deletions
+33
View File
@@ -574,6 +574,39 @@ def test_cold_replay_returns_quick_202_then_status_returns_ready_launch(
manager.close()
def test_catalog_read_never_prepares_a_cold_historical_session(tmp_path: Path) -> None:
repository = tmp_path / "repo"
sessions = repository / "sessions"
session = make_legacy_session(sessions, "20260716T205632Z_viewer_live")
store = SessionStore(repository, data_dir=tmp_path / "data")
store.reconcile_archive(xgrids_k1_archive_source(sessions))
calls = 0
def exporter(_source: Path, _destination: Path) -> dict[str, object]:
nonlocal calls
calls += 1
raise AssertionError("catalog reads must not invoke the exporter")
materializer = SessionRecordingMaterializer(store.data_dir, exporter=exporter)
manager = SessionRecordingPreparationManager(materializer)
router = build_session_router(
store,
recording_materializer=materializer,
recording_preparation_manager=manager,
)
list_route = endpoint(router, "/api/v1/observation-sessions", "GET")
try:
item = list_route(limit=20, cursor=None)["items"][0]
time.sleep(0.02)
assert item["id"] == session.name
assert item["preparation"] is None
assert manager.status(session.name) is None
assert calls == 0
finally:
manager.close()
def test_recording_response_releases_pin_once_when_asgi_send_fails(
tmp_path: Path,
) -> None: