Skip to content

Tighten enrichedMetadata to drop redundant ?? [] guards #80

Closed

Description

@neuromechanist

Spotted by PR #79's review: src/pages/dataset/[id].astro builds enrichedMetadata with recording_modality: metadata.recording_modality ?? [] (and same for tasks, authors). The NeuroschemaDataset type already declares these as non-optional string[] / Author[] (see src/lib/neuroschema.ts:68,71,79), so the coalesces are dead code by type.

Two ways to clean up:

  • (a) Verify the live API actually never omits these (curl a handful of data.nemar.org/<id>/metadata.json responses), then drop ?? [] from [id].astro.
  • (b) If any deployed metadata.json files DO omit them, widen the type to recording_modality?: string[] and keep the guard.

Defaulting to (a) since the post-#717 backfill landed all 130 datasets at schema 1.1 — option (b) only if the curl finds counterexamples.

Picked up here rather than in #79 because changing the type ripples through DetailRail and might surface other consumers that quietly relied on the array being always-defined.

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