Skip to content

fix(research): reject --page/--limit and --sort on subcommands that don't support them#442

Merged
kome12 merged 1 commit into
mainfrom
fix/research-reject-unsupported-flags
May 18, 2026
Merged

fix(research): reject --page/--limit and --sort on subcommands that don't support them#442
kome12 merged 1 commit into
mainfrom
fix/research-reject-unsupported-flags

Conversation

@kome12
Copy link
Copy Markdown
Contributor

@kome12 kome12 commented May 18, 2026

Summary

Two nansen research subcommands silently dropped flags that they could not honour, giving the caller no feedback that their options were ignored:

  • historical-token-flow-summary accepted --page / --limit but never forwarded pagination to the API. The underlying endpoint (TGMHistoricalTokenFlowSummaryRequest, extra='forbid') has no pagination field — it always returns a single aggregated row.
  • historical-smart-money-balances accepted --sort / --order-by but never forwarded order_by to the API. The underlying router handler hard-codes order_by=None — sort is unsupported end-to-end.

Fix

Both subcommands now throw INVALID_PARAMS before making any API call when the unsupported flag is present:

  • historical-token-flow-summary + --page/--limit → error: "does not support --page or --limit (endpoint returns a single aggregated row)"
  • historical-smart-money-balances + --sort/--order-by → error: "does not support --sort or --order-by (endpoint does not support ordering)"

The global help text for --page/--limit and --sort now notes the exceptions. Per-subcommand help text already called these out.

Test plan

  • npm test — all 1475 tests pass (2 new regression tests added, one per case)
  • node src/index.js research historical-token-flow-summary --token-address 0x123 --from-date 2026-04-01 --to-date 2026-04-05 --page 2 exits non-zero with a clear error
  • node src/index.js research historical-smart-money-balances --as-of-date 2026-04-05 --sort value_usd:desc exits non-zero with a clear error

🤖 Generated with Claude Code

…on't support them

historical-token-flow-summary silently dropped --page/--limit; it now throws
INVALID_PARAMS immediately (endpoint returns a single aggregated row).
historical-smart-money-balances silently dropped --sort/--order-by; it now
throws INVALID_PARAMS immediately (endpoint does not support ordering).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@kome12 kome12 self-assigned this May 18, 2026
@kome12 kome12 marked this pull request as ready for review May 18, 2026 07:05
@kome12 kome12 requested review from TimNooren and gulshngill May 18, 2026 07:39
@kome12 kome12 merged commit 97ed105 into main May 18, 2026
7 checks passed
@kome12 kome12 deleted the fix/research-reject-unsupported-flags branch May 18, 2026 07:41
@github-actions github-actions Bot mentioned this pull request May 18, 2026
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.

1 participant