Repository navigation
#76: Pivot dataset detail to canonical sources (drop summary/bundle/partials) - #77
Merged
Merged
Conversation
Deploying nemar-website with
|
| Latest commit: |
b853f4c
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://92a9b393.nemar-website.pages.dev |
| Branch Preview URL: | https://feature-issue-76-canonical-s.nemar-website.pages.dev |
A week of cold-isolate patches on the dataset detail page failed to fix the user-reported HBN failure case (on005510 / 11 / 12 / 14). The actual failure surface was the duplicate-fetch pipeline we built on top of data.nemar.org: summary.json reconstruction, the page- bundle adapter, and the deferred partial endpoints all re-fetched summary.json from cold isolates on every visit. Closes the pattern entirely. Replaces the pipeline with direct consumption of the canonical sources: - README: client-side fetch to raw.githubusercontent.com/<repo>/<v>/ README.md via GitHub's CDN, rendered with the existing markdown.ts which was already zero-dep and browser-safe. - Tree: client-side fetch to data.nemar.org/<id>/<v>/?format=json (the JSON content negotiation shipped today as nemar-cli#636 / v0.8.37). Top-level JSON with real per-file sizes; native lazy- per-directory via <details> toggle + a capture-phase listener that fetches each subdirectory's listing on first expand. SSR collapses back to landing + metadata + catalog + qa fan-out (pre-#71 baseline). No bundle, no summary, no manifest, no partial endpoints. enrichedMetadata loses the catalog license fallback because Dataset doesn't carry license (the bundle's catalog_row subset that did is gone with this PR); metadata.license is the source. Net delete: ~1400 lines across 8 files, +740 added. 365 tests pass (was 403; deletion trimmed 38 bundle/summary tests). Closes #76.
neuromechanist
force-pushed
the
feature/issue-76-canonical-sources-pivot
branch
from
May 27, 2026 14:46
142ef66 to
b853f4c
Compare
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
A week of cold-isolate patches on the dataset detail page (#65, #63, #64, #71, #74) failed to fix the user-reported HBN failure case (on005510 / 11 / 12 / 14). Investigation surfaced that we'd been engineering around a constraint that no longer binds — the canonical sources (GitHub raw +
data.nemar.org/<id>/<v>/?format=jsonshipped today as nemar-cli#636 / v0.8.37) are fast and well-shaped. The duplicate-fetch pipeline we'd layered on top (summary.jsonconsumer +page-bundle.jsonaggregator + the/api/dataset/<id>/{readme,tree}partial endpoints) was the actual failure surface.This PR tears the whole pipeline out and replaces it with direct client-side consumption of the canonical sources. Net delete: ~1400 lines across 8 files, +740 lines added.
Closes #76.
The new architecture
dataset/[id].astro): justlanding.json+metadata.json+ the api.nemar.org catalog row + QA. Flat parallel fan-out, the pre-Consume nemar-cli /<id>/page-bundle.json on dataset detail #71 baseline.<article data-readme-defer>skeleton; the client script fetchesraw.githubusercontent.com/<repo>/<v>/README.md(~276 ms via GitHub's CDN) and renders through the existingmarkdown.ts(already zero-dep and browser-safe — confirmed in the explorer audit). Falls back tometadata.description(SSR-passed viadata-fallback-desc) when GitHub raw 404s.<section data-tree-defer>skeleton; the client script fetchesdata.nemar.org/<id>/<v>/?format=json(14 KB top-level with real per-file sizes), renders via the newrenderTopLevel. Every directory is a closed<details data-dir-path="X">with an empty[data-dir-target]slot. A capture-phasetogglelistener ondocumentfetches each subdirectory's listing on first expand and fills the slot viarenderSubdir.data-loaded="true"guards against re-fetches.Net additions
src/lib/dir-listing.ts— typed client (DirListing,DirListingEntry,fetchDirListing,fileDownloadUrl,dirListingUrl).src/lib/render-dir-listing.ts— browser-side renderer; mirrors the existing.tree__*CSS class shapes so the global styles inBidsTree.astroapply unchanged.src/lib/dir-listing.test.ts(8 tests) +src/lib/render-dir-listing.test.ts(10 tests) — URL construction + render markup pinning.<script>insrc/pages/dataset/[id].astro— capture-phase toggle handler, GitHub raw fetch with metadata-description fallback, dir-listing fetch.Deletions
src/pages/api/dataset/[id]/readme.ts— entire endpoint.src/pages/api/dataset/[id]/tree.ts— entire endpoint.src/lib/render-readme.ts,src/lib/render-tree.ts— both renderers (the partial endpoints' output). Their static fallback strings ("No description available", "File index unavailable") moved into the client script.src/lib/bids-tree.ts— keptclassifyFileonly.buildTree,buildTreeFromPaths,TreeNode,sortAndSumgone.src/lib/data-api.ts— kept theFetchOutcomemachinery,resolveDatasetPageStatus,getLandingOutcome,getMetadataOutcome,isUnpublished,archiveZipUrl. Removed:Summary+ all summary helpers,Manifest+ all manifest helpers,BundleField/DatasetPageBundle/BundleCatalogRow+ the bundle fetcher + adapter,findReadmePathInSummary,findReadmeContentInSummary,findReadmeEntry,fetchManifestEntryText,fetchGithubReadme.render-tree.test.ts,render-unpublished.test.ts,tree-endpoint.test.ts. Trimmed the bundle/summary blocks out ofdata-api.test.tsandbids-tree.test.ts.test/fixtures/dataset-page-bundle-on005505.min.json.License fallback
enrichedMetadata.licenseno longer reads fromcatalogRow?.license—Dataset(the api.nemar.org catalog row shape) doesn't havelicense. That field only existed on the bundle'sBundleCatalogRowsubset, which goes away with this PR. License now collapses tometadata.license || null. For datasets wheremetadata.licenseis set, behavior is unchanged. For the rare sparse-metadata + populated-catalog-license case, the rail shows no license; this is a small regression that the optional CLI follow-up (move license into the D1 catalog row OR add it to the JSON dir listing root response) can close cleanly.CORS sanity check
Verified via curl preflight 2026-05-27:
data.nemar.org/<id>/<v>/?format=jsonreturnsAccess-Control-Allow-Origin: http://localhost:4321(the Hono middleware on api.nemar.org's worker reflects allow-listed origins, includingww2.nemar.org,app.nemar.org, andlocalhost:4321). GitHub raw isAccess-Control-Allow-Origin: *for public repos; allnemarDatasets/*repos are public per AGENTS.md.Test plan
bun run typecheck— 0 errors / 0 warnings / 0 hints.bun run lint— biome clean.bun run test— 365/365 pass (was 403; deletion trimmed 38 bundle/summary tests).bun run build— astro build clean.bun run devonon005514/on005512/on005510/on005511: README + tree both render on the first cold-PoP visit, no refresh cycle. Subject directory click → subtree expands in < 500 ms./browseagainst the Pages preview at a cold PoP (cf-fra / cf-syd) — first visit succeeds.Side effects on filed issues
nemarOrg/nemar-cli#635(schema 1.2path_sizes) — obsoleted by JSON dir listings (sizes already in the listing).nemarOrg/website#73(consumepath_sizes) — same.readme.content) stays shipped but unused; the CLI can deprecate when convenient (filed as nemar-cli#TBD-retire).What stays
renderMarkdownandmarkdown.test.ts— both unchanged, both reused by the new client script.