Skip to content

feat: sandbox environment for testing dataset uploads - #26

Merged
neuromechanist merged 4 commits into
mainfrom
dev
Jan 17, 2026
Merged

neuromechanist merged 4 commits into
mainfrom
dev

Conversation

@neuromechanist

Copy link
Copy Markdown
Contributor

Summary

Implements sandbox environment for testing dataset uploads, resolving #16.

What's included:

Sandbox Training (PR #24)

  • nemar sandbox command for mandatory training before real uploads
  • Generates minimal BIDS test dataset (~500KB)
  • Uploads to sandbox S3 path (s3://nemar/sandbox/xx000xxx/)
  • Tracks completion status in backend

E2E Testing & Sandbox Restrictions (PR #25)

  • E2E tests that install CLI from npm and run against sandbox
  • Tests: version, help, auth status, dataset validate, dataset list
  • Sandbox restrictions: 10MB file size limit, DOI blocking
  • POST /admin/regenerate-iam/:username endpoint for IAM recovery

Implementation Checklist from #16

Backend:

  • Sandbox detection (xx prefix pattern)
  • Separate S3 prefix for sandbox
  • Presigned URL generation for sandbox path
  • File size validation (10MB limit)
  • DOI creation blocked for sandbox datasets

CLI:

  • nemar sandbox command
  • nemar sandbox status / nemar sandbox reset
  • Upload gating (requires sandbox completion)

Testing:

  • Sample BIDS test dataset (generated)
  • E2E test suite (e2e-sandbox.test.ts)
  • CI workflow for automated testing

Basic Functions Tested:

  • nemar auth status
  • nemar dataset validate
  • nemar dataset upload (via sandbox)
  • nemar dataset list --mine

Test plan

  • E2E tests pass in CI
  • Sandbox training flow works
  • File size limits enforced
  • DOI creation blocked for sandbox

Closes #16

Sandbox Training:
- Add sandbox training command for first-time users
- Create sample BIDS dataset with EDF files
- Guide users through upload workflow before real datasets
- Require sandbox completion before first upload

npm CI Publishing:
- Add OIDC trusted publishing workflow (npm-publish.yml)
- Publish dev tag on dev branch push
- Publish PR{number} tag on feature branch push (with PR)
- Auto-comment on PRs with install instructions
- Upgrade npm to v11+ for OIDC support

Backend:
- Add sandbox dataset validation and filtering
- Improve error handling with warnings array
- Filter sandbox datasets from public listings
…trictions

* feat: add E2E sandbox tests and regenerate-iam endpoint

E2E Tests:
- Add e2e-sandbox.test.ts that installs CLI from npm and tests
- Update test workflow to run on PRs to dev and main
- Test basic CLI commands, validation, and sandbox training

Admin Endpoint:
- Add POST /admin/regenerate-iam/:username endpoint
- Regenerates IAM credentials for existing users
- Restores access to all existing datasets
- Useful for fixing IAM setup issues or rotating credentials

API:
- Add regenerateUserIam function to CLI API lib

* fix: correct E2E test config and BIDS validation

- Fix config directory path (nemar-cli -> nemar)
- Fix config key name (apiToken -> apiKey)
- Add username to config for --mine filter
- Simplify BIDS dataset to minimal valid structure

* fix: add Deno setup and improve E2E test debugging

- Add Deno setup to e2e-sandbox job for BIDS validation
- Add retry loop to wait for npm publish before installing
- Add stderr output on test failures for debugging

* fix: use NEMAR_CONFIG_DIR for reliable config path in E2E tests

* feat: add sandbox file size limit and block DOI creation for sandbox

- Limit sandbox datasets to 10MB total file size
- Return 400 error if sandbox file size exceeds limit
- Block DOI concept creation for sandbox datasets (xx prefix)
- Block DOI version publishing for sandbox datasets
- Sandbox datasets are for testing only, not real data storage

* fix: address PR review findings

- Add warning annotation for workflow fallback to dev tag
- Log actual error in test cleanup catch block
- Add missing datasets_restored field to RegenerateIamResponse

* feat: add sandbox upload support to e2e-upload tests

- Add TEST_SANDBOX_DATASET_ID env var to target specific sandbox dataset
- Add TEST_CREATE_SANDBOX env var to enable actual sandbox uploads
- Add test for sandbox upload with xx prefix datasets
- Default behavior remains dry-run only (safe for CI)

This branch was previously deployed

1 inactive deployment
npm — 02cca249 Deployed Jan 17, 2026 by neuromechanist
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.

feat: sandbox environment for testing dataset uploads

1 participant