mirror of
https://github.com/monoscope-tech/monoscope.git
synced 2026-11-16 10:18:01 +00:00
feat(endpoints): treat http.route as the route, in every framework's spelling
http.route is the one place a path template arrives as fact rather than
inference — the router matched the request against it. We already preferred it
over url.path, and then handed it, in the framework's own syntax, to code that
expects a URL. What reached the product was the syntax:
- 673 endpoints across 3 projects ending in a regex "$"
- 1,378 with no leading slash
- 162 truncated mid-pattern, because Django writes "(?P<pk>[^/.]+)" and
normalizeUrlPath strips a URL's query string at the first "?"
- 1,540 carrying ":name" across 13 projects, never recognised as parameters
normalizeHttpRoute reads the syntaxes SDKs actually send — Django named groups
and anchors, Express/Gin/Rails ":name", ASP.NET/Laravel/Spring "{name}" with
constraints and catch-alls, Flask "<int:name>", Go 1.22 "{name...}" — and emits
one shape: leading slash, no anchors, plain {name}. The named-group rewrite runs
before any split on "/", because the character class contains a slash; splitting
first is what produced "api/v1/wallets/(".
A route carrying a parameter is authority, so it skips the id heuristics
entirely, and a new one is written as its own canonical template. That reuses
machinery rather than adding a column: discovery only reads canonical_hash IS
NULL, so it can never merge a router's own route away; cleanup only deletes
rows where hash != canonical_hash; and the project cache collects canonical_path,
so a service reporting only url.path resolves onto the template a *different*
service declared. One instrumented framework teaches the project its routes.
Two guards. A catch-all with no literal segment ("/{path}") is refused, or it
would swallow every path of its length. And adopting framework parameter names
renames endpoints — a rename is a new hash — so the named form only wins where
the project has nothing already; an existing row under either spelling keeps its
hash instead of the 13 affected projects re-minting and re-notifying wholesale.
The legacy SDK bridge synthesises http.route from the raw URL. It carries no
parameter, so it is not authority and nothing about its handling changes.
This commit is contained in:
parent
93e98ea0a8
commit
b4ca582e1c
4 changed files with 288 additions and 52 deletions
Loading…
Add table
Add a link
Reference in a new issue