Skip to content

Commit bb67878

Browse files
committed
fix: Core\Front\Boot referenced the Client frontage after it was deleted
Found while chasing a route-to-nowhere bug in php-admin, which led to booting php-admin's own app skeleton to reproduce it — that boot fataled before reaching the route in question. Core\Front\Boot::$providers listed Client\Boot::class, and Core\Front\Boot::middleware() called Client\Boot::middleware(), but src/Core/Front/Client/ was deleted in affedb3 ("refactor: extract Service + Client to standalone packages") without updating this class. Every real application booting through the documented entry point (Application::configure(withMiddleware: Core\Front\Boot::middleware(...))) fataled on "Class Core\Front\Client\Boot not found" before serving a single request — regardless of whether the consuming app had php-client installed, since php doesn't declare it as a dependency and never did. Client now follows the same pattern already used for Api/Mcp (documented in this class's own docblock as "provided by their packages, auto-discovered") — removed from $providers and from middleware(), with the docblock updated to explain why. This class's own test suite (Testbench, LifecycleEventProvider only) never exercised Application::configure(), so the bug was invisible to `composer test` here and only surfaced when something drove a real bootstrap/app.php. Added tests/Feature/FrontBootMiddlewareTest.php: calls Boot::middleware() directly (must not throw) and reflects $providers to assert Client\Boot is absent. Both fail on the pre-fix code — one with the exact "Class ... not found" error, the other asserting the dead reference is gone. phpstan level 1 clean, pint clean, full Pest suite 448 failed/569 passed (two more passing, zero regressions — see previous two commits for the pre-existing 448). Co-Authored-By: Virgil <virgil@lethean.io>
1 parent 0060dd4 commit bb67878

2 files changed

Lines changed: 54 additions & 6 deletions

File tree

‎src/Core/Front/Boot.php‎

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,30 @@
1919
/**
2020
* Core front-end module - I/O translation layer.
2121
*
22-
* Six frontages bundled in the framework, each translating a transport protocol:
22+
* Five frontages bundled in the framework, each translating a transport protocol:
2323
* Web - HTTP → HTML (public marketing)
24-
* Client - HTTP → HTML (namespace owner dashboard)
2524
* Admin - HTTP → HTML (backend admin dashboard)
2625
* Cli - Artisan commands (console context)
2726
* Stdio - stdin/stdout (CLI pipes, MCP stdio)
2827
* Components - View namespaces (shared across HTTP frontages)
2928
*
3029
* Additional frontages provided by their packages (auto-discovered):
31-
* Api - HTTP → JSON (REST API) — php-api
32-
* Mcp - HTTP → JSON-RPC (MCP protocol) — php-mcp
30+
* Client - HTTP → HTML (namespace owner dashboard) — php-client
31+
* Api - HTTP → JSON (REST API) — php-api
32+
* Mcp - HTTP → JSON-RPC (MCP protocol) — php-mcp
33+
*
34+
* Client\Boot lived here until it was extracted to the standalone
35+
* php-client package (see git history: "refactor: extract Service +
36+
* Client to standalone packages"). The extraction deleted
37+
* src/Core/Front/Client/ but left this class still hard-referencing
38+
* Client\Boot in both $providers and middleware() — a class that no
39+
* longer exists in this repo — which fataled Application::configure()
40+
* for every consuming app, not just ones missing php-client.
3341
*/
3442
class Boot extends AggregateServiceProvider
3543
{
3644
protected $providers = [
3745
Web\Boot::class,
38-
Client\Boot::class,
3946
Admin\Boot::class,
4047
Cli\Boot::class,
4148
Stdio\Boot::class,
@@ -49,7 +56,6 @@ class Boot extends AggregateServiceProvider
4956
public static function middleware(Middleware $middleware): void
5057
{
5158
Web\Boot::middleware($middleware);
52-
Client\Boot::middleware($middleware);
5359
Admin\Boot::middleware($middleware);
5460

5561
// API and MCP groups — inlined because middleware() runs during
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Core\Tests\Feature;
6+
7+
use Core\Front\Boot;
8+
use Core\Tests\TestCase;
9+
use Illuminate\Foundation\Configuration\Middleware;
10+
11+
/**
12+
* Regression coverage: Core\Front\Boot::$providers listed Client\Boot::class
13+
* and Core\Front\Boot::middleware() called Client\Boot::middleware(), but
14+
* src/Core/Front/Client/ was deleted when the Client frontage was extracted
15+
* to the standalone php-client package (commit affedb3, "refactor: extract
16+
* Service + Client to standalone packages") — the two references in this
17+
* class were never updated. Any real application booting through
18+
* Application::configure(withMiddleware: Core\Front\Boot::middleware(...))
19+
* — the documented entry point — fataled with "Class Core\Front\Client\Boot
20+
* not found" before a single request could be served, regardless of
21+
* whether php-client was installed.
22+
*/
23+
class FrontBootMiddlewareTest extends TestCase
24+
{
25+
public function test_front_boot_middleware_does_not_reference_the_deleted_client_frontage(): void
26+
{
27+
$middleware = new Middleware();
28+
29+
// Must not throw \Error: Class "Core\Front\Client\Boot" not found.
30+
Boot::middleware($middleware);
31+
32+
$this->assertTrue(true);
33+
}
34+
35+
public function test_front_boot_aggregate_providers_do_not_reference_the_deleted_client_frontage(): void
36+
{
37+
$ref = new \ReflectionClass(Boot::class);
38+
$providers = $ref->getDefaultProperties()['providers'];
39+
40+
$this->assertNotContains('Core\Front\Client\Boot', $providers);
41+
}
42+
}

0 commit comments

Comments
 (0)