v0.2.0 (2/N): HealthController deep-load canary → BridgeBundleInfo VO

Decouples /healthz from the publisher contract. v0.1.1 wired
HealthController to constructor-inject Publisher purely as a "is the
bundle resolvable" probe — that worked but cemented the publisher's
API as a readiness-test dependency, which was awkward once
PublisherInterface landed in v0.2.0 chunk 1.

Replace with BridgeBundleInfo: a tiny readonly VO carrying the
bundle's name + class FQCN. HealthController depends on this instead.
Same deep-load semantics (broken bundle → can't construct the VO →
500 on /healthz), no leaky publisher dep.

/healthz response shape:
  - `bundle`: was `PhpQml\\Bridge\\Publisher`,
              now `PhpQml\\Bridge\\BridgeBundle`
  - `name`:   new field, reports `php-qml/bridge`

bundled-supervisor.sh's grep updated to match the new canary value
plus an assertion that the new `name` field is present (catches a
botched BridgeBundleInfo wire-up that the bundle-class-name assertion
alone would miss).

Quality + maker snapshot + bundled-supervisor integration test all
pass locally.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-03 19:57:52 +02:00
parent 56e3d671d9
commit 0cca0785c0
4 changed files with 47 additions and 12 deletions

View File

@@ -4,7 +4,7 @@ declare(strict_types=1);
namespace PhpQml\Bridge\Controller;
use PhpQml\Bridge\PublisherInterface;
use PhpQml\Bridge\BridgeBundleInfo;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\Routing\Attribute\Route;
@@ -12,18 +12,18 @@ 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).
*
* `PublisherInterface` 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. The response includes the
* concrete class name so packagers can detect a wrong-implementation
* deployment from the canary value alone.
* `BridgeBundleInfo` is injected purely as a deep-load canary: if the
* 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. Earlier (v0.1.1v0.2.0) this canary
* was `PublisherInterface`; switching to a dedicated info VO decouples
* the readiness probe from the publisher's evolving contract.
*/
final class HealthController
{
public function __construct(
private readonly PublisherInterface $publisher,
private readonly BridgeBundleInfo $info,
) {
}
@@ -32,7 +32,8 @@ final class HealthController
{
return new JsonResponse([
'status' => 'ok',
'bundle' => $this->publisher::class,
'bundle' => $this->info->bundle,
'name' => $this->info->name,
]);
}
}