feat(api): parse endpoints pass EventBus into store writes
- api.parse_837 / parse_835: pass request.app.state.event_bus into store.add() - conftest: autouse fixture wires a fresh EventBus onto app.state for every test, since TestClient does not invoke the FastAPI lifespan handler unless used as a context manager - test_pubsub: split get_event_bus coverage into a raises-when-missing test and a returns-attached-bus test, both save/restore app.state.event_bus around the assertion so the autouse fixture's bus is preserved Phase 2 complete: db init moved to lifespan, EventBus is the process-wide publish point, and the two ingest endpoints publish claim_written / remittance_written / activity_recorded events on every store.add().
This commit is contained in:
@@ -279,7 +279,7 @@ async def parse_837(
|
||||
parsed_at=utcnow(),
|
||||
result=result,
|
||||
)
|
||||
store.add(rec)
|
||||
store.add(rec, event_bus=request.app.state.event_bus)
|
||||
|
||||
if _client_wants_json(request):
|
||||
body = json.loads(result.model_dump_json())
|
||||
@@ -487,7 +487,7 @@ async def parse_835_endpoint(
|
||||
parsed_at=utcnow(),
|
||||
result=result,
|
||||
)
|
||||
store.add(rec)
|
||||
store.add(rec, event_bus=request.app.state.event_bus)
|
||||
|
||||
if _client_wants_json(request):
|
||||
body = json.loads(result.model_dump_json())
|
||||
|
||||
Reference in New Issue
Block a user