Repository navigation
Warn when pulling a dataset still being ported - #470
Conversation
PR Review: #470 — Warn when pulling a dataset still being portedCritical1. False negative in In the 2. Marker JSDoc comment misleads: The JSDoc says "if any commit ever touched Important3. No escape hatch for automation or power users
4. Permanent false-positive if The marker is coupled to a single importer's commit convention. Any future mechanism that creates a dataset with 5. Confusing retry hint in When the marker is absent in 6. "~5 minutes" retry hint is inaccurate for large datasets The importer can take 25+ minutes (5-minute polling intervals × 5 publication attempts). Users who retry at 5 minutes and find it still incomplete may conclude the dataset is broken. Change to "Retry in a few minutes" or link to Suggestions7. When 8. Missing test: marker committed then removed via The four tests cover absent/present/working-tree-only/non-git-dir. Missing: marker committed, then deleted with Nice-to-haves9. Verbose logging when marker result is If False Positives / Intentional Decisions
Summary: 2 critical, 4 important, 2 suggestions, 1 nice-to-have. The most actionable immediate fixes are items 1 (API-fail false-negative in |
- fix: API-fail false-negative in get: fall back to reading local .nemar/metadata.json when backend is unreachable so port check fires even offline - fix: update detectImportMarker JSDoc to clarify -1 semantics (most recent commit, not any-commit) and add forward-compat note - feat: add --skip-port-check to both download and get commands so admins and automation can bypass the check - fix: replace misleading retry hint in download; clone already exists, instruct user to wait then run get from that dir - fix: replace "~5 minutes" with "5-30 minutes depending on size" in both commands - docs: add unknown-case comment at both call sites - test: add git-rm deletion case for detectImportMarker
Review findings addressed (commit b15eef0)Critical#1 API-fail false-negative in `get`: When `getDataset()` throws (unreachable backend), `apiReachable` is now tracked separately. If the API failed and `dsInfo?.source` did not resolve, the code reads `.nemar/metadata.json` from local disk and checks `source` from there. The port check fires even offline; only a fully malformed local metadata file silently skips it. The bare `catch {}` comment is updated accordingly. #2 JSDoc misleads on `-1` vs "any commit ever touched": The inner comment now reads "returns the most recent commit that touched `.nemar/metadata.json`". The Returns block clarifies "non-empty `git log -1` output". A forward-compatibility note is added warning about future `source="openneuro"` setters that bypass the importer's commit convention (with a TODO referencing #460). Important#1 No escape hatch: `--skip-port-check` added to both `download` and `get`. Shown in the error output so users know it exists. #3 Misleading retry hint in `download`: "Retry the download in ~5 minutes" replaced with: "The metadata-only clone is already at the path above. Wait 5–30 minutes…, then run: `cd && nemar dataset get`." #4 "~5 minutes" too optimistic: Changed to "5–30 minutes (depending on dataset size)" in both `download` and `get`. Suggestions addressed#7 `unknown` falls through silently: Added inline comment "unknown = git unavailable or non-git dir; skip port check and let git-annex handle it" at both call sites. #8 Missing test for git-rm deletion case: Added test "marker committed then deleted via git rm still returns 'present'" — verifies `git log -1` returns the deletion commit hash rather than empty output. Not addressed
All 15 tests pass. Build clean. |
📦 Package PreviewYour package is ready to test! bun install -g nemar-cli@PR470Version: 🤖 Updated on each push. |
Closes #460.
What changed
nemar dataset download <id>andnemar dataset getagainst an OpenNeuro-imported dataset whose porting workflow is still mid-flight used to fail with a crypticgit annex geterror (typically "remote unavailable" / "no known location"). The user reported the bug as "pulling data after porting fails" — they had no way to tell whether the dataset was broken or simply not done copying yet.Fix is scoped to the client-side warning path the brief recommended:
detectImportMarker(datasetPath)insrc/lib/git-annex.ts. Inspects the local clone's git history for any commit that touched.nemar/metadata.json(the importer always emits one as its final step before pushing — seesrc/lib/import-openneuro.tsstep 6). Returnspresent/absent/unknown.nemar dataset downloadchecks the marker after clone, only when the resolved dataset record hassource === "openneuro". If absent, prints a clear "Porting still in progress" warning with a retry hint and exits non-zero before requesting download credentials or runninggit annex get.nemar dataset getdoes the same check after fetching dataset info from the backend.Why marker absence is a reliable signal: the importer pushes main and git-annex branches atomically (step 7), so by the time the metadata commit is visible in the clone, the S3 copy (step 5) has already completed. A clone without the marker is either an empty
auto_init: falseshell (repo created but importer hasn't pushed) or a partially-pushed history (the importer aborts on partial push, so this should not exist in practice; if it ever does we still bail with a useful message rather than letting git-annex throw).Scope decisions
status='importing'flag on thedatasetsrow and gate the warning on that for a more precise signal.git annex get, so we never need to parse its error output for this case. If a different "objects not in S3" failure mode shows up (e.g., S3 ACL drift on a published dataset), that's a separate issue.source === "openneuro".Test plan
test/git-helpers.test.tsfordetectImportMarker:absent.nemar/metadata.json->presentabsent(guards a false-positive)unknownbun test test/git-helpers.test.ts-> 14/14 passbun run buildsucceedsbun run typecheckclean