diff --git a/framework/php/src/Controller/HealthController.php b/framework/php/src/Controller/HealthController.php index b989cbf..9d9e79a 100644 --- a/framework/php/src/Controller/HealthController.php +++ b/framework/php/src/Controller/HealthController.php @@ -4,18 +4,33 @@ declare(strict_types=1); namespace PhpQml\Bridge\Controller; +use PhpQml\Bridge\Publisher; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\Routing\Attribute\Route; /** * Readiness probe used by the Qt host to detect when the backend is up. * See PLAN.md ยง3 (*Startup*, step 4). + * + * Publisher is injected purely as a deep-health canary: if the bridge + * bundle's autoload or container wiring is broken (e.g. a packaging build + * with a dangling vendor path-repo symlink), this controller can't even + * be constructed, so /healthz fails 500 instead of misleadingly returning + * 200 against a half-loaded bundle. */ final class HealthController { + public function __construct( + private readonly Publisher $publisher, + ) { + } + #[Route('/healthz', name: 'php_qml_bridge_healthz', methods: ['GET'])] public function __invoke(): JsonResponse { - return new JsonResponse(['status' => 'ok']); + return new JsonResponse([ + 'status' => 'ok', + 'bundle' => $this->publisher::class, + ]); } }