Skip to content

Release v0.7.23: list pagination, owner filter, ds->on download - #321

Merged
neuromechanist merged 2 commits into
mainfrom
dev
Mar 21, 2026
Merged

neuromechanist merged 2 commits into
mainfrom
dev

Conversation

@neuromechanist

Copy link
Copy Markdown
Contributor

Summary

  • Dataset list pagination: default 20 results/page with -n/--limit, --page, --offset, --all options. Shows "1-5 of 493" style header and pagination footer.
  • --owner filter: nemar dataset list --owner yahya filters by dataset owner
  • Download ds->on redirect: when downloading ds###### (OpenNeuro), checks for NEMAR on###### counterpart and offers to download from NEMAR instead (git-annex version tracking)
  • Backend: GET /datasets returns total_count, supports owner param; new GET /datasets/resolve/:sourceId endpoint
  • Security: resolve endpoint restricted to public datasets; input validation on source IDs

Test plan

  • All CI checks pass (unit, API, lint, E2E sandbox)
  • Dev backend deployed and tested
  • nemar dataset list -n 5 shows "1-5 of 493" with pagination footer
  • nemar dataset list --page 2 shows next page
  • nemar dataset list --owner yahya filters correctly
  • nemar dataset list --all shows all (up to 200)
  • nemar dataset list --json returns { datasets, total_count, limit, offset }
  • /datasets/resolve/ds007315 returns structured response
  • /datasets/resolve/invalid returns 400 with validation error

* Add list pagination, --owner filter, ds->on download redirect

Backend:
- GET /datasets: add owner query param, return total_count/limit/offset
- GET /datasets: include source/source_id in managed dataset responses
- GET /datasets/resolve/:sourceId: new endpoint for ds->on lookup
- executeAndReturn: parallel COUNT query for total_count

CLI list:
- Default to 20 results per page (was 50)
- Add -n/--limit, --page, --offset, --all pagination options
- Add --owner <username> filter
- Show pagination footer with page info and next page hint
- JSON output includes total_count, limit, offset

CLI download:
- For ds###### datasets, check for on###### NEMAR counterpart
- If found, prompt user to download from NEMAR instead (git-annex)
- Falls through to OpenNeuro download if no counterpart or declined

Closes #319

* Address review: fix error handling, validation, NaN safety

- Separate API call from inquirer prompt in resolveOpenNeuroId
  so Ctrl+C propagates correctly instead of being swallowed
- Add try-catch and input validation to resolve endpoint
- Use Promise.allSettled so COUNT query failure does not crash
  the main dataset list query
- Fix NaN propagation when limit/offset are non-numeric strings
- Use != null check for limit param in API client
- Fallback query now respects user's limit/offset
- Update JSDoc to document new params and pagination response

* Address review: restrict resolve to public, block --mine + --owner

- Resolve endpoint only matches public datasets to prevent
  leaking private dataset metadata via source ID enumeration
- Remove visibility from resolve response (always public)
- Make --mine and --owner mutually exclusive with clear error

* Fix unit tests for new --json output format

The list --json output changed from a plain array to
{ datasets, total_count, limit, offset }. Update tests
to match the new pagination-aware response shape.
@neuromechanist
neuromechanist merged commit 9953591 into main Mar 21, 2026
15 checks passed

This branch was previously deployed

1 inactive deployment
npm — 0319338d Deployed Mar 21, 2026 by neuromechanist via publish #565
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