Skip to content

feat(events): reject unknown query params, extract query parsing helper - #408

Merged
mikewheeleer merged 3 commits into
Agentpay-Org:mainfrom
thlpkee20-wq:feature/events-01-group
Jul 28, 2026
Merged

feat(events): reject unknown query params, extract query parsing helper#408
mikewheeleer merged 3 commits into
Agentpay-Org:mainfrom
thlpkee20-wq:feature/events-01-group

Conversation

@thlpkee20-wq

Copy link
Copy Markdown
Contributor

Summary

Closes #396
Closes #395
Closes #393
Closes #392

Test plan

  • npm run build
  • npm run lint
  • npm test — targeted run of events-endpoint.test.js,
    events-pagination.test.js, events-query-validation.test.js,
    etag-events-stats.test.js, routes/operational.test.js: 31/31
    passing.

Note

Stacked on #406 and #407 for the same reason noted there (main's broken
package.json); the events-specific change is src/routes/events.ts,
docs/events.md, and the new test file.

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.
@mikewheeleer

Copy link
Copy Markdown
Contributor

neat work @thlpkee20-wq — thanks for the care. merging 🌱

@mikewheeleer
mikewheeleer merged commit ebee93f into Agentpay-Org:main Jul 28, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants