* fix(app-router): reject middleware control responses in route handlers
App Route handlers currently treat NextResponse.next() and NextResponse.rewrite() as ordinary 200 responses. That diverges from Next.js, where those helpers are middleware control-flow signals and are rejected after a route handler returns.
The route-handler execution path now validates returned responses before cache policy or response finalization runs. Focused unit and integration tests cover the invalid next and rewrite helper responses.
* Update tests/app-route-handler-execution.test.ts
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Update packages/vinext/src/server/app-route-handler-response.ts
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* fix(app-router): validate route handler ISR regeneration responses
Stale App Route handler regeneration called runAppRouteHandler directly and could serialize a middleware control response into the ISR cache. That bypassed the validation used by the live route-handler execution path.
Run the same response assertion before background regeneration writes a new APP_ROUTE cache entry, restore exact Next.js error wording for parity, and cover the x-middleware-next boundary semantics.
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>