Skip to content

Extract DispatchEngine and slim Router to a route registry#166

Merged
alganet merged 1 commit intoRespect:masterfrom
alganet:dispatch-engine
Mar 17, 2026
Merged

Extract DispatchEngine and slim Router to a route registry#166
alganet merged 1 commit intoRespect:masterfrom
alganet:dispatch-engine

Conversation

@alganet
Copy link
Member

@alganet alganet commented Mar 17, 2026

Move the request execution algorithm out of Router into a dedicated DispatchEngine so the router can focus on route definition and registry concerns.

Changes:

  • add DispatchEngine to own dispatch lifecycle logic: routeless handling, method override resolution, virtual-host path adjustment, route matching, routine matching, OPTIONS handling, and Allow/404/400/405 materialization
  • make Router delegate dispatch(), dispatchContext(), and run() to the engine instead of performing request execution itself
  • keep Router focused on route registration, route sorting, global routine attachment, and convenience entry points
  • add small Router accessors needed by the engine for route registry and virtual-host lookup
  • update low-level router tests and coverage annotations to reflect the new engine boundary

Verification:

  • composer qa
  • changed executable lines verified at 100% coverage

Move the request execution algorithm out of Router into a dedicated
DispatchEngine so the router can focus on route definition and registry
concerns.

Changes:
- add DispatchEngine to own dispatch lifecycle logic:
  routeless handling, method override resolution, virtual-host path
  adjustment, route matching, routine matching, OPTIONS handling, and
  Allow/404/400/405 materialization
- make Router delegate dispatch(), dispatchContext(), and run() to the
  engine instead of performing request execution itself
- keep Router focused on route registration, route sorting, global routine
  attachment, and convenience entry points
- add small Router accessors needed by the engine for route registry and
  virtual-host lookup
- update low-level router tests and coverage annotations to reflect the new
  engine boundary

Verification:
- composer qa
- changed executable lines verified at 100% coverage
@codecov-commenter
Copy link

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.89%. Comparing base (2cf5a76) to head (94b10dd).

Additional details and impacted files
@@             Coverage Diff              @@
##             master     #166      +/-   ##
============================================
- Coverage     97.14%   96.89%   -0.25%     
- Complexity      445      450       +5     
============================================
  Files            27       28       +1     
  Lines          1085     1096      +11     
============================================
+ Hits           1054     1062       +8     
- Misses           31       34       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@alganet alganet marked this pull request as ready for review March 17, 2026 22:56
@alganet alganet merged commit baa45eb into Respect:master Mar 17, 2026
3 checks passed
@alganet alganet deleted the dispatch-engine branch March 17, 2026 22:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants