Skip to content

Add check_image_series_external_file_forward_slashes#717

Open
bendichter wants to merge 1 commit into
devfrom
add-check-image-series-external-file-forward-slashes
Open

Add check_image_series_external_file_forward_slashes#717
bendichter wants to merge 1 commit into
devfrom
add-check-image-series-external-file-forward-slashes

Conversation

@bendichter

Copy link
Copy Markdown
Contributor

Closes #697

Summary

Adds a check that flags backslashes in ImageSeries.external_file paths. These are produced by platform-dependent path joining on Windows (e.g. ses-1_image\abc123_external_file_0.mp4) and silently fail to resolve on POSIX systems and against archive asset keys, which always use forward slashes. This is what caused get_dandi_video_info() to return empty results for Dandiset 001771.

The check decodes bytes paths like the neighboring checks do, and yields one message per offending entry so a series with several external files reports each bad one.

Severity

Registered at BEST_PRACTICE_VIOLATION, paralleling the sibling check_image_series_external_file_relative. A path that is genuinely broken locally is already reported as CRITICAL by check_image_series_external_file_valid. Happy to raise this to CRITICAL if reviewers feel the silent failure on the archive warrants it.

Changes

  • New check_image_series_external_file_forward_slashes in src/nwbinspector/checks/_image_series.py, exported from checks/__init__.py
  • New best-practice section in docs/best_practices/image_series.rst under the best_practice_image_series_external_file_forward_slashes anchor referenced by the docstring
  • CHANGELOG entry under "New Checks"

Testing

Five new unit tests cover the passing forward-slash path, a non-external series, the backslash trigger, a bytestring path, and multiple external files. All tests in test_image_series.py pass; ruff and black are clean. Also ran end-to-end through inspect_nwbfile on a written NWB file containing one backslash and one forward-slash ImageSeries — the check fires on the backslash one only.

🤖 Generated with Claude Code

Flag backslashes in ImageSeries.external_file paths. These are produced by
platform-dependent path joining on Windows and silently fail to resolve on
POSIX systems and against archive asset keys such as those used by DANDI.

Registered at BEST_PRACTICE_VIOLATION to parallel the sibling
check_image_series_external_file_relative.

Closes #697

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Comment thread src/nwbinspector/checks/_image_series.py
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.12%. Comparing base (9be6250) to head (fbaeac7).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##              dev     #717      +/-   ##
==========================================
+ Coverage   79.71%   83.12%   +3.40%     
==========================================
  Files          48       48              
  Lines        1923     1932       +9     
==========================================
+ Hits         1533     1606      +73     
+ Misses        390      326      -64     
Files with missing lines Coverage Δ
src/nwbinspector/checks/__init__.py 100.00% <ø> (ø)
src/nwbinspector/checks/_image_series.py 96.00% <100.00%> (+0.87%) ⬆️

... and 5 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@bendichter
bendichter marked this pull request as ready for review July 15, 2026 18:50
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.

Add check for backslashes in ImageSeries external_file paths

2 participants