Repository navigation
chore: drop residual require('node:fs') calls in import-openneuro tests - #538
Merged
Merged
Conversation
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.
📦 Package PreviewYour package is ready to test! bun install -g nemar-cli@PR538Version: 🤖 Updated on each push. |
neuromechanist
added a commit
that referenced
this pull request
May 18, 2026
…537) * chore: bump version to 0.8.21-dev0 * Fix #535: stop seeding OpenNeuro placeholder description; route provenance 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). * fix(datasets): hide ds* catalog shadows when on* mirror exists (#534) 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). * chore: bump version to 0.8.21-dev1 * Address review finding: drop require('node:fs') in test helper 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). * chore: bump version to 0.8.21-dev2 * Drop two remaining require('node:fs') calls in import-openneuro tests (#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. * chore: bump version to 0.8.21-dev3 --------- Co-authored-by: nemar-bot <[email protected]>
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Surfaced in the PR #537 release review (pr-review-toolkit code-reviewer, "Important" finding 1).
Commit f9c22b4 on the prior cycle fixed the same anti-pattern in `appendOpenNeuroProvenance`'s `readReadme()` helper but missed two other instances in the same file:
Both used `require("node:fs").readFileSync(...)` instead of the `readFileSync` already destructured from the top-level `import { ... } from "node:fs"`. `.rules/javascript.md` says ES modules only.
Pre-existing on dev, non-blocking for the v0.8.21 release, but bundling here keeps the test file consistent.
Test plan: