Files
romm/backend/handler
Georges-Antoine Assi b5acfa4c44 refactor(streaming): type the session record as a StreamingSession TypedDict (#5395)
* refactor(streaming): type the session record as a StreamingSession TypedDict

The streaming session lived in the cache as a JSON object and moved
through the code as dict[str, Any], so its 18 keys were implied by the
two claim literals and a handful of mutate_session calls spread across
session_store, lifecycle, access, launch, memory_cards and the
endpoint. A misspelt key read as None without a warning.

StreamingSession (total=False, since drain markers and records from
older releases carry only some fields) now names every key and its type,
and every session and claim parameter, return and literal uses it. mypy
checks each .get() and write against it. The scope helpers that also
read a termination notice take a Mapping[str, object] instead.

No behaviour changes: the record's JSON is the same. Tests that built
sessions by hand now build StreamingSessions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(streaming): one-sentence StreamingSession docstring

Addresses Greptile's review on the comment rule.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-29 14:40:02 -04:00
..