fix(replay): serve admitted AI overlays without revalidation

This commit is contained in:
DCCONSTRUCTIONS
2026-07-29 23:13:42 +03:00
parent 8e4891d608
commit cc6838ed24
10 changed files with 990 additions and 173 deletions
+72
View File
@@ -130,6 +130,23 @@ class RecordedPerceptionRequest(StrictApiModel):
)
class RecordedPerceptionPreparationStatus(StrictApiModel):
state: Literal["idle", "preparing", "ready", "unavailable", "error"]
phase: Literal[
"idle",
"cache-lookup",
"queued",
"artifact-validation",
"rendering",
"cache-write",
"ready",
"unavailable",
"error",
]
elapsed_seconds: float = Field(ge=0.0)
byte_length: int | None = Field(default=None, ge=0)
class RecordedPointColorsRequest(StrictApiModel):
application_id: Literal["nodedc_mission_core_recorded"]
recording_id: str = Field(
@@ -915,6 +932,61 @@ def build_session_router(
},
)
@router.get("/api/v1/observation-sessions/{session_id}/perception/status")
async def get_observation_session_perception_status(
session_id: str,
response: Response,
recording_id: Annotated[
str,
Query(
min_length=1,
max_length=128,
pattern=r"^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$",
),
],
) -> dict[str, Any]:
try:
await run_in_threadpool(
_prepare_replay,
store,
catalog_refresher,
session_id,
1.0,
False,
False,
)
except SessionNotFoundError as exc:
raise HTTPException(status_code=404, detail=str(exc)) from exc
except (SessionNotReplayableError, SessionIntegrityError) as exc:
raise HTTPException(status_code=409, detail=str(exc)) from exc
status_provider = (
getattr(perception_overlay_provider, "status", None)
if perception_overlay_provider is not None
else None
)
value: object = (
await run_in_threadpool(
status_provider,
session_id,
recording_id=recording_id,
)
if callable(status_provider)
else {
"state": "idle",
"phase": "idle",
"elapsed_seconds": 0.0,
"byte_length": None,
}
)
response.headers["Cache-Control"] = "no-store"
try:
return RecordedPerceptionPreparationStatus.model_validate(value).model_dump()
except ValueError as exc:
raise HTTPException(
status_code=500,
detail="Сервис слоя распознавания вернул некорректный статус.",
) from exc
@router.post("/api/v1/observation-sessions/{session_id}/point-colors.rrd")
async def get_observation_session_point_colors(
session_id: str,