Repository navigation
feat(dataset): consume compact summary.json with manifest fallback - #31
Merged
neuromechanist merged 3 commits intoMay 19, 2026
Conversation
Fast path when data.nemar.org/<id>/<version>/summary.json is available: the readme + tree endpoints build the tree from summary.paths (a flat path list, ~50-200 KB regardless of dataset size) and locate the README via summary.readme.path + GitHub raw fetch. No presigned-URL transcript download (which is 5-10+ MB on real BIDS-EEG datasets). Slow path is the current code path entirely unchanged: fetch the full manifest, find README, build tree. Activates automatically when summary is absent. This PR is fallback-safe: until the data layer starts emitting summary.json (nemarOrg/nemar-cli#558), the slow path runs and behavior is identical. Once the artifact lands for a dataset, the fast path activates for it with no website redeploy. Refs nemarOrg/nemar-cli#558. Closes #29.
Deploying nemar-website with
|
| Latest commit: |
caf2cef
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://8bc31713.nemar-website.pages.dev |
| Branch Preview URL: | https://29-use-compact-summaryjson-i.nemar-website.pages.dev |
4 tasks
neuromechanist
added a commit
that referenced
this pull request
May 19, 2026
Critical: - readme.ts: fast path no longer silently drops the README when a dataset has no GitHub URL or the GH fetch fails. Now always falls through to the manifest path before settling for description. (code-reviewer finding 1, silent-failure finding 2) Important: - tree.ts: validate summary.paths is a non-empty array before using; fall through to manifest with a console.warn if summary is malformed or partial. (silent-failure finding 3) - console.warn on getSummary returning null in both endpoints so degraded data-layer is visible in logs. (silent-failure finding 4) - readme.ts module JSDoc rewritten to reflect actual 4-step resolution order; old JSDoc was misleading. (comment-analyzer finding 1) - findReadmePathInSummary JSDoc now documents the priority order + why subdirectory READMEs are intentionally skipped (BIDS spec). (comment-analyzer finding 4) - buildTreeFromPaths JSDoc explains the synthetic-filler choice + notes the renderer doesn't read entry.url. (comment-analyzer finding 3) Tests: - Pin "subdirectory README is ignored" (locks in BIDS-spec contract) - Pin "malformed segments don't throw" for buildTreeFromPaths Out of scope (PR comment): - jsonFetch broad-swallow (pre-existing on main; same as #30's deferred) - archiveZipUrl comment drift (pre-existing on main) - bids-tree.ts pre-existing inline comments (not touched by this PR) - Pure-helper extraction for endpoint branching (refactor; not blocking) - render-tree url="" finding was a false positive — render-tree.ts builds anchors from basePath+path and never reads entry.url
Contributor
Author
Review findings addressed (commit 34ae52e)Critical:
Important:
Tests:
Deferred / declined:
Net result: 121 tests pass (2 new), typecheck clean, biome clean on changed files, no new lint errors introduced. |
…yjson-instead-of-full-manifestjson-for-dataset-detail-page # Conflicts: # src/lib/data-api.test.ts # src/pages/api/dataset/[id]/readme.ts # src/pages/api/dataset/[id]/tree.ts
neuromechanist
deleted the
29-use-compact-summaryjson-instead-of-full-manifestjson-for-dataset-detail-page
branch
May 19, 2026 03:27
5 tasks
neuromechanist
added a commit
that referenced
this pull request
May 19, 2026
Replaces the unconditional T|null contract of jsonFetch with a
FetchOutcome<T> discriminated union covering: ok, not_found,
rate_limited, upstream_error, timeout, network_error, parse_error.
Every previously-throwing path (AbortError, JSON parse, network/DNS
failures) is now caught + tagged so callers can distinguish "the
resource genuinely doesn't exist" from "the data layer is degraded."
Legacy T|null API preserved via jsonFetchOrNull (used by the four
existing getX helpers); new *Outcome variants are introduced for
callers that need the discriminant.
Behavioral changes (user-visible):
- /dataset/<id> SSR: real 404 only when BOTH landing and metadata are
not_found. Degraded responses (timeout, 5xx, parse error) now return
503 instead of silently 404ing, so monitoring distinguishes typo'd
URLs from data-layer outages.
- /api/dataset/<id>/{readme,tree}: explicit 404 when landing is
not_found, short-circuiting the manifest fall-through that would
otherwise render a misleading "no manifest" state for missing
datasets.
Also sweeps the archiveZipUrl comment drift flagged on PR #31 — the
old comment referenced a `download/<id>/<v>.zip` path that doesn't
exist in the code.
Closes #32.
4 of 7 tasks
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.
Summary
The dataset detail page's `/api/dataset//readme` and `/tree` endpoints now fetch `data.nemar.org///summary.json` first (compact, no presigned URLs, ~50-200 KB) and fall back to the full manifest if absent.
Fully backward compatible. Activates automatically per-dataset once summary.json starts being published (companion: nemarOrg/nemar-cli#558).
Why this matters
Today the public `manifest.json` is 5-10+ MB for typical BIDS-EEG datasets because the worker mints a presigned S3 URL into every file entry on every request. The website only uses paths + readme; we're shipping 10 MB to use 50 KB. First-load times out, second browser is the CF edge cache making the bloat warm — that's the "switching browsers fixed it" symptom users report.
What changed
Test plan
Notes