Skip to content

Release: detail-endpoint parity + channel/montage classification - #864

Merged
neuromechanist merged 15 commits into
mainfrom
dev
Jun 28, 2026
Merged

neuromechanist merged 15 commits into
mainfrom
dev

Conversation

@neuromechanist

Copy link
Copy Markdown
Contributor

Promotes dev → main (auto-tag strips the -devN suffix and tags on merge; no manual bump).

Headline changes

Also carries the previously-merged epic #837 legacy-separation cleanup (#850) already on dev.

Post-merge ops

  • Migrations 0054/0055 apply to prod D1 (nemar-db) on deploy.
  • Run scripts/backfill-channel-montage.sh against api.nemar.org to populate existing EEG rows (idempotent; going-forward datasets populate via the reindex walk).
  • The website's guarded Channels & montage filter + the EGI/BioSemi viewer topomap (website#136) light up once the columns populate.

Verified on dev

nemar-api-dev: detail endpoint returns participants; list projection carries n_channels/electrode_system (null pre-backfill). CI green on the epic→dev PR (#863).

nemar-bot and others added 15 commits June 27, 2026 06:55
The DOI re-target, legacy-DB purge, and ds-row deletion have all run on prod
(epic #837), so remove the guarded run-once scripts (retarget-dois,
purge-legacy-datapipeline, delete-ds-rows + their tests) and the slim
legacy-purge.ts delete client they used. Also drop the stale NEMAR_USERNAME/
PASSWORD entries from the wrangler-sccn.toml secrets doc (the worker no longer
reads them; the legacy datapipeline sync was retired in Phase 3).
GET /datasets/:id did SELECT d.*, exposing the raw subject_count
column but not the participants alias, and no latest_version (that
is a computed subquery, not a table column). The list + search
endpoints both return participants + latest_version, so search-card
hydration that rehydrates via the detail endpoint lost the subject
count. Add both alongside d.* (additive; raw columns untouched, so
no contract regression). Closes #853.
Phase 1 of epic #854. Additive only:
- migration 0054 adds n_channels (INTEGER) + electrode_system (TEXT)
  to datasets, with indexes for filterability.
- expose both in the public list + ?mine list SELECTs. The detail
  endpoint already returns them via SELECT d.*.

Values stay NULL until phase 2 (#858) computes them and phase 3
(#859) backfills; the website channel/montage filter reads NULL as
"not classified yet". No existing column or alias changes, so no
contract regression.

Closes #857. Part of #854.
Phase 2 of epic #854. Populate the migration-0054 columns during
enrichment:

- channel-montage.ts (pure, unit-tested): parseChannelsTsv,
  parseEegChannelCount, resolveNChannels (measured channels.tsv EEG
  count wins over a disagreeing sidecar), classifyElectrodeSystem
  (egi-geodesic / biosemi / 10-20 / 10-10 / 10-05 / other), grounded
  in MNE-derived label sets (montage-label-sets.ts).
- getBidsTreeStats samples an exemplar eeg channels.tsv + eeg.json
  from the subjects it already walks and runs the classifiers
  (best-effort: a probe failure leaves the columns NULL, never
  breaks the modality/subject walk).
- writeDatasetMetadataColumns COALESCE-writes n_channels +
  electrode_system; the reindex caller threads them through.

EEG-only for now; populated via the reindex/walk path (the
LLM-enrich path omits them, COALESCE-safe). Backfill of existing
rows is phase 3 (#859).

Closes #858. Part of #854.
fix(api): detail endpoint returns participants + latest_version (#853)
Phase 1: channel/montage schema + projection (#857)
Phase 2: channel count + electrode-system compute (#858)
Phase 3 of epic #854. One-time backfill for the columns added in
phase 1/2 across existing EEG datasets:

- migration 0055 adds channel_montage_checked_at (resumability
  marker, mirrors archive_checked_at).
- POST /admin/datasets/channel-montage-sweep?limit=N: candidates are
  repo-backed (nm*/on*), EEG, non-sandbox, unchecked rows. Runs the
  phase-2 getBidsTreeStats probe and writes n_channels +
  electrode_system DIRECTLY (no updated_at bump, so the backfill
  doesn't re-sort every EEG dataset to "newest"). Idempotent;
  bounded per call (<=30) under the Worker subrequest cap.
- scripts/backfill-channel-montage.sh drives it until remaining=0.

Real-SQLite test applies migrations 0054+0055 and pins the candidate
scoping + the no-updated_at-bump write.

Closes #859. Part of #854.
…montage

Epic #854: catalog channel count + electrode-system classification
@neuromechanist
neuromechanist merged commit 8b209c8 into main Jun 28, 2026
22 of 23 checks passed
neuromechanist added a commit that referenced this pull request Jul 6, 2026
…939)

* Fix contract drift: getCurrentUser + version prefix

Epic #896 Phase 4 (#899). Applies the #898 contract to the known drift.
- getCurrentUser() unwraps the {user, token} envelope (.user) and validates
  against userMeResponseSchema. It previously declared flat UserInfo and read
  the envelope top level, so every field was undefined at runtime -- silently
  writing undefined over stored account config on 'auth status --refresh' and
  disabling the upload ORCID auto-match. Consumers coerce nullable username/
  github_username -> undefined for config.
- Catalog latest_version is emitted in the canonical vX.Y.Z tag form
  (withCanonicalLatestVersion) at the list/fallback/detail responses, matching
  the data plane + what hallu-sync's archives/<v>.zip URLs need. Fixes the
  website vv1.0.0 double-prefix (website PR nemarOrg/website#145 coerces too).
- file_size (#895): the compute is already annex-aware (getDatasetS3Stats sums
  real S3 object sizes); the ~36B symptom is stale legacy folded rows -> fixed
  by an operational reindex backfill at finalize, no code change.
- /datasets/:id parity (#864) is backend-complete (#853); website backfillSearchHit
  removal tracked separately.

* Address #899 review: strict version test + cleanup

- Live contract test now asserts the RAW catalog latest_version is the
  canonical tag via the non-coercing strictVersionTagSchema, so a dropped
  withCanonicalLatestVersion call site fails CI (the coercing envelope schema
  couldn't catch that).
- Added a getCurrentUser() live-integration test that calls the function and
  asserts flat access (config dir is isolated by setup.ts).
- Removed the now-dead UserInfo interface and a redundant cast at the detail
  return.
- Cross-repo: nemarDatasets/.github#61 normalizes the Hallu zarr-queue version
  comparison so #899's tagged latest_version doesn't re-drain the queue.

This branch was previously deployed

2 inactive deployments
npm — 4cf94d47 Deployed Jun 28, 2026 by neuromechanist via publish #1616
development — 4cf94d47 Deployed Jun 28, 2026 by neuromechanist via deploy-dev #643
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant