|
| 1 | +--- |
| 2 | +"@objectstack/plugin-hono-server": patch |
| 3 | +--- |
| 4 | + |
| 5 | +fix(plugin-hono-server): compute the standalone discovery `routes` from real registrations, and cede to the real owner (#4018) |
| 6 | + |
| 7 | +`registerStandardEndpoints` served a **fully static** discovery: a hardcoded |
| 8 | +`routes` table listing `auth` / `packages` / `analytics` / `workflow` / |
| 9 | +`automation` / `ai` / `notifications` / `i18n` / `storage` / `ui` regardless of |
| 10 | +what the host actually mounted. A standalone Hono deployment therefore |
| 11 | +advertised ten route families and 404'd on every one no plugin bridged — the |
| 12 | +"advertise a route that doesn't exist" class ADR-0076 D12 exists to kill, and |
| 13 | +the reason this surface disagreed with the two real discovery builders |
| 14 | +(`HttpDispatcher.getDiscoveryInfo`, `metadata-protocol`'s `getDiscovery`), which |
| 15 | +both compute per service at runtime. |
| 16 | + |
| 17 | +Two changes, no new discovery implementation to keep in sync: |
| 18 | + |
| 19 | +- **Single owner (D11 / OQ#9).** When `@objectstack/rest` or the runtime |
| 20 | + dispatcher is on the kernel, this surface no longer registers |
| 21 | + `${prefix}/discovery` — that plugin owns it. Both register during plugin |
| 22 | + `start()`, i.e. before this `kernel:ready` hook, and Hono is |
| 23 | + first-registration-wins, so they already shadowed this handler in every |
| 24 | + composed deployment: the cede changes no served payload, it removes a third |
| 25 | + one nobody read. `/.well-known/objectstack` is ceded to the dispatcher only |
| 26 | + (REST never registers it), so a REST-without-dispatcher host keeps the |
| 27 | + redirect. |
| 28 | + |
| 29 | +- **Computed, not hardcoded (D12).** When this surface does own `/discovery`, |
| 30 | + `routes` is derived per request from the app's live route table: a family is |
| 31 | + advertised iff a route is really registered at or under its base path. A |
| 32 | + wildcard mounted *above* the base (global `/*` middleware, `/api/v1/*`) does |
| 33 | + not count as a mount. |
| 34 | + |
| 35 | +**What changes for you.** On a standalone `HonoServerPlugin` host (no REST, no |
| 36 | +dispatcher), `GET /api/v1/discovery` now omits every family nothing mounts — |
| 37 | +most visibly `routes.metadata`, since `/api/v1/meta` ships with |
| 38 | +`@objectstack/rest` / the dispatcher. Clients that read a route out of |
| 39 | +discovery and call it stop getting a 404; `@objectstack/client` falls back to |
| 40 | +the conventional path for any omitted key, so `client.connect()` is unaffected. |
| 41 | +Composed deployments (`os serve`, cloud) are unchanged — the dispatcher's |
| 42 | +service-aware discovery was already the one being served. |
0 commit comments