Skip to content

Hotfix: tree totals from summary.totals.bytes + raise summary timeout on partial endpoints #74

Closed

Description

@neuromechanist

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: buildTreeFromPaths with paths + an explicit root override produces a tree whose root reports the override (already covered if we just set root.totalSize in tree.ts after build — no helper change).
  • bun run test green; bun run typecheck clean; bun run lint clean; bun run build clean.
  • Post-deploy: panel header on /dataset/on005512 reads "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

  1. added
    bug
    on May 27, 2026
  2. neuromechanist commented on May 27, 2026

    @neuromechanist
    ContributorAuthor

    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.

  3. added a commit that references this issue on May 27, 2026
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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions