fix: route frontend events from middleware preprocess updates to the client#6644
Conversation
…client A blocking middleware (e.g. an auth gate) can return a StateUpdate whose events are frontend-only specs like rx.toast or rx.redirect. These have no registered backend handler, so enqueueing them on the backend queue raised KeyError. Extract the frontend/backend routing from chain_updates into _route_events and reuse it when applying preprocess updates.
Greptile SummaryThis PR fixes a bug where frontend-only events (e.g.
Confidence Score: 5/5Safe to merge — the change is a minimal, targeted extraction of existing routing logic into a shared helper, and the new middleware-preprocess path is covered by a regression test. The fix is a straightforward refactor: the same No files require special attention. Important Files Changed
Reviews (2): Last reviewed commit: "refactor: single-pass event partition an..." | Re-trigger Greptile |
Merging this PR will not alter performance
Comparing Footnotes
|
Split events into frontend/backend lists in one pass instead of two comprehensions, and extract the app/state-manager wiring duplicated across processor tests into a wired_app fixture.
A blocking middleware (e.g. an auth gate) can return a StateUpdate whose events are frontend-only specs like rx.toast or rx.redirect. These have no registered backend handler, so enqueueing them on the backend queue raised KeyError. Extract the frontend/backend routing from chain_updates into _route_events and reuse it when applying preprocess updates.
All Submissions:
Type of change
Please delete options that are not relevant.
New Feature Submission:
Changes To Core Features: