Repository navigation
fix(routes): register an empty route location at the controller root - #99
Merged
Merged
Conversation
Upd4ting
force-pushed
the
fix/ant-1393-empty-route-location
branch
from
November 9, 2026 14:53
c0ad2c1 to
2baf300
Compare
Upd4ting
added a commit
that referenced
this pull request
Nov 10, 2026
## Why The verify-interface skill still listed #75 and #76 as open known findings. Both are closed. #99 registers `@Get("")` at the controller root, and #101 refuses `@Connection` on handlers that never receive a connection. An agent reading the skill learned behaviour that is no longer true. The `route-locations` journey also stripped one trailing slash, so it pinned neither form of the root location. ## What changed - `features/README.md`: the Known findings section is removed. Its table held only #75 and #76, and its "No journey pins either behaviour" line went with it. - `features/routes.md`: the #75 gotcha is removed. The `route-locations` sub-feature now names the root location it pins. - `scenarios-second.ts`: `route-locations` compares `r.handler.location` as registered and drops `.replace(/\/$/, "")`. The expected line already held `/users` for `@Get("")`, so it now pins the root form exactly. - `@Connection`: #101 already covers the refusal in the `injected-values` journey (`connectionOnGet`, listed in `features/parameter-sources.md`). This PR does not change it. ## Proof Verify journeys the retired findings pointed at, run on this branch's packed build: ```text $ antelopejs-verify journey "$RUN" routes PASS routes/route-locations (0.0 s) PASS routes/route-errors (0.0 s) $ antelopejs-verify journey "$RUN" parameter-sources injected-values PASS parameter-sources/injected-values (0.0 s) $ antelopejs-verify journey "$RUN" --plan PASS smoke/core-calls (0.4 s) PASS smoke/export-surface (0.0 s) ``` The same `route-locations` journey with `src/routes.ts` set back to the pre-#99 join (`${controller.location}/${segment}`), a local change that was not committed: ```text FAIL routes/route-locations (0.0 s) 02-run-the-route-locations-scenario: route-locations answers as docs/ states (expected "{\"routes\":[[\"handler\",\"get\",\"/users/listUsers\",\"listUsers\",null],[\"handler\",\"get\",\"/users\",\"root\",null],... ``` With the strip in place, that regression would pass. `pnpm run checks`: ```text Checks: 9 passed, 0 failed. ``` ```mermaid flowchart LR A["@get("") on Controller("/users")"] --> B[ProcessCallback] B --> C["location /users"] C --> D{"route-locations journey"} D -- "before: strip one trailing slash" --> E["/users and /users/ both pass"] D -- "after: compare as registered" --> F["only /users passes"] ```
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The docs say
@Get("")registers the controller root, soController("/users")with@Get("")should register/users. It registered/users/, which is whatgetRegisteredRoutes()and everyRouteHandler.locationconsumer saw.Fixes #75
What changes
ProcessCallbackinsrc/routes.tsno longer appends/when the route location is empty. The full location is the controller location, and an empty controller location still falls back to/. Every other combination keeps the old join,${controller.location}/${location ?? key}with repeated slashes collapsed.The issue asked whether to change the code or the docs. This PR changes the code, because the docs state the intended contract and
@antelopejs/apiserves both forms the same way. ItsregisterHandlersplits the location on/and drops empty parts, so no served route changes. Only the registered location string does.flowchart LR A["@Get(location)"] --> B{"location ?? key is empty?"} B -- yes --> C["controller.location, or / when that is empty"] B -- no --> D["controller.location + / + segment"] C --> E["collapse repeated slashes"] D --> E E --> F["RegisterRoute"]Proof
src/tests/route-decorators.test.tsgains two cases. The first fails on any implementation that keeps the trailing slash for an empty location. The second fails on one that turnsController("/")with@Get("")into an empty location.Before the fix (
pnpm exec ajs module test . -f dist/tests/route-decorators.test.json main'ssrc/routes.ts):After the fix:
pnpm run checks:Checks: 9 passed, 0 failed.The full suite includesrouting.test.ts, which serves a@Post("")route over HTTP.