Repository navigation
Rebuild directory recordings on sidecar edits - #1123
Merged
neuromechanist merged 2 commits intoAug 22, 2026
Merged
Conversation
compute_worklist keyed by_dir on file heads only, so affected_primaries got an empty bucket for a CTF .ds, MEF3 .mefd, or 4D-BTi recording and an events or companion edit beside one queued nothing at all. The recording kept serving stale annotations until the next --clean full rebuild, which is why this stayed invisible. Key by_dir on all buildable primaries instead. Changes inside a recording directory never reach this map (dir_recording_of and bti_dirs resolve them first), so it is consulted only for siblings alongside the recording, which is exactly the sidecar case. Ten tests: all three directory formats, add/modify/delete of the events file, and four negative guards against over-matching. Seven fail without the fix; the three guards pass either way by design. Closes #1106
📦 Package PreviewYour package is ready to test! bun install -g nemar-cli@PR1123Version: 🤖 Updated on each push. |
Three findings from review of #1123. The fix comment said an events OR COMPANION edit rebuilt nothing. Only events is right: companion extensions are EEGLAB/BrainVision-specific, so reaching a directory recording that way would need a same-stem .fdt/.eeg/ .vmrk beside a .ds/.mefd/BTi dir, which is not valid BIDS. Overstated the bug's scope. affected_primaries' docstring still said primaries_by_dir holds only buildable heads. This PR is what made that false, so it is corrected here rather than left to drift, including why a directory recording reaches only the companion and events branches. Added a session/run/acq test. The other fixtures are flat sub-01, which is not how CTF/MEF3 data arrives; these are exactly the multi-session, multi-run formats and that matching had never been exercised on a directory recording.
neuromechanist
deleted the
fix/issue-1106-events-rebuild-dir-recordings
branch
August 22, 2026 17:11
This was referenced Aug 22, 2026
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
compute_worklistbuilt itsby_dirindex from file heads only, soaffected_primariesreceived an empty bucket for a CTF.ds, MEF3.mefd, or 4D/BTi recording. Editing the_events.tsvbeside one queued nothing — the recording kept serving stale annotations until the next--cleanfull rebuild happened to pick it up. That papering-over is why the bug survived: the hourly cron runs--clean, so the incremental path was wrong without ever being visibly wrong.Reproduced before fixing, across all three formats:
.ds[]['sub-01/meg/sub-01_task-x_meg.ds'].mefd[]['sub-01/ieeg/sub-01_task-x_ieeg.mefd'][]['sub-01/meg/sub-01_task-x_meg']Why this fix
A directory recording sits in the same parent directory as its sidecars (
sub-01/meg/..._meg.dsnext tosub-01/meg/..._events.tsv), so keyingby_diron all buildable primaries makes the existing entities-base matching resolve it with no change toaffected_primariesitself.Changes inside a recording directory never reach this map —
dir_recording_ofand thebti_dirscheck resolve those earlier andcontinue. The map is consulted only for siblings alongside the recording, which is precisely the sidecar case, so widening it does not affect any other path.Test plan
Ten tests in
TestSidecarRebuildsDirectoryRecordings:.ds, MEF3.mefd, and BTiVerified the tests are not tautological: reverting the one-line
by_dirchange fails 7 of 10. The 3 that pass either way are the negative guards, by design.test_generate_zarr.py(was 265), plustest_zarr_queue.py,test_purge_non_raw_stores.py,test_patch_power_line_frequency.pyCloses #1106. Part of epic #1095.