Reject non-numeric window before it reaches Postgres - #184
Conversation
|
@001marvelqueen-blip Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
The pg driver puts the connection string into its error messages, so
`TWAP computation failed: ${err.message}` published the Postgres
credentials to any caller who could make the query fail. Log the message
and return a generic one instead, matching what /screener already does.
Also regenerates openapi.json from openapi.yaml, which #184 left stale —
scripts/generate-openapi.ts derives the JSON from the YAML.
Claude-Session: https://claude.ai/code/session_01USgemLt4Rnz4SGB1Srf3GB
|
Merged — thanks. The validation is exactly right: I checked that Moving Two small things I fixed on main in 1c7e200 rather than sending back to you, since neither was your doing:
Both are pre-existing on main — flagging them so they're on your radar, not as anything you needed to change. |
Every function in src/aggregator/vwap.ts now takes a required network and filters price_points and pool_snapshots on it, getAMMPrice filters both legs of its pool lookup, /price/:assetA/:assetB passes req.network through to the aggregator, and the aggregate refresh worker runs once per enabled network instead of pinning itself to whichever network the instance happens to be indexing. Merged locally: src/__tests__/price.test.ts conflicted only because #184 and 1c7e200 appended test blocks to the same tail; resolved as a union. The README paragraph was corrected on merge — #195, #202 and #205 landed network scoping for /screener, /pools, /depth and /prices/history after this branch was written, so the list of still-unscoped endpoints was stale. Claude-Session: https://claude.ai/code/session_01USgemLt4Rnz4SGB1Srf3GB
Overview
This PR rejects non-numeric
windowqueries on TWAP and VWAP endpoints before they hit Postgres.Related Issue
Closes #171
Changes
📈 API Schema Validation
[MODIFY]
src/routes/price.tswindow,sampleInterval,method, andsourceearly.[MODIFY]
README.md/price/twap/:assetA/:assetBand/price/vwap/:assetA/:assetBto endpoints table.[MODIFY]
openapi.yaml[MODIFY]
src/__tests__/price.test.tsVerification Results