Repository navigation
Description
Two related problems
1. "0 B total" in the BIDS tree panel header
src/lib/render-tree.ts reads root.totalSize for the header line ("N top-level entries · X B total"). On the schema 1.1+ summary fast path, buildTreeFromPaths synthesizes zero-size manifest entries (intentional per the comment in bids-tree.ts:63-75) so the propagated total is 0 — the panel header reads "0 B total" even on multi-GB datasets.
But summary.totals.bytes is already populated and accurate. For on005512: 168778508210 (168 GB). For on005505: ~110 GB.
Fix: in src/pages/api/dataset/[id]/tree.ts, set root.totalSize = summary.totals?.bytes ?? root.totalSize after buildTreeFromPaths. Per-file sizes stay at 0 (waiting on schema 1.2 / nemarOrg/website#TBD) but the totals line gets the real number.
2. Cold-isolate timeouts on partial endpoints
src/pages/api/dataset/[id]/readme.ts:62-66 and tree.ts:52-55 set timeoutMs: 1_500 for the summary.json fetch. For HBN-sized datasets the summary is 400-750 KB; on a cold CF isolate that fetch can't complete in 1.5 s and falls through to the manifest/GitHub fallback chain (also timeout-bounded), landing at the "Manifest unavailable" / empty-README placeholder.
User-visible symptom (reported 2026-05-27): cold-PoP first-visit hit on https://ww2.nemar.org/dataset/on005510 and on005511 displays placeholders; after 2-3 refreshes the data.nemar.org edge warms up and everything loads instantly. Once warm, the same PoP serves cold requests fast (data.nemar.org's s-maxage=86400 keeps it warm for 24 h).
Fix: bump summary timeoutMs from 1_500 to 4_000 (matching the metadata fetch's existing default) on both endpoints. The summary fetch is the cold-paint critical path; falling through to the fallback chain when summary is just slow (not unavailable) is the wrong tradeoff for users on cold PoPs.
Why one PR
Both touch tree.ts, both are small, both are user-visible regressions on the same class of datasets. Bundling avoids two churn cycles through review + CI + deploy. Total scope: ~10 lines of code change + tests for the totals path.
Out of scope
- Per-file sizes — needs schema 1.2 (nemar-cli#TBD + nemarOrg/website#TBD). Filed separately.
- Architectural fix where the partial endpoints read from the page-bundle (which is already SSR-warmed and edge-cached) instead of doing their own summary fetch. The bigger fix; defer to its own issue once we see whether the timeout bump alone is enough.
Test plan
- Unit test:
buildTreeFromPathswith paths + an explicit root override produces a tree whose root reports the override (already covered if we just setroot.totalSizein tree.ts after build — no helper change). -
bun run testgreen;bun run typecheckclean;bun run lintclean;bun run buildclean. - Post-deploy: panel header on
/dataset/on005512reads "X TB total" (real) not "0 B total". - Post-deploy: first-cold-PoP visit to a fresh dataset loads README + tree on first try (no 2-3 refresh cycle).
Activity
neuromechanist commentedon May 27, 2026
Cross-refs: per-file "0 B" sizes are NOT in scope here — they need schema 1.2 (filed as nemarOrg/nemar-cli#635) and the website consumer (#73). This hotfix only addresses the panel-header total + the cold-isolate summary timeout. Both fixes are website-only and don't depend on either upstream issue.
fix(tree): real total bytes + 4s summary timeout
Merge pull request #75 from nemarOrg/feature/issue-74-hotfix-tree-totals