Skip to content

Fix OpenNeuro import failing on datasets with old git history - #261

Merged
neuromechanist merged 5 commits into
devfrom
fix/openneuro-whereis-orphan-keys
Mar 8, 2026
Merged

neuromechanist merged 5 commits into
devfrom
fix/openneuro-whereis-orphan-keys

Conversation

@neuromechanist

Copy link
Copy Markdown
Contributor

Summary

  • Changed git annex whereis --all to git annex whereis -- . in getAnnexWhereisAll() to only query files in the current working tree
  • --all includes orphaned keys from old git revisions that have no S3 location info, causing whereis to exit non-zero and abort the entire import
  • Added graceful handling for non-zero exit codes (warn and continue with available files)

Verified locally:

  • ds000117: 1991/1991 files resolve (was 718 failures with --all due to 606 commits of history)
  • ds007176: 900/900 files resolve (was 3 failures with --all)

Test plan

  • Verified ds000117 and ds007176 both resolve all current-tree files with -- .
  • Verified OpenNeuro S3 URLs include required versionId parameter
  • Build passes
  • Re-run onboard workflow for ds000117 and ds007176 after merge and CLI publish

Use "-- ." instead of "--all" in git annex whereis to only query
files in the current working tree. --all includes orphaned keys
from old git history that have no S3 location info, causing
spurious failures (ds000117: 718 failures, ds007176: 3 failures).

Also handle non-zero exit gracefully when some files lack location
info, logging a warning instead of aborting.
@github-actions

github-actions Bot commented Mar 8, 2026 •

Copy link
Copy Markdown

📦 Package Preview

Your package is ready to test!

bun install -g nemar-cli@PR261

Version: 0.7.14-PR261.8243c8e
Commit: 8243c8e


🤖 Updated on each push.

By default, `nemar admin import-openneuro` now dispatches the
onboard-openneuro.yml workflow on nemarDatasets/.github via gh CLI.
Supports comma-separated IDs for parallel imports. Use --local to
run the import locally (previous behavior).
- Only tolerate expected "whereis: N failed" pattern; throw on
  unexpected errors (permissions, corruption, I/O)
- Validate --dir/--skip-data require --local flag
- Fix stale JSDoc referencing --all
- Use else-if for clearer control flow
@neuromechanist

Copy link
Copy Markdown
Contributor Author

PR Review Findings

Ran code-reviewer, silent-failure-hunter, and code-simplifier agents in parallel.

Critical (fixed in 51e8805)

  • Unexpected errors masked as warnings (git-annex.ts) - Non-zero exit with unexpected stderr (permissions, corruption, I/O) was being downgraded to a benign warning. Now only tolerates the expected whereis: N failed pattern; any other non-zero exit throws.

Important (fixed in 51e8805)

  • Stale JSDoc (git-annex.ts:2455) - Still referenced --all --json after changing to -- .
  • --dir/--skip-data silently ignored without --local (admin.ts) - Added validation that these flags require --local
  • Sequential if blocks (git-annex.ts) - Changed to else if to make mutual exclusion explicit

Low / Skipped (not false positives, but acceptable risk)

  • Fire-and-forget workflow dispatch - low risk; monitor URL is printed
  • No gh binary existence check - error message from runCommand is clear enough
  • console.warn interleaving with ora spinners - warn fires before spinner resumes, acceptable
  • Pre-existing empty catch block in collectFileManifest - out of scope for this PR

@neuromechanist
neuromechanist merged commit db804dc into dev Mar 8, 2026
8 checks passed
@neuromechanist neuromechanist mentioned this pull request Mar 10, 2026
2 tasks done

This branch was previously deployed

1 inactive deployment
npm — 8243c8e4 Deployed Mar 8, 2026 by neuromechanist via publish #440
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