|
| 1 | +--- |
| 2 | +'@objectstack/hono': patch |
| 3 | +--- |
| 4 | + |
| 5 | +The Hono adapter's `/auth/*` mount yields only a 404 that disclaims ownership |
| 6 | + |
| 7 | +`createHonoApp`'s `${prefix}/auth/*` mount forwards every request under it to the |
| 8 | +kernel's `auth` service and, since #4117, hands the request on to the rest of the |
| 9 | +chain when that service answers 404 — which is what keeps `/auth/me/permissions` |
| 10 | +and `/auth/me/localization` reachable through the gated `dispatch()`. The yield |
| 11 | +had only the status to go on, so it could not tell "I do not serve this path" |
| 12 | +from "I serve it and the answer is 404". |
| 13 | + |
| 14 | +Measured on a real boot through this adapter (a real kernel with `AuthPlugin`, |
| 15 | +`prefix: '/api/v1'`), `GET /api/v1/auth/delete-user/callback?token=…&callbackURL=…` |
| 16 | +answered `404 {"message":"Not found","code":"NOT_FOUND"}` from better-auth and |
| 17 | +`200 {}` on the wire. `plugin-auth`'s route ledger carries that route under its |
| 18 | +`disabled` disposition precisely because it is published and answers 404, so the |
| 19 | +ledger's recorded answer was true of the auth service and false on this adapter's |
| 20 | +wire. Nothing had to be composed in for that: the `${prefix}/*` dispatcher |
| 21 | +catch-all this same function registers is terminal and answers `200 {}` for paths |
| 22 | +under `/auth/`. |
| 23 | + |
| 24 | +The mount now asks the auth service whether its own router serves the path, via |
| 25 | +an optional `ownsRoute(request)` — the seam `AuthManager` grew in the plugin-side |
| 26 | +fix for the same defect — and yields only when it does not. Every answer that is |
| 27 | +not a literal `true` (no such method, a throw, anything else) means yield, so a |
| 28 | +service predating the method behaves exactly as before and a failure to decide |
| 29 | +can never cost the ordering-independent surface. |
| 30 | + |
| 31 | +⛔ The mount is unchanged and still claims `${prefix}/auth/*`; 401/403 were never |
| 32 | +yielded and still are not. What narrowed is only which 404 may be handed on. |
0 commit comments