Repository navigation
Description
.github#199 ("an AppHost generic the leaf registers itself is not an unreachable route") is merged, and gate-14 still reports 4 false controller-class-not-found findings on procest at hydra-gates@main (756fe89, i.e. after #199).
Measured
$ hydra-gates --app-dir <procest@084fbf03> --full
[gate-14] route-reachability: FAIL — 4 unrouted method(s) or wrong-target route(s)
lib/Controller/HealthController.php route='health#index' rule=controller-class-not-found
lib/Controller/MetricsController.php route='metrics#index' rule=controller-class-not-found
lib/Controller/PreferencesController.php route='preferences#getPreference' rule=controller-class-not-found
lib/Controller/PreferencesController.php route='preferences#setPreference' rule=controller-class-not-found
All four are served. OCA\\OpenRegister\\AppHost\\Bootstrap::registerControllers() binds OCA\\Procest\\Controller\\HealthController etc. to its generics via aliasControllerUnlessLeafDefinesIt(). The absence of the files is deliberate and required — creating them would make the alias skip and break the routes.
Cause
run-hydra-gates.sh L483-488:
_HYDRA_APPHOST=0
if [ -f lib/AppInfo/Application.php ] \
&& grep -qE 'AppHost\\+Bootstrap' lib/AppInfo/Application.php \
&& grep -qE 'Bootstrap::register[[:space:]]*\(' lib/AppInfo/Application.php; then
_HYDRA_APPHOST=1
fiBoth probes are pinned to lib/AppInfo/Application.php. procest does not call Bootstrap::register() there; it delegates Application.php → Registrar/ServiceRegistrar.php → Registrar/AppHostRegistrar.php:121. So _HYDRA_APPHOST=0, _apphost_serves() returns 1 for every slug, and the legitimate-absence branch is unreachable. _di_binds_controller() cannot rescue it either — it is also scoped to Application.php (L534).
Measured, with a positive control so a zero is not mistaken for a broken grep:
$ grep -cE 'AppHost\\+Bootstrap' lib/AppInfo/Application.php -> 0
$ grep -cE 'Bootstrap::register[[:space:]]*\(' lib/AppInfo/Application.php -> 0
# same two greps against a file that DOES contain the patterns:
$ grep -cE 'AppHost\\+Bootstrap' /tmp/probe.php -> 1
$ grep -cE 'Bootstrap::register[[:space:]]*\(' /tmp/probe.php -> 1
$ grep -rn 'Bootstrap::register' lib/AppInfo/
lib/AppInfo/Registrar/AppHostRegistrar.php:121: Bootstrap::register(
Why this matters beyond one repo
The trigger was a quality change. procest#717 ("decompose Application bootstrap", a phpmd remediation) moved the call out of Application.php into a registrar. Decomposing a god-object composition root is exactly what the other gates push apps toward — and doing it silently turns gate-14 red on correct code. Any app that has done, or will do, the same refactor is affected.
Suggested fix
Widen both probes from lib/AppInfo/Application.php to lib/AppInfo/ (recursive), keeping the evidence requirement unchanged — still the literal Bootstrap::register( / the exact fully-qualified class name, never a wildcard, so a genuinely missing controller still fails.
Worth a fixture for the decomposed-registrar shape: the current test suite presumably only covers the inline-in-Application.php shape, which is why #199 read as complete.
Not a duplicate of
#199— fixed the leaf-registers-the-generic-itself shape (openconnector'sgenericPreferences). This is the delegated-registrar shape; fix(gate-14): an AppHost generic the leaf registers itself is not an unreachable route #199's helper is scoped to the same single file and so cannot see it.#200(closed) — gate-57's attribute-scanner seam, unrelated.
Activity
rubenvdlinde commentedon Aug 8, 2026
A third way the AppHost exemption misses, measured on doriath. This one is not about where registration lives — doriath's detection works fine — it is that the exemption is gated on the wrong condition.
Detection succeeds here. Both greps match
lib/AppInfo/Application.php:So
_HYDRA_APPHOST=1. gate-14 still reports 5 phantom findings:Why.
_apphost_serves()is documented as firing only when the controller file is absent:doriath ships both files on purpose.
Application.php::registerDomainOverrides()re-registersSettingsController(admin/user split +#[AuthorizedAdminSetting]) andSettingsServiceso the concrete leaf classes win over the generic aliases. So the exemption is switched off — while the routes forpage,catchAll,index,createandloadare still supplied by the engine, via\OCA\OpenRegister\AppHost\Routes::standard()atappinfo/routes.php:22:gate-14 parses
appinfo/routes.phpstatically and cannot see insideRoutes::standard(), so it concludes the routes are missing.The two facts are independent. "Does the leaf define the controller class?" and "does the leaf define the route?" are different questions, and AppHost's design deliberately splits them: a leaf can override the controller while the route still comes from the shared builder. Gating the route exemption on file absence conflates them.
Suggested fix: key the exemption on the route table, not the controller file — if
appinfo/routes.phpreturnsRoutes::standard(...), treat the five_HYDRA_APPHOST_SLUGSroute names as provided regardless of whether the leaf ships its own controller class. That keeps the deliberate anti-wildcard property (still an explicit five-slug list) while matching whatRoutes::standard()actually injects.For calibration: this is 5 of doriath's 19 full-tree gate failures, i.e. all of gate-14, and every one is phantom.