π Description
routes/liquidity.ts mounts GET /entries (static) before GET /:asset (parameterized), so Express's route-matching order means a request to /api/v1/liquidity/entries always hits the entries handler and can never be interpreted as getPool("entries"). This is correct today only because of registration order β a routine-looking refactor that reorders the two router.get(...) calls would silently break GET /api/v1/liquidity/entries by making it fall through to :asset matching instead.
π§© Requirements and context
- Add a test asserting
GET /api/v1/liquidity/entries returns the entries list shape ({ entries: [...] }), not a 404-or-pool-shaped response for a nonexistent "ENTRIES" asset.
- Add a code comment directly above the two route registrations in
routes/liquidity.ts calling out that their order is load-bearing.
- Add a short note to the README or
openapi.ts describing this constraint if either documents route ordering elsewhere (otherwise, the code comment plus test suffice).
π οΈ Suggested execution
- Add the regression test to
src/routes/liquidity.test.ts.
- Add the explanatory comment to
src/routes/liquidity.ts directly above the router.get("/entries", ...) and router.get("/:asset", ...) calls.
β
Acceptance criteria
π Security notes
N/A β test/documentation only; prevents an accidental route-shadowing regression during future refactors.
π Guidelines
- Minimum 95% test coverage
- Clear documentation
- Timeframe: 96 hours
π Description
routes/liquidity.tsmountsGET /entries(static) beforeGET /:asset(parameterized), so Express's route-matching order means a request to/api/v1/liquidity/entriesalways hits the entries handler and can never be interpreted asgetPool("entries"). This is correct today only because of registration order β a routine-looking refactor that reorders the tworouter.get(...)calls would silently breakGET /api/v1/liquidity/entriesby making it fall through to:assetmatching instead.π§© Requirements and context
GET /api/v1/liquidity/entriesreturns the entries list shape ({ entries: [...] }), not a 404-or-pool-shaped response for a nonexistent "ENTRIES" asset.routes/liquidity.tscalling out that their order is load-bearing.openapi.tsdescribing this constraint if either documents route ordering elsewhere (otherwise, the code comment plus test suffice).π οΈ Suggested execution
src/routes/liquidity.test.ts.src/routes/liquidity.tsdirectly above therouter.get("/entries", ...)androuter.get("/:asset", ...)calls.β Acceptance criteria
routes/liquidity.tsclearly documents the ordering dependency.π Security notes
N/A β test/documentation only; prevents an accidental route-shadowing regression during future refactors.
π Guidelines