Repository navigation
Phase 3: channel/montage backfill sweep (#859) - #862
Merged
neuromechanist merged 1 commit intoJun 28, 2026
Merged
neuromechanist merged 1 commit into
neuromechanist merged 1 commit into
Conversation
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.
neuromechanist
merged commit Jun 28, 2026
0b70fc3
into
feature/issue-854-epic-channel-montage
1 check passed
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
One-time backfill of
n_channels/electrode_systemfor existing EEG datasets.channel_montage_checked_atresumability marker (mirrorsarchive_checked_at).POST /admin/datasets/channel-montage-sweep?limit=N— candidates are repo-backed (nm*/on*), EEG (modalities LIKE '%eeg%'), non-sandbox, unchecked. Runs the Phase 2getBidsTreeStatsprobe and writes the two columns directly — crucially not viawriteDatasetMetadataColumns, so the backfill does not bumpupdated_at/metadata_updated_at(which would make every EEG dataset read "updated today" and jump the newest-first sort). Idempotent (marks each row checked, success or not), bounded per call (≤30) under the Worker subrequest cap.scripts/backfill-channel-montage.sh— polls the endpoint untilremainingreaches 0.Running it (answers "does it need prod?")
The sweep writes whichever env's D1 the worker is bound to. The public site reads prod D1, so:
NEMAR_API_BASE=<dev-worker> NEMAR_ADMIN_KEY=... ./scripts/backfill-channel-montage.sh --dry-runNEMAR_ADMIN_KEY=... ./scripts/backfill-channel-montage.shMigrations 0054/0055 reach each env automatically on deploy.
Testing
test/channel-montage-sweep.unit.test.ts— applies the real migrations against in-memory SQLite, pins the candidate predicate (excludes no-repo/sandbox/non-eeg), and asserts the write sets the two columns + marker while leavingupdated_atuntouched, and converges (checked rows drop out). 4 tests.tsc --noEmitgreen.Closes #859. Part of epic #854.