Skip to content

feat: sandbox environment for testing dataset uploads #16

Closed

Description

@neuromechanist

Problem

We lack end-to-end testing for the dataset upload flow. Users encounter errors that we don't catch during development because:

  1. No automated tests for the full upload workflow
  2. No safe sandbox environment for users to experiment
  3. No way to test without affecting production data

Proposed Solution

Create a sandbox environment with the following characteristics:

Sandbox Datasets (xx000xxx pattern)

  • Dataset IDs matching xx000xxx pattern are sandbox datasets
  • Stored under s3://nemar/sandbox/ instead of production paths
  • DOI creation (final approval) is disabled
  • Files limited to <10MB size
  • Can be deleted/cleaned up periodically

Testing Scripts

Create a test suite that validates:

Basic Functions (smoke tests):

  • nemar auth login / nemar auth status
  • nemar dataset validate on sample BIDS dataset
  • nemar dataset upload (to sandbox)
  • nemar dataset download (from sandbox)
  • nemar dataset list --mine

Extended Functions:

  • nemar dataset request-access
  • nemar dataset invite
  • nemar admin approve / nemar admin revoke
  • Presigned URL generation and upload
  • Git-annex URL registration
  • GitHub repo creation and branch protection

Sample Test Dataset

Create a small (<50MB) BIDS-compliant test dataset with:

  • A few EDF/BDF files (small recordings)
  • Required metadata (dataset_description.json, participants.tsv, etc.)
  • Stored in repo or downloadable for testing

Implementation Steps

  1. Add sandbox detection to backend (check dataset_id pattern)
  2. Configure separate S3 prefix for sandbox
  3. Modify presigned URL generation for sandbox path
  4. Add file size validation for sandbox uploads
  5. Block DOI creation for sandbox datasets
  6. Create sample BIDS test dataset
  7. Write test scripts using the sample dataset
  8. Add CI workflow to run tests periodically

Benefits

  • Catch integration issues before users do
  • Safe playground for new users to learn
  • Automated regression testing
  • Validate each release works end-to-end

Related

Activity

  1. neuromechanist commented on Jan 16, 2026

    @neuromechanist
    ContributorAuthor

    Implementation Plan Summary

    Workflow Overview

    Before uploading real datasets:

    1. User logs in with nemar auth login
    2. Welcome message shows: "To upload datasets, first complete sandbox training with nemar sandbox"
    3. User runs nemar sandbox
    4. CLI generates a placeholder BIDS dataset (~500KB) with random EDF data
    5. CLI uploads to sandbox S3 path (s3://nemar/sandbox/xx000xxx/)
    6. On success, backend marks sandbox_completed=true
    7. User can now upload real datasets with nemar dataset upload

    If user tries to upload without sandbox:

    • CLI checks sandbox_completed flag
    • Blocks upload with message: "Complete sandbox training first: nemar sandbox"

    Commands

    nemar sandbox           # Run sandbox training
    nemar sandbox status    # Check if completed
    nemar sandbox reset     # Reset for re-testing

    Placeholder Dataset Structure

    sandbox-dataset/
    ├── dataset_description.json    # ~200 bytes
    ├── participants.tsv            # ~50 bytes  
    ├── README                      # ~100 bytes
    ├── sub-01/
    │   └── eeg/
    │       ├── sub-01_task-rest_eeg.edf    # ~500KB random noise
    │       └── sub-01_task-rest_eeg.json   # sidecar
    

    Total size: ~500KB (quick upload, enough to test full S3 pipeline)

    Key Benefits

    1. Setup verification: Confirms DataLad, git-annex, GitHub SSH, and S3 all work
    2. User onboarding: Familiarizes users with upload workflow before their real data
    3. Safe testing: Uses separate sandbox S3 path and xx000xxx dataset IDs
    4. E2E testing: We can use sandbox for automated testing too

    Backend Changes

    • Add sandbox_completed, sandbox_completed_at, sandbox_dataset_id to users table
    • Add sandbox type to id_sequence for xx000xxx IDs
    • Modify /datasets to accept sandbox: true flag
    • Add /sandbox/complete and /sandbox/reset endpoints

    Work in progress on branch feature/sandbox-training.

  2. neuromechanist commented on Jan 17, 2026

    @neuromechanist
    ContributorAuthor

    Progress Update

    PR #24 (merged to dev) implemented the sandbox training feature which addresses several items:

    Completed ✅

    Sandbox Datasets:

    • Dataset IDs matching xx###### pattern are sandbox datasets
    • Stored under s3://nemar/staging/sandbox/ instead of production paths
    • Sandbox datasets filtered from public listings

    Testing Scripts - Basic Functions:

    • nemar dataset validate on sample BIDS dataset (sandbox creates sample)
    • nemar dataset upload (to sandbox)
    • Presigned URL generation and upload
    • Git-annex URL registration
    • GitHub repo creation and branch protection

    Sample Test Dataset:

    • Create sample BIDS test dataset dynamically with EDF files

    Implementation Steps:

    • Add sandbox detection to backend (check dataset_id pattern)
    • Configure separate S3 prefix for sandbox
    • Modify presigned URL generation for sandbox path
    • Create sample BIDS test dataset

    Still Pending ⏳

    Testing Scripts:

    • nemar auth login / nemar auth status
    • nemar dataset download (from sandbox)
    • nemar dataset list --mine
    • nemar dataset request-access
    • nemar dataset invite
    • nemar admin approve / nemar admin revoke

    Implementation:

    • Add file size validation for sandbox uploads (<10MB)
    • Block DOI creation for sandbox datasets
    • Write comprehensive test scripts
    • Add CI workflow to run tests periodically
    • Periodic cleanup of sandbox datasets
  3. neuromechanist commented on Jan 17, 2026

    @neuromechanist
    ContributorAuthor

    Related: PR #24 (squash merged to dev as commit 6d2215e)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions