Skip to content

Consume summary.path_sizes for per-file sizes in BIDS tree #73

Closed

Description

@neuromechanist

Background

The BIDS file tree panel on /dataset/<id> currently displays "0 B" for every file when rendering from the schema 1.1 summary fast path. buildTreeFromPaths in src/lib/bids-tree.ts:76-85 synthesizes zero-size manifest entries because summary.paths is string[] with no size data. The slow-path manifest fallback DOES carry sizes, but using it would re-introduce the multi-MB fetch the summary fast path was designed to eliminate.

nemar-cli#TBD proposes schema 1.2 with a parallel summary.path_sizes: number[] array aligned by index to paths. Once that ships and backfills, the website needs to consume it.

Scope

  • Extend the Summary TypeScript interface in src/lib/data-api.ts with path_sizes?: number[] (optional, additive).
  • Update buildTreeFromPaths(paths) in src/lib/bids-tree.ts to accept an optional sizes?: number[] argument and thread the per-index size into the synthesized ManifestEntry. Back-compat: when sizes is undefined or sizes.length !== paths.length, fall back to 0 as today.
  • Update the call site in src/pages/api/dataset/[id]/tree.ts to pass summary.path_sizes when present.
  • Unit tests: buildTreeFromPaths with paths-only, paths+sizes, mismatched lengths.

Why no immediate website-only fix

The data simply isn't in summary.json until 1.2 ships. The website cannot synthesize per-file sizes without re-introducing the manifest fetch.

Acceptance

  • Summary.path_sizes?: number[] typed and read by the tree path.
  • Per-file size column on the BIDS tree shows real sizes (e.g., 52.4 MB instead of 0 B) for datasets backfilled to schema 1.2.
  • Datasets still on schema 1.0/1.1 continue to render with 0 B per-file (unchanged behavior).
  • Unit tests cover the three cases above.

Depends on

  • nemarOrg/nemar-cli#TBD (schema 1.2 with path_sizes array + backfill)

Related

  • Eliminate per-pageload GitHub roundtrip for README #63 (schema 1.1 readme.content consumer — same back-compat pattern)
  • nemarOrg/website#TBD (hotfix that fixes the panel-header "0 B total" without needing schema 1.2, since summary.totals.bytes is already populated in schema 1.1)

Activity

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

    @neuromechanist
    ContributorAuthor

    Cross-refs: depends on nemarOrg/nemar-cli#635 (schema 1.2 with path_sizes array + backfill). The panel-header "0 B total" subset of the symptom is fixed independently in #74 (hotfix, in flight) by reading the existing summary.totals.bytes.

  3. neuromechanist commented on May 27, 2026

    @neuromechanist
    ContributorAuthor

    Obsoleted by #76 (canonical-sources pivot, merged 2026-05-27T14:48:13Z). The JSON directory listings shipped in nemar-cli#636 already carry per-file sizes natively; the website now consumes them directly and no longer needs schema 1.2 path_sizes to surface that information.

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

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions