You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Route-scoped string middleware is re-instantiated on every request, and the preflight-capability scan re-runs per OPTIONS request even though the pipeline is fixed at $init. Line numbers verified against origin/develop @ 8971094.
1. Route-scoped string middleware re-instantiated per request — stateful middleware silently reset (R15 / MA12, High) vendor/wheels/Dispatch.cfc:9, :61, :298-313, :377-401 — global middleware is built once at $init ($buildMiddlewarePipeline), but route-scoped string middleware (the documented form) is re-instantiated via CreateObject("component", mw).init() per request, a new Pipeline is built per request, and regex routes also re-Duplicate instance middleware. Consequence: a route-scoped in-memory RateLimiter gets a fresh empty store each request and never enforces — any stateful middleware is silently reset.
2. $hasPreflightCapableMiddleware re-runs IsInstanceOf over the pipeline on every OPTIONS request (R19 / MA15, Low) vendor/wheels/Dispatch.cfc:298, :393-401 — the IsInstanceOf scan over the middleware pipeline runs on every OPTIONS request, but the pipeline is fixed at $init, so the boolean is invariant.
Impact
Route-scoped stateful middleware (the documented registration form) is non-functional: a per-route in-memory RateLimiter never accumulates counts and never enforces. This is a correctness bug masquerading as a perf cost and interacts with the feat(testing): add browserLoginAsHandler override for /_browser/login-as fixture #2832init() gotcha and SecurityHeaders HSTS defaults.
Per-request instantiation + Pipeline rebuild + regex-route Duplicate are avoidable allocations on the dispatch hot path.
Suggested approach
This needs a deliberate singleton-vs-per-request contract for middleware, not an autonomous hot-path edit:
Problem
Route-scoped string middleware is re-instantiated on every request, and the preflight-capability scan re-runs per OPTIONS request even though the pipeline is fixed at
$init. Line numbers verified againstorigin/develop@8971094.1. Route-scoped string middleware re-instantiated per request — stateful middleware silently reset (R15 / MA12, High)
vendor/wheels/Dispatch.cfc:9,:61,:298-313,:377-401— global middleware is built once at$init($buildMiddlewarePipeline), but route-scoped string middleware (the documented form) is re-instantiated viaCreateObject("component", mw).init()per request, a new Pipeline is built per request, and regex routes also re-Duplicateinstance middleware. Consequence: a route-scoped in-memoryRateLimitergets a fresh empty store each request and never enforces — any stateful middleware is silently reset.2.
$hasPreflightCapableMiddlewarere-runsIsInstanceOfover the pipeline on every OPTIONS request (R19 / MA15, Low)vendor/wheels/Dispatch.cfc:298,:393-401— theIsInstanceOfscan over the middleware pipeline runs on every OPTIONS request, but the pipeline is fixed at$init, so the boolean is invariant.Impact
init()gotcha and SecurityHeaders HSTS defaults.Duplicateare avoidable allocations on the dispatch hot path.Suggested approach
This needs a deliberate singleton-vs-per-request contract for middleware, not an autonomous hot-path edit:
init()requirement and HSTS defaults).Duplicate.$buildMiddlewarePipelineand cache it at$init.Acceptance criteria
Duplicateof middleware.$init.Source
Internal multi-agent framework review 2026-06-09, wave 2 (issues phase). Findings: routing R15/R19, middleware-auth MA12/MA15.