SSE endpoint publishing quest-completed transitions (task 4d7bae00)
The panel needs live transitions, so add ONE in-process publisher (api/events.py, installed on app.state.publisher in the lifespan) and a GET /api/v1/panel/events SSE route on the panel router — it inherits the single require_panel_token check. The complete route now builds the event through the core builder and publishes it only when the core's .appended flag says an actual transition happened; a no-op re-complete publishes nothing. Tests stream from a real uvicorn instance on an ephemeral port because httpx's ASGITransport buffers endless SSE bodies.
This commit is contained in:
@@ -116,6 +116,10 @@ core_snapshot = importlib.import_module(f"{_CORE_MODULE_NAME}.snapshot")
|
||||
#: ``uncomplete_instance``) the panel's write routes call.
|
||||
core_completion = importlib.import_module(f"{_CORE_MODULE_NAME}.completion")
|
||||
|
||||
#: The transition-event builders (``core.events.build_quest_completed_event``
|
||||
#: et al.) the panel's write routes build their SSE events with.
|
||||
core_events = importlib.import_module(f"{_CORE_MODULE_NAME}.events")
|
||||
|
||||
#: The explicit settings object (``core.settings.NestQuestSettings``)
|
||||
#: the snapshot builder's ``settings`` parameter takes.
|
||||
core_settings = importlib.import_module(f"{_CORE_MODULE_NAME}.settings")
|
||||
@@ -124,6 +128,7 @@ __all__ = [
|
||||
"core",
|
||||
"core_completion",
|
||||
"core_db",
|
||||
"core_events",
|
||||
"core_migrations",
|
||||
"core_snapshot",
|
||||
"core_settings",
|
||||
|
||||
Reference in New Issue
Block a user