Skip to content

Epic: data.nemar.org follow-ups from website integration (#514) - #519

Merged
neuromechanist merged 6 commits into
devfrom
feature/issue-514-epic-website-followups
May 16, 2026
Merged

neuromechanist merged 6 commits into
devfrom
feature/issue-514-epic-website-followups

Conversation

@neuromechanist

Copy link
Copy Markdown
Contributor

Closes #514. Bundles the four phase PRs (#513, #512, #511, #503) that surfaced while integrating with the website redesign (nemarOrg/website#1, #4).

What ships

Phase Issue Summary
1 #513 data.nemar.org downloads of annex-keyed files now save with BIDS-shaped basenames (was: SHA256E-named) via response-content-disposition on presigned URLs.
2 #512 OpenNeuro-imported (on*) datasets get D1 metadata columns + .nemar/metadata.json populated. runDatasetSync skips only the nemar.org push for on*; metadata columns + LLM enrichment still run. Bulk reindex (--all) now includes on*.
3 #511 New scripts/hallu-qa-sync.sh mirrors /data/qumulo/openneuro/processed/<id>/ → s3://nemar/<id>/qa/ hourly. New data.nemar.org/<id>/qa/* Worker route with the same visibility / content-negotiation contract as the version route.
4 #503 Publisher canary in generateManifest: HEAD-checks up to 5 git:-keyed paths against raw.githubusercontent.com after building the manifest. Throws if any blob is missing, so a broken manifest never reaches S3.

Diff stat

12 files changed, 1887 insertions(+), 98 deletions(-)

New files: scripts/hallu-qa-sync.sh.
Modified: 4 backend services, 2 routes, the CLI import-openneuro orchestrator, 4 test files.

Test plan

  • All phase unit tests pass (44 + 26 + 109 + 108 across the 4 phase branches)
  • Backend tsc --noEmit clean on each phase
  • Each phase PR (Phase 1: force BIDS filenames on data.nemar.org downloads (#513) #515-Phase 4: publisher canary for git:-keyed manifest entries (#503) #518) had CI green before squash-merge
  • Each phase received a focused self-review pass; real findings fixed before merge:
    • Phase 1: trailing-slash defensive in basename derivation
    • Phase 2: NEMAR credentials check deferred to non-skip branch
    • Phase 3: visibility gate added to /<id>/qa 308 redirect
    • Phase 4: no findings beyond what was already addressed
  • After deploy: verify each phase's acceptance criteria (per the individual PR descriptions and the four sub-issues)
  • After deploy: run nemar admin reindex --all to backfill existing on* datasets with metadata columns (Phase 2 follow-through)
  • After deploy: install the hourly cron on hallu (Phase 3 ops follow-through)

Operational follow-ups (non-blocking)

  • Backfill on* datasets: nemar admin reindex --all once deployed (touches ~30 datasets).
  • Cron install on hallu: add 15 * * * * /path/to/nemar-cli/scripts/hallu-qa-sync.sh >> /data/qumulo/openneuro/.nm-qa-sync-cron.log 2>&1.

Related

* Force BIDS filenames on data.nemar.org downloads (#513)

Annex-keyed presigned URLs now carry response-content-disposition with the BIDS basename so browsers, rclone, aria2c and curl save SHA256E-...bdf as sub-XX_task-Y_emg.bdf. RFC 6266 attachment value carries both an ASCII filename= (sanitised for the quoted-string) and an RFC 5987 filename*=UTF-8'' extension for non-ASCII names. Disposition emits with no inter-token whitespace so the value survives aws4fetch's URLSearchParams round-trip (form-encoded + vs %20) intact.

* Phase 1 review: clarify encoder + pin invariants

Apply Phase 1 code-reviewer feedback on PR #515: explain why response-content-disposition must be URL-encoded before signing (escape ;=&# from breaking URL parsing), add a regression test for top-level annex bidsPath, and pin that response-content-disposition appears before X-Amz-Signature so a future refactor that appends after signing fails loudly.

* Phase 1 review: harden basename derivation against trailing-slash bidsPath
…512) (#516)

* Backfill OpenNeuro import metadata + lift on* reindex block (#512)

Three coordinated changes so freshly imported on* datasets get the same right-rail / catalog data as nm* datasets:

- runDatasetSync no longer throws hard for on*; it skips only the nemar.org push (which still needs alternate_id mapping) and keeps writing D1 metadata columns + sync status. Surfaced via new result.nemar_sync_skipped flag and a 'skipped' status in the admin reindex response.
- buildReindexFilterQuery includes on* in 'all', 'missing-metadata', and 'stale' filters. Sandbox (xx*) stays excluded.
- import-openneuro CLI seedMetadata expands the .nemar/metadata.json payload: bids_version, recording_modality + datatypes from a sub-*/datatype/ filesystem scan, funding_references from Funding, acknowledgements when present. After publication-approve the orchestrator now calls reindexDataset() so D1 metadata columns + LLM enrichment populate for the new dataset.

Existing on* datasets backfill via 'nemar admin reindex --all' once deployed.

* Phase 2: update runDatasetSync docstring for on* skip

* Phase 2 review: defer NEMAR creds check to non-skip branch
…#511) (#517)

* Add QA artifact sync + data.nemar.org/<id>/qa/* route (#511)

Companion to hallu-sync.sh that mirrors /data/qumulo/openneuro/processed/<id>/ to s3://nemar/<id>/qa/ on an hourly cron (offset 15 min from the bytes sync). Skips pipeline internals (code/, logs/, *.mat) and uses a newest-mtime fingerprint to skip unchanged datasets idempotently.

Worker route exposes the tree at data.nemar.org/<id>/qa/*: 302 to a presigned S3 GET for files (whose keys are already BIDS-shaped, so no Content-Disposition override is needed), directory listings with the same JSON / HTML content negotiation as the version route, and the visibility gate that suppresses any leak for private/unknown datasets. resolveQaPath uses ListObjectsV2 with delimiter=/ to distinguish files from directories in a single round-trip and rejects path traversal via the same normalizeBidsPath contract the manifest-backed route uses.

* Phase 3 review: gate /<id>/qa 308 on visibility check
Option 1 from the issue. After generateManifest builds the file map, HEAD-check a small sample of the git:-keyed URLs on raw.githubusercontent.com pinned to the version tag. If any return non-200, throw GitBackedFileMissingError so the publication workflow fails LOUDLY instead of writing a manifest that would later 302->404 on data.nemar.org.

Sampling: dataset_description.json (always when present) + up to 4 additional git: paths in deterministic sorted order. Caps the Worker subrequest cost at 5 HEADs in the happy path. A single 2-second retry per failing canary absorbs raw.githubusercontent.com CDN propagation lag after a fresh tag push; real missing-blob failures stay failed across both attempts.

selectGitBackedCanaries is exported and pinned by unit tests so the sampling matrix is legible.
@github-actions

github-actions Bot commented May 16, 2026 •

Copy link
Copy Markdown

📦 Package Preview

Your package is ready to test!

bun install -g nemar-cli@PR519

Version: 0.8.18-PR519.809f45c
Commit: 809f45c


🤖 Updated on each push.

The Phase 4 canary in generateManifest HEADs raw.githubusercontent.com for git:-keyed paths, which broke the pre-existing manifest-small-root-files.test.ts: that test mocks getTreeAtRef + getBlobContent with synthetic data, so the canary 404s against the real internet for fake repo/tag/blob combinations.

Add an optional GenerateManifestOptions.skipGitBackedVerification that suppresses the canary when set. Production callers (webhooks + admin publish) never set it; the 4 affected tests now pass true. Caught by unit-test-all on the epic→dev PR before merge.

This branch was previously deployed

1 inactive deployment
npm — 809f45cd Deployed May 16, 2026 by neuromechanist via publish #942
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