Skip to content

fix: validate spot history --limit upper bound (max 15) - #33

Open
auroraxo wants to merge 2 commits into
jup-ag:mainfrom
auroraxo:fix/spot-history-limit-upper-bound
Open

auroraxo wants to merge 2 commits into
jup-ag:mainfrom
auroraxo:fix/spot-history-limit-upper-bound

Conversation

@auroraxo

Copy link
Copy Markdown

Closes #22

docs/spot.md documents --limit for jup spot history as defaults to 10, max 15, but the command only rejected non-positive values. --limit 1000 was passed straight through to the API and silently clamped downstream (DatapiClient.getSwapsByAddress does Math.min(limit, 30)), so the user never saw an error even though they asked for far more than documented.

This rejects --limit > 15 before any network call, mirroring the existing lower-bound check:

$ jup spot history --limit 1000
Error: --limit must be between 1 and 15.

Verified locally: tsc --noEmit clean, oxlint src clean, prettier --check src clean. bun test not run here — bun is not installed in this environment; happy to add a unit test if the maintainers would like one.

References:

  • docs/spot.md:149 --limit defaults to 10, max 15
  • src/clients/DatapiClient.ts:150 Math.min(params.limit, 30) (silent clamp)
  • src/commands/SpotCommand.ts:613 (previously only rejected limit <= 0)

Aurora added 2 commits October 17, 2026 07:26
docs/spot.md documents --limit as 'defaults to 10, max 15', but the
command only rejected non-positive values, so --limit 1000 was sent
to the API and silently clamped downstream. Reject values above 15
with a clear error before any network call.

Closes jup-ag#22
Add a unit test for the upper bound added in 1d4bf0c and the existing
lower-bound check. All 76 tests pass locally, plus fmt/lint/typecheck.

Also install bun locally so the full 'bun run ci' suite is now verified
before future pushes.
@auroraxo

Copy link
Copy Markdown
Author

Added a unit test in 877d2f2 covering the new upper bound and the existing lower bound:

$ bun test src/commands/SpotCommand.test.ts
(pass) rejects limit above the documented maximum of 15
(pass) rejects non-positive and non-numeric limits
2 pass, 0 fail

Full local CI also green: bun run ci (fmt:check, lint, typecheck, test) → 76 pass / 0 fail.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing upper bound validation for --limit in spot history

1 participant