Skip to content

Reject nonexistent requested paths during asset discovery - #1932

Draft
AtomicGlance wants to merge 1 commit into
dandi:masterfrom
AtomicGlance:fix/1094-missing-path
Draft

AtomicGlance wants to merge 1 commit into
dandi:masterfrom
AtomicGlance:fix/1094-missing-path

Conversation

@AtomicGlance

@AtomicGlance AtomicGlance commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #1094.
find_dandi_files() currently allows nonexistent paths to be silently ignored or represented as assets. This change checks every requested root before yielding any files and raises FileNotFoundError with the offending filename.
The check uses lstat() so broken symlinks remain discoverable. This preserves DANDI’s missing-content handling for unfetched DataLad files. Existing empty directories still return no assets, and no additional recursive walk is introduced.
Tests cover missing paths with recognized, unrecognized, and hidden names; both allow_all settings; multiple requested roots; empty directories; and broken symlinks. A CLI regression test also confirms that dandi validate retains its existing missing-path error.
Validation on Windows with Python 3.13:

  • File tests excluding upload integration tests: 28 passed, 1 skipped.
  • Focused discovery and CLI tests: 12 passed, 1 skipped.
  • Black, isort, flake8, and mypy dandi passed.

@codecov

codecov Bot commented Sep 26, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 88.57143% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.34%. Comparing base (c3931cc) to head (63ee56a).

Files with missing lines Patch % Lines
dandi/tests/test_files.py 85.18% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1932      +/-   ##
==========================================
+ Coverage   78.29%   78.34%   +0.04%     
==========================================
  Files          92       92              
  Lines       14068    14103      +35     
==========================================
+ Hits        11015    11049      +34     
- Misses       3053     3054       +1     
Flag Coverage Δ
unittests 78.34% <88.57%> (+0.04%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

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

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.

make find_dandi_files raise FileNotFoundError exception if path is invalid

1 participant