Part of #2400. Follow-up to #2368.
What
Cover the cross-container event path in osism/services/event_bridge.py. EventBridge.add_event() publishes JSON to the Redis osism:events channel (event_bridge.py:89); a second EventBridge subscribes in a background thread (_redis_subscriber_loop, :154) and forwards decoded events to its websocket manager. This mechanism is currently untested and depends only on Redis.
Scope
- A publisher
EventBridge.add_event(type, payload) results in the message arriving on the osism:events channel — assert via a raw redis.pubsub() subscriber, or a second EventBridge with a fake websocket manager that records _process_single_event.
- Round-trip payload integrity (event_type + payload survive JSON encode/decode).
publish to a channel with no subscribers is handled (logged warning, no crash).
Notes / Where
New file tests/integration/test_event_bridge.py. Use a fake/stub websocket manager (records calls) to avoid pulling in FastAPI here. Account for the background subscriber thread: poll with a timeout for the event to arrive, and tear down the bridge (_shutdown_event) at the end so threads do not leak between tests.
Part of #2400. Follow-up to #2368.
What
Cover the cross-container event path in
osism/services/event_bridge.py.EventBridge.add_event()publishes JSON to the Redisosism:eventschannel (event_bridge.py:89); a secondEventBridgesubscribes in a background thread (_redis_subscriber_loop,:154) and forwards decoded events to its websocket manager. This mechanism is currently untested and depends only on Redis.Scope
EventBridge.add_event(type, payload)results in the message arriving on theosism:eventschannel — assert via a rawredis.pubsub()subscriber, or a secondEventBridgewith a fake websocket manager that records_process_single_event.publishto a channel with no subscribers is handled (logged warning, no crash).Notes / Where
New file
tests/integration/test_event_bridge.py. Use a fake/stub websocket manager (records calls) to avoid pulling in FastAPI here. Account for the background subscriber thread: poll with a timeout for the event to arrive, and tear down the bridge (_shutdown_event) at the end so threads do not leak between tests.