Skip to content

Release v0.8.21: enrichment description fix + ds*/on* catalog dedup - #537

Merged
neuromechanist merged 10 commits into
mainfrom
dev
May 18, 2026
Merged

neuromechanist merged 10 commits into
mainfrom
dev

Conversation

@neuromechanist

Copy link
Copy Markdown
Contributor

Release bundling two follow-ups to v0.8.20 (the #523 enrichment 522 fix). Both surfaced during post-release verification.

Fixes

#535 — OpenNeuro placeholder description survives enrichment (PR #536)

After v0.8.20 unblocked the enrichment pipeline, data.nemar.org/<id>/metadata.json still returned "Imported from OpenNeuro <ds>" as the top-level description for on* datasets. Three coordinated changes:

  • src/lib/import-openneuro.ts: stop seeding datasets.description with the placeholder at import time. OpenNeuro provenance is already encoded by source: "openneuro", source_id, and the on* dataset_id prefix.
  • src/lib/import-openneuro.ts: new appendOpenNeuroProvenance() helper writes a deterministic ## Provenance section to README.md at import time (idempotent via an HTML-comment marker). Provenance now lives on the GitHub repo where it belongs, separate from the LLM enrichment write path.
  • backend/src/services/data-router.ts: flip buildDatasetMetadata description priority to v2 ?? v1 ?? row. Protects the ~50 existing on* datasets whose D1 row still carries the legacy placeholder.

#534 — ds*/on* catalog shadows visible in /datasets listing

GET /datasets UNIONed managed + catalog rows, but the dedup join compared c.id NOT IN (SELECT dataset_id FROM datasets). Mirrored OpenNeuro datasets stored as dataset_id=on002718, source_id=ds002718 in the managed table never matched their catalog shadow id=ds002718, so both appeared in every list.

Symptom on prod: GET /datasets?q=ds000117&limit=10 returned on000117, ds000117, ds002718, ds003645 — all but the first are shadows whose on* counterparts exist.

Resolution: catalog-half query now also filters out rows whose id matches any datasets.source_id WHERE source = 'openneuro'. One-line behavioral change to the existing query.

Release flow

auto-tag.yml will strip -dev1 from package.json on merge to main, commit as nemar-bot, tag v0.8.21. npm-publish.yml ships to npm with latest. sync-dev.yml advances dev to 0.8.22-dev0. No manual version bumps in this PR.

Test plan

Follow-ups still open

nemar-bot and others added 8 commits May 18, 2026 09:35
…nance to README

The OpenNeuro importer used to set the D1 datasets.description column to
'Imported from OpenNeuro <ds>' at import time. buildDatasetMetadata then
prioritized that catalog row over the LLM-enriched v2 description, so
the placeholder survived every successful enrichment cycle and the
public metadata.json endpoint kept returning it forever — defeating the
whole point of the enrichment pipeline that v0.8.20 unblocked.

Three coordinated changes:

src/lib/import-openneuro.ts: drop the description: 'Imported from
OpenNeuro <ds>' arg from importDataset(). Provenance is already
encoded by source: 'openneuro', source_id, and the on* dataset_id
prefix; the website renders the attribution badge from those fields.
Add a new appendOpenNeuroProvenance helper that writes a deterministic
'## Provenance' section to README.md at import time (idempotent;
re-running the importer is a no-op once the marker is present). The
README is the right place for human-readable provenance — it ships
with the GitHub repo, is visible without hitting any API, and stays
out of the LLM enrichment write path.

backend/src/services/data-router.ts: flip buildDatasetMetadata's
description-priority order so the LLM-enriched v2 (or v1) description
wins over row.description, with row.description as the fallback for
datasets that have not been enriched yet. The existing v2 fallback
test stays; new tests pin the placeholder→enrichment substitution and
the no-enrichment fallback.

test/import-openneuro.test.ts: new describe block for
appendOpenNeuroProvenance covering creation, append-to-existing,
idempotency, and the no-trailing-newline edge case.

The fix is forward-looking (new on* imports never get the placeholder)
and backward-compatible (existing on* datasets in D1 still have the
stale placeholder, but the metadata.json endpoint now correctly serves
the enrichment when present).
The list endpoint's catalog UNION used a single NOT IN clause comparing
nemar_catalog.id against datasets.dataset_id. That worked for the case
where a catalog row was "promoted" into the managed table under the
same id, but missed the ds -> on mirror case entirely: mirrored rows
have dataset_id = 'on002718' while the catalog shadow keeps
id = 'ds002718', so the NOT IN never matched.

Add a second NOT IN that joins on datasets.source_id where
source='openneuro'. Catalog rows whose id appears as a managed mirror's
source_id are now hidden.

Symptom (live before this change): GET /datasets?q=ds000117 returned
on000117 plus three ds* shadows (ds000117, ds002718, ds003645) all of
which had on counterparts in the catalog. After this change the list
returns only the canonical on* rows.

Adds a regression test asserting no on* row in /datasets has its
ds* counterpart alongside it.

Refs nemarOrg/website#1 (redesign epic discover-page dedup).
The pr-review-toolkit code-reviewer flagged that the readReadme() helper
in test/import-openneuro.test.ts used a dynamic require() call instead
of the ES module import already present at the top of the file. Add
readFileSync to the existing destructure and use it directly. No
behavior change; consistent with .rules/javascript.md (ES modules only).
Fix #535: stop seeding OpenNeuro placeholder; route provenance to README
…#538)

Same anti-pattern that commit f9c22b4 fixed in appendOpenNeuroProvenance's
readReadme(). seedMetadata's readMeta() helper and the config.json read in
the 'metadata.json appears, config.json survives' test both still used a
dynamic require() instead of the readFileSync that's already destructured
at the top of the file. Flagged by the pr-review-toolkit code-reviewer
during the v0.8.21 release review; pre-existing on dev so non-blocking,
but bundling here keeps the file consistent and satisfies the
.rules/javascript.md 'ES modules only' rule.
@neuromechanist
neuromechanist enabled auto-merge May 18, 2026 10:38
@neuromechanist
neuromechanist merged commit 48ceec4 into main May 18, 2026
21 checks passed

This branch was previously deployed

2 inactive deployments
development — 81d203cf Deployed May 18, 2026 by neuromechanist via deploy-dev #314
npm — 81d203cf Deployed May 18, 2026 by neuromechanist via publish #975
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