You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Review completed. Please address the findings below.
Findings by Severity
Severity
Count
🟡 Medium
1
🔵 Low
1
Review effort: 3/5 (Moderate)
Summary
This PR cleanly exposes eight new public API endpoints as nansen research subcommands. The implementation follows existing patterns throughout — consistent use of requireOptions, buildPagination, parseTimeframeDays, parseSort, mocked unit tests, and schema.json updates. Changeset semver (minor) is correct. Two issues worth addressing:
Findings
src/commands/research.js — Medium
historical-token-ohlcv mutual-exclusivity guard fires with a misleading error when neither anchor is omitted
The check on line 315 is:
if(Boolean(asOfDate)===Boolean(asOfTs)){thrownewNansenError('Provide exactly one of --as-of-date or --as-of-ts', ...);}
When neither--as-of-date nor --as-of-ts is supplied, both are undefined, so Boolean(undefined) === Boolean(undefined) is true and the guard fires. The user sees "Provide exactly one of --as-of-date or --as-of-ts" rather than "one of --as-of-date or --as-of-ts is required". The test at line 210 only covers the "both provided" path.
Suggested fix: split the check:
if(!asOfDate&&!asOfTs){thrownewNansenError('Provide one of --as-of-date or --as-of-ts',ErrorCode.MISSING_PARAM);}if(asOfDate&&asOfTs){thrownewNansenError('--as-of-date and --as-of-ts are mutually exclusive',ErrorCode.INVALID_PARAMS);}
Also add a test case for the "neither provided" path.
src/commands/research.js — Low
PUBLIC_API_SUBCOMMANDS is missing historical-token-ohlcv
historical-token-ohlcv lives in HISTORICAL_SUBCOMMANDS and is handled by its own if block before the rangeTokenHandlers dispatch table — functionally correct. However the new PUBLIC_API_SUBCOMMANDS array contains only 7 items while 8 are described as "public API" in the PR description. The naming is slightly misleading since historical-token-ohlcv is a new public API endpoint. This is cosmetic, but if a future reviewer needs to know "which new endpoints came from the public API docs", the grouping is subtly wrong.
If the split is intentional (historical anchor semantics belong with the other historical-* commands), a brief comment explaining the choice would prevent confusion.
New pushes are reviewed automatically with a 10-minute cooldown between reviews. To request a review at any time, comment @nansen-pr-reviewer re-review.
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
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
nansen researchsubcommandsValidation
npm test -- --reporter=dot— 2,571 passed, 2 skippednpm run lintgit diff --check