Skip to content

fix(research): warn when unsupported --sort or --page/--limit flags are passed#441

Closed
kome12 wants to merge 1 commit into
mainfrom
fix/research-warn-unsupported-flags
Closed

fix(research): warn when unsupported --sort or --page/--limit flags are passed#441
kome12 wants to merge 1 commit into
mainfrom
fix/research-warn-unsupported-flags

Conversation

@kome12
Copy link
Copy Markdown
Contributor

@kome12 kome12 commented May 18, 2026

Summary

Two `nansen research historical-*` subcommands silently ignored flags without any feedback to the caller:

  • `historical-token-flow-summary` accepted `--page`/`--limit` in its CLI options but the handler never forwarded them to the API. Callers had no indication their pagination flags were being dropped.
  • `historical-smart-money-balances` accepted `--sort` in its CLI options but the handler never forwarded it to the API. Callers had no indication their sort flag was being dropped.

Fix

Added `process.stderr.write()` warnings (matching the existing `⚠️` pattern used elsewhere in the codebase) that fire when the unsupported flag is detected:

  • `historical-token-flow-summary` + `--page`/`--limit` → warns: `⚠️ warning: --page/--limit is ignored by historical-token-flow-summary (endpoint does not support pagination)`
  • `historical-smart-money-balances` + `--sort` → warns: `⚠️ warning: --sort is ignored by historical-smart-money-balances (endpoint does not support order_by)`

Warnings go to stderr so they don't pollute JSON stdout output. The API call still succeeds — callers get data, plus a clear signal that the flag had no effect.

Tests

Added two regression tests in `src/tests/research.test.js`:

  1. Calls `historical-token-flow-summary` with `--page 2 --limit 5` and asserts a matching warning was written to stderr.
  2. Calls `historical-smart-money-balances` with `--sort value_usd:desc` and asserts a matching warning was written to stderr.

Both new tests pass alongside all 1475 existing tests (2 pre-existing skips unchanged).

Affected flag combinations

Subcommand Silently ignored flag Now warns
`historical-token-flow-summary` `--page`, `--limit`
`historical-smart-money-balances` `--sort`, `--order-by`

🤖 Generated with Claude Code

…re passed

historical-token-flow-summary silently dropped --page/--limit; historical-smart-money-balances silently dropped --sort. Both now emit a warning to stderr so callers know their flag had no effect.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@kome12 kome12 self-assigned this May 18, 2026
@kome12
Copy link
Copy Markdown
Contributor Author

kome12 commented May 18, 2026

Closing — the fix approach was wrong. The correct fix is to reject the unsupported flags with a clear error rather than silently warning, since these flags have no effect at the API level.

@kome12 kome12 closed this 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