Resume interrupted data downloads instead of passing them off as complete - #14
Merged
Conversation
…s complete `fetch_session` skipped a stage whenever its directory was merely non-empty, so a `raw` pull interrupted partway (dropped wifi, Ctrl-C) left a truncated file on disk and every later run printed `KEEP prerecorded/raw` and moved on. The session stayed quietly incomplete and the failure surfaced later, mid-notebook, as a confusing read error. `verify.py` did not catch it either — `check_data` only asked whether the stage dirs were non-empty, the same blind spot. Verify what's on disk against what the archive publishes: - `_is_complete` checks size (catches truncation) then the published MD5 (catches right-length-but-wrong-bytes), and `_fetch` skips files that already match — so an interrupted pull re-fetches only what's missing or damaged. `--force` still re-downloads everything. - `raw` no longer takes the coarse non-empty shortcut. Processed stages keep it deliberately: a local `minian_out/` may be the participant's own upstream output, which is the point of local-first and must not be clobbered. - `raw_audit()` compares a local `raw/` against the deposit's file list, and `verify.py` gains a `raw recording complete` check that uses it: FAIL on a truncated or missing file, WARN on a partial video set, PASS on a deliberate `--skip-video` pull. It reads names and sizes only — metadata, never data — and degrades to WARN when offline so the gate still runs on a plane. This also fixes `--skip-video` followed by a full fetch silently never pulling the videos, since `raw/` was non-empty by then. Re-verifying a complete 8.9 GB session costs ~12 s, so no opt-out is needed. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…n path Step 0 told macOS users to run `brew install python@3.12` / `brew install ffmpeg` without saying where `brew` comes from, so a genuinely fresh Mac stalls at the first command. Two things were missing beyond the install line itself: the installer needs an interactive terminal (it prompts for a password, so pasting it into another tool fails with `Need sudo access on macOS`), and it needs administrator rights at all — which a lab or managed machine may not grant. Add the install command, note it must be run in Terminal directly, and give the no-admin fallback (python.org installer, prebuilt ffmpeg, `xcode-select` for git) so a participant who can't get admin isn't simply stuck. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
Found while installing the repo from scratch on a bare macOS machine ahead of next week's workshop.
The bug
get_data.pyskipped a stage whenever its directory was merely non-empty:So a
rawpull interrupted partway — dropped wifi, closed laptop, Ctrl-C — left a truncated.avion disk, and every later run printedKEEP prerecorded/rawand moved on. The session stayed quietly incomplete. I hit this for real: an interrupted pull left0.avicomplete and10.aviat 312 MB of 360 MB, and a re-run happily declared the stage present.verify.pydidn't catch it either —check_dataonly asked whether the stage dirs were non-empty, the same blind spot from the other side. So a participant could get an all-PASSpre-flight and still fail mid-notebook on a truncated read, which is exactly the failure we want found days early rather than in the room.The fix
Compare what's on disk against what the archive publishes, at file granularity.
_is_completechecks size first (astat; catches truncation instantly) then the published MD5 (catches right-length-but-wrong-bytes)._fetchskips files that already match, so an interrupted pull re-fetches only what's missing or damaged.--forcestill re-downloads everything.rawno longer takes the non-empty shortcut. Processed stages keep it deliberately — a localminian_out/may be the participant's own upstream output, which is the point of local-first and must not be clobbered.raw_audit()compares a localraw/against the deposit's file list, andverify.pygains araw recording completecheck that uses it. Names and sizes only — metadata, never data — and it degrades toWARNwhen offline, so the gate still runs without a connection.Also fixes a second bug I wasn't looking for:
--skip-videofollowed by a plainget_data.pysilently never pulled the videos, becauseraw/was non-empty by then. Anyone who started small and later wanted the full set got no video and no warning.Verification
Tested against a real 8.9 GB
prerecordedpull on macOS 26.5 (arm64), Python 3.12.13._is_completeunitsPASS raw recording complete (all files match the archive)WARN ... (1 video(s) missing)— interrupted pullPASS ... (timestamps only - video skipped)— deliberate--skip-videoFAIL ... (1 file(s) wrong size)FAIL ... (1 file(s) missing)WARN ... (unverified), does not fail the gateFull self-check on this machine: 14 passed, 0 warnings, 0 failed.
Re-verifying a complete 8.9 GB session costs ~12 s, so there's no
--no-verifyopt-out — it isn't worth the flag.Second commit: the macOS doc gap
Same fresh-machine run surfaced this. Step 0 said
brew install python@3.12without saying wherebrewcomes from, so a fresh Mac stalls at the first command. Two things were missing beyond the install line: the installer needs an interactive terminal (it prompts for a password — pasting it elsewhere fails withNeed sudo access on macOS), and it needs administrator rights at all, which a lab or managed machine may not grant. Added the install command, the Terminal-directly note, and a no-admin fallback (python.org installer, prebuilt ffmpeg,xcode-selectfor git) so someone without admin isn't simply stuck.Note for reviewers
verify.py's docstring previously promised it downloads nothing. It still downloads no data, but one check now reaches the network for the deposit's file list. I updated the docstring to say so rather than leave it quietly untrue. If you'd rather the pre-flight stay strictly offline, that check can move behind a--onlineflag — say so and I'll change it.🤖 Generated with Claude Code