Skip to content

New v5 refactor#659

Merged
g105b merged 86 commits intomasterfrom
new-v5--refactor
Mar 17, 2026
Merged

New v5 refactor#659
g105b merged 86 commits intomasterfrom
new-v5--refactor

Conversation

@g105b
Copy link
Member

@g105b g105b commented Mar 9, 2026

v5 introduces some new techniques for making the request/response simpler, and this PR brings everything together in a refactor to improve readability and reduce overall complexity of classes, etc.

g105b added 30 commits October 17, 2025 12:00
…w-v5--refactor

# Conflicts:
#	src/Dispatch/Dispatcher.php
#	src/Dispatch/HeaderApplier.php
#	src/Dispatch/HtmlDocumentProcessor.php
#	src/Dispatch/TrailingSlashRedirector.php
g105b and others added 8 commits March 15, 2026 16:42
* feature: custom error script

* wip: test

* tweak: type safe config mocking

* wip: test file

* tweak: output buffer

---------

Co-authored-by: Greg Bowler <greg@g105b.com>
…w-v5--refactor

# Conflicts:
#	test/phpunit/ApplicationTest.php
@g105b
Copy link
Member Author

g105b commented Mar 17, 2026

I'm finishing this up today. High value tasks:

  • Dispatcher needs more focussed tests for the request's lifecycle branches. The tests should veridy redirect short -circuiting, 404 generation when no view/logic files exist, defaulting the response to 200, mapping thrown ResponseStatusException objects to error statuses, generating a basic error page in production vs non-production.
  • LogicExecutor needs to test both execution modes. The unit tests should prove that class-based logic files call instance methods, classless logic files are loaded through the logic stream wrapper. go_before/go/go_after ordering needs testing.
  • HTMLDocumentProcessor should test that dynamic paths add the expected body classes, component files produce LogicAssemblyComponent entries, missing component PHP files are skipped cleanly, and missing partial/component directories do not throw exceptions.
  • DefaultServiceLoader needs tests to support that each loader returns the correct type and pulls dependencies from the container correctly. The important ones are things like response headers, request URI, binder/document wiring, list element collection, and database settings including fallback defaults.

Once these tests are written, ContainerFactory needs tests for custom service loader registration, LogicStreamHandler needs tests for registering the wrapper only when the protocol is absent, LogicProjectNamespace should test path-to-namespace conversaion, and ViewStreamer should prove the correct view object recieves the correct model.

…ctor

# Conflicts:
#	src/Middleware/RequestHandler.php
@g105b
Copy link
Member Author

g105b commented Mar 17, 2026

After checking the phpunit coverage output, the priority is as follows:

  1. Dispatcher - plenty of methods requiring obvious tests and edge case catches
  2. DefaultServiceLoader - each loader method needs testing. Easy peasy.
  3. ContainerFactory - both paths need testing (custom service loader with fallback to default).
  4. Application - some missing pieces in this important class, like shutdown/finish doing the same thing each time, error paths that rebuild the dispatcher with error status, fallback to basic error pages, optional request logging paths.
  5. AppAutoloader and LogicStreamHandler - fill the remaining branch gaps rather than rewriting them broadly.

@g105b g105b merged commit e6a2396 into master Mar 17, 2026
3 checks passed
@g105b g105b deleted the new-v5--refactor branch March 17, 2026 22:24
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.

Update routing for error handling and better execution model

2 participants