Skip to content

Pivot to canonical sources: drop summary.json + page-bundle + partial endpoints #76

Closed

Description

@neuromechanist

Context

User-reported cold-isolate failures on HBN-sized datasets (on005510, 11, 12, 14 — past two days) drove an architectural rethink. Five PRs over the past week patched cold-isolate symptoms without fixing the root cause:

PR What it tried to do
#67 Bump edge-cache namespace to orphan SWR-poisoned partials
#68 Consume schema 1.1 summary.readme.content to skip GitHub roundtrip
#69 Progressive BIDS tree (skeleton + per-subject lazy)
#72 Page-bundle SSR consumer (collapse SSR fan-out to 1 RTT)
#75 Bump summary timeout 1.5s → 4s + render summary.totals.bytes

Despite all that, on005514 still surfaces the cold-isolate failure on the user's PoP. Investigation surfaced that we've been engineering around a constraint that no longer binds.

Honest data on the canonical sources

URL TTFB Size What it gives
data.nemar.org/<id>/<v>/ (HTML) 1.13 s 32 KB Directory listing + sizes + native lazy
raw.githubusercontent.com/<repo>/<v>/README.md 276 ms 7 KB README, GitHub's CDN
data.nemar.org/<id>/<v>/manifest.json 2.05 s 5.1 MB The original "too heavy" thing summary.json was meant to avoid
data.nemar.org/<id>/<v>/summary.json (current consumer pipeline) 739 ms 928 KB What our consumer pipeline expanded to

We optimized away a 276 ms GitHub fetch by inlining a 7 KB README into a 928 KB summary, then built a partial-endpoint pipeline that refetches that summary on every page open. The complexity isn't paying its rent.

Proposed simpler architecture (depends on nemar-cli#636)

SSR (dataset/[id].astro):
  - fetch landing.json (~300 B) + metadata.json (~40 KB) only.
  - render header + sidebar inline. No bundle, no summary.

README:
  - <article> element with client-side fetch to:
    raw.githubusercontent.com/<repo>/<v>/README.md
  - ported renderMarkdown (Workers-safe today; trivial to run in browser).
  - ~280 ms cold, GitHub's CDN.
  - fallback: skip the section if the repo isn't linked.

Tree:
  - <section> element with client-side fetch to:
    data.nemar.org/<id>/<v>/?format=json   ← nemar-cli#636
  - render directory listing in our UI with real sizes.
  - directory click → fetch <id>/<v>/<subdir>/?format=json
  - lazy per-directory is free (no skeleton/subtree split needed)

What gets deleted

Roughly half of src/lib/data-api.ts and src/pages/api/dataset/[id]/{readme,tree}.ts plus their tests:

  • getDatasetPageBundleOutcome, BundleField, DatasetPageBundle, BundleCatalogRow, bundleFieldToOutcome
  • getSummary, getSummaryOutcome, findReadmePathInSummary, findReadmeContentInSummary, Summary interface
  • tree.ts and readme.ts partial endpoints
  • buildTreeFromPaths, the summary fast-path branch in tree rendering
  • The data-tree-defer / data-readme-defer hydration script
  • Phase 3's isSubjectDir, renderBidsSubtree, the lazy-subject toggle handler — replaced by per-directory lazy
  • tree-endpoint.test.ts and most of the bundle/summary-shape tests

What stays

  • getLandingOutcome, getMetadataOutcome (small fetches, no perf issue)
  • resolveDatasetPageStatus and the FetchOutcome machinery
  • getDataset (catalog row, used by enrichedMetadata)
  • getQaAggregates
  • renderMarkdown — ported to a small client module
  • Edge cache namespace + middleware (separate concern)

Side effects on filed issues

  • Closes nemar-cli#635 (schema 1.2 path_sizes) — obsoleted by JSON dir listings.
  • Closes website#73 (consume path_sizes) — same.
  • nemar-cli#616 (readme.content) stays shipped but unused — CLI can deprecate when convenient.

Depends on

  • nemar-cli#636 — JSON content negotiation on directory listings (in flight on dev as PR #637)

Acceptance

  • nemar-cli#636 lands on main + deploys to prod
  • Dataset detail page on on005514 / on005512 loads README + tree on the first cold-PoP visit, no refresh cycle
  • Per-file sizes display real numbers on every row
  • No tree.ts / readme.ts partial endpoints remain in src/pages/api/dataset/[id]/
  • No getSummary / Summary references in src/lib/
  • dist/ bundle size unchanged or smaller despite client-side markdown rendering
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions