Commit 3df8819
authored
A handler mounted on `<prefix>/*` claims an entire namespace, and Hono runs every
handler matching a path in registration order with the first Response winning. So
a TERMINAL wildcard makes every other route under that prefix reachable only when
it happens to register first — and plugin registration order is not a contract
anyone declares or tests.
That shape has cost four fixes (#2567, #4018, #4088/#4092, cloud#923) and every
one was found by hand, after the fact, by someone reading the code for an
unrelated reason. The driven tests #4092 and cloud#923 shipped each pin ONE
catch-all and cannot cover the next wildcard someone mounts. What never existed is
the ENUMERATION.
Adds it, following check-route-envelope.mjs (#3843) including the part that
matters most: a site the scan finds but the ledger does not declare is an ERROR,
not a default. Three states — `yields` (verified from the AST, so an entry cannot
rot), `exempt` with a reason, `ratchet` naming the issue. AST rather than regex
because "does this call next()?" is a question about parameter binding: a comment
or string mentioning next(), or an inner closure's own next, all fool a textual
match in the direction that PASSES while the defect ships.
Found 13 namespace-claiming mounts where a manual grep had found 3, and with them
two real, previously untracked instances of the #4088 defect in
packages/adapters/hono — ratcheted under #4117. It also separates that file's
deliberate `${prefix}/*` ownership (ADR-0076 OQ#9) from the two that merely forgot
to yield; in source they look identical.
Verified both directions by hand: reverting #4092's fix fails with the terminal
diagnostic, and a new undeclared catch-all fails as NOT DECLARED.
1 parent 821ac7a commit 3df8819
4 files changed
Lines changed: 538 additions & 0 deletions
File tree
- .changeset
- .github/workflows
- scripts
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
123 | 123 | | |
124 | 124 | | |
125 | 125 | | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
126 | 139 | | |
127 | 140 | | |
128 | 141 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| 39 | + | |
39 | 40 | | |
40 | 41 | | |
41 | 42 | | |
| |||
0 commit comments