feat(events): reject unknown query params, extract query parsing helper - #408
Merged
mikewheeleer merged 3 commits intoJul 28, 2026
Merged
Conversation
The pr-404 merge left literal <<<<<<</=======/>>>>>>> markers in devDependencies, producing invalid JSON and breaking npm install for every contributor. Resolves to typescript@^6.0.3 with typescript-eslint@^8.65.0: the currently published typescript-eslint (8.65.0) only supports typescript <6.1.0, so pairing it with the typescript@^7.0.2 side of the conflict leaves the dependency tree unresolvable.
- Reject unknown query parameters on /health, /api/v1/health/ready, and /api/v1/health/deep with a structured 400 invalid_request. - Add a checks array to /api/v1/health/deep exposing per-subsystem status (event log, usage/services/webhook/API-key stores, memory), with opaque-cursor pagination (limit default 10, max 50) matching the existing events-log cursor contract. - Add docs/health.md covering all three routes, the new pagination contract, and error codes. - Add src/health-deep.test.ts covering success, pagination, malformed cursor, and unknown-query-param rejection.
- Extract the since/type/limit/cursor parsing preamble in GET /api/v1/events into parseEventsListQuery(), a single entry point for the bounded query contract. - Reject unknown query parameters on both /api/v1/events and /api/v1/events/summary with a structured 400 invalid_request, instead of silently ignoring typos. - Expand docs/events.md into a full API contract doc: both routes, request/response examples, and an error-codes table. - Add src/events-query-validation.test.ts covering the new rejection behavior and confirming documented parameters still work. Cursor pagination on the events listing (GrantFox Agentpay-Org#392) was already implemented prior to this change; this PR hardens and documents it rather than re-adding it.
Contributor
|
neat work @thlpkee20-wq — thanks for the care. merging 🌱 |
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.
Summary
Closes #396
Closes #395
Closes #393
Closes #392
since/type/limit/cursorparsingpreamble out of the
GET /api/v1/eventshandler intoparseEventsListQuery(), a single typed entry point for the boundedquery contract.
/api/v1/eventsand/api/v1/events/summarynow reject anyquery parameter outside their documented allow-list with a structured
400 invalid_request. (Events has no write/body endpoint to holdrequest-body validation — the existing
typefilter intentionallyreturns
200+ empty results for unrecognized values, per thealready-tested contract in
events-endpoint.test.ts, so that behavioris preserved rather than turned into a 400.)
docs/events.mdfrom a pagination-only note into afull contract doc for both routes, with examples and an error-codes
table.
implemented (
nextCursor, boundedlimit, cursor validation) prior tothis change. This PR documents and hardens it rather than re-adding it.
Test plan
npm run buildnpm run lintnpm test— targeted run ofevents-endpoint.test.js,events-pagination.test.js,events-query-validation.test.js,etag-events-stats.test.js,routes/operational.test.js: 31/31passing.
Note
Stacked on #406 and #407 for the same reason noted there (main's broken
package.json); the events-specific change issrc/routes/events.ts,docs/events.md, and the new test file.