Conversation
…rs (task 2.8, part 1) Introduce a running route-middleware stack so the app can migrate filters -> middleware route-by-route, WITHOUT removing any filter yet. - Route::middleware()/gatherMiddleware() store middleware names on the route. - Router middleware registry (aliasMiddleware/middlewareGroup/middlewarePriority) + resolveMiddleware/gatherRouteMiddleware/uniqueMiddleware. - runRouteWithinStack() runs the route through Illuminate\Pipeline\Pipeline (already present from task 1.2) INSIDE the legacy before/after filter bracket. - New leaves copied from L13: MiddlewareNameResolver (alias/group/':' params), SortedMiddleware (priority sort). - dispatchToRoute: one-line swap route->run($request) -> runRouteWithinStack(). Safety: routes with no ->middleware() short-circuit to a plain run() -> behavior is identical for every existing (filter-only) route (66 existing routing tests unchanged). Filters stay intact; middleware and filters use SEPARATE registries so the ':' param syntax does not collide. Exceptions propagate to the existing top-level handler (base Pipeline rethrows); the HTTP-aware routing Pipeline is deferred to SCC-1. Deferred (SCC-1 lockstep): removing the filter surface, Http\Kernel + middleware groups/priority config, controller middleware -- these land together with the app's filters->middleware conversion that consumes this via the dev-13 alias. Tests: +testRouteMiddlewareRunsAndWraps (closure/short-circuit/alias/param/group), +testRouteMiddlewareCoexistsWithFilters. tests/Routing green (68), Foundation/Http green. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…lters (task 2.8)
Add Controller::middleware($middleware, array $options = []) — matches L13's exact
signature. Bridges to beforeFilter() so controller-declared middleware runs via the
existing ControllerDispatcher filter path until the routing engine is swapped to
stock L13. Lets the app flip $this->beforeFilter('x') -> $this->middleware('x')
(options incl. only/except carry over unchanged after the swap). Additive;
beforeFilter() untouched.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Task 2.8 (part 1) — route-middleware engine
[fork]Menyalakan mesin route-middleware L13 yang benar-benar jalan, berdampingan dgn filter lama, supaya app bisa migrasi filter→middleware per-route tanpa menghapus filter apa pun dulu. Ini prasyarat aman untuk konversi app (jalur A).
Yang ditambah (additive)
Route::middleware()/gatherMiddleware()— simpan nama middleware di route.aliasMiddleware(),middlewareGroup(),middlewarePriority()+resolveMiddleware/gatherRouteMiddleware/uniqueMiddleware.runRouteWithinStack()— jalankan route lewatIlluminate\Pipeline\Pipeline(sudah ada dari task 1.2), di dalam bracket filtercallRouteBefore/After.MiddlewareNameResolver(alias/group/param:),SortedMiddleware(priority).dispatchToRoute: swap 1 barisroute->run($request)→runRouteWithinStack().Kenapa aman untuk 52 guard (krusial)
Route tanpa
->middleware()→ middleware kosong → short-circuit kerun()biasa → perilaku identik untuk semua route eksisting. Terbukti: 66 test routing lama lolos tanpa perubahan. Filter tetap utuh; middleware & filter di registry terpisah → sintaks:tak tabrakan. Exception nembus ke handler top-level (base Pipeline rethrow); routing-Pipeline HTTP-aware (ExceptionHandler/Responsable) ditunda ke SCC-1.Ditunda (SCC-1 lockstep)
Hapus surface filter,
Http\Kernel+ config middleware groups/priority, controller-middleware — semua mendarat bareng konversi filter→middleware app (yang konsumsi ini via aliasdev-dev-13).Verifikasi
tests/Routing68 hijau (66 lama + 2 baru: closure/short-circuit/alias/param/group + koeksis-dgn-filter). Foundation (34) & Http (61) hijau. Lint bersih.Urutan
Stacked di atas #54 (stack: #45←#46←#48←#52←#53←#54←ini). Blocker (1.1, 1.2 Pipeline) ✅.
🤖 Generated with Claude Code