You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The scanner emits an app's own route definitions as external "endpoints". In sapling/backend, ~141 of 215 endpoints are @router.get/post(...) definitions in production routes/*.py (e.g. routes/social.py, routes/admin.py, routes/learn.py) — the program's own API surface, not outbound spend.
This is distinct from #137, which covers test-fixture / compiled-test files via path exclusion. These route-defs live in production source, so #137's exclusions will not catch them — they need to be told apart from outbound calls by kind, not by path.
Root cause
The regex pass emits any /-prefixed literal as an endpoint:
gated only by isHighConfidenceUrl (:95-107), which accepts any http(s):// or /-prefixed string.
A decorator route definition and an outbound call to a path are indistinguishable to it. endpoint-classification.ts marks these internal, but they still land in result.endpoints and inflate the cost/count surfaces.
Keep route-defs out of the external-spend endpoint list and the cost summary. Optionally surface them in a separate "your API surface" bucket — never "external".
Part of #142. Sibling of #137.
Summary
The scanner emits an app's own route definitions as external "endpoints". In
sapling/backend, ~141 of 215 endpoints are@router.get/post(...)definitions in productionroutes/*.py(e.g.routes/social.py,routes/admin.py,routes/learn.py) — the program's own API surface, not outbound spend.This is distinct from #137, which covers test-fixture / compiled-test files via path exclusion. These route-defs live in production source, so #137's exclusions will not catch them — they need to be told apart from outbound calls by kind, not by path.
Root cause
The regex pass emits any
/-prefixed literal as an endpoint:src/scanner/core-scanner.ts:284—matchRouteDefinitionLine(line)src/scanner/core-scanner.ts:310—matchLine(line)isHighConfidenceUrl(:95-107), which accepts anyhttp(s)://or/-prefixed string.A decorator route definition and an outbound call to a path are indistinguishable to it.
endpoint-classification.tsmarks theseinternal, but they still land inresult.endpointsand inflate the cost/count surfaces.Proposed fix
@app.<verb>(...)/@router.<verb>(...); Expressapp.get(path, handler)registration — and classify askind: "route-def"/scope: "internal-route".Acceptance criteria
sapling/backendreports 0 external endpoints sourced from@router.*route definitions.totalMonthlyCost/ externaltotalEndpoints.