Latest Results
fix: run middleware preprocess on awaited event handlers (#7782)
* fix: run middleware preprocess on awaited event handlers
Awaiting a handler inline called process_event directly and skipped the
app middleware, so a handler a middleware blocks (e.g. an auth gate) ran
when another handler awaited it. The middleware now travels on the
EventContext, and the queued and inline paths share one preprocess step:
a blocked awaited handler does not run, its update reaches the client,
and the await returns None, as for a queued event.
* fix: gate streamed events and hold the lock while middleware preprocesses
The streaming context built by enqueue_stream_delta did not carry the
middleware, so upload handlers skipped it once the queued path read it
from the context. An awaited handler also ran middleware before its task
was registered as an inline run, so a detached child paused in async
middleware let the parent release the state lock. The streaming context
now copies the middleware, and preprocessing runs inside the registered
inline run.
* refactor: name the middleware gate for what it answers and wire tests like configure
Rename _preprocess_blocks to _blocked_by_middleware, and have the wired_app
fixture put the app's middleware on the root context as configure does, so
tests only add a middleware instead of calling a helper.
* refactor: rename the middleware gate to _process_middleware Latest Branches
-2%
-2%
benedikt-bartscher:state-update-codec -1%
claude/focused-wozniak-n9s0x3 © 2026 CodSpeed Technology