Skip to content

Accept broken symlinks as path arguments of dandi validate - #1937

Open
CodyCBakerPhD wants to merge 2 commits into
claude/docs-cli-options-syncfrom
claude/validate-broken-symlink-path
Open

CodyCBakerPhD wants to merge 2 commits into
claude/docs-cli-options-syncfrom
claude/validate-broken-symlink-path

Conversation

@CodyCBakerPhD

Copy link
Copy Markdown
Contributor

Another pre-PR splintered out of #1933 since it does actually affect the CLI today (granted, IDK why someone WOULD use the CLI in that way today on a datalad dataset, but they COULD)

dandi validate already handles annexed files whose content has not been fetched (the broken symlinks of a DataLad dataset) according to --missing-file-content: error, skip, or only-non-data. Those policies were applied only when such a file was reached through its directory, though: given directly on the command line, the file never got past argument parsing, because click.Path(exists=True) follows the link and rejected it with "does not exist". Check the path with lexists() instead, so that

dandi validate --missing-file-content=skip sub-01/sub-01.nwb

works the same as validating sub-01/, while paths that truly do not exist are still rejected with the same error.

Claude-Session: https://claude.ai/code/session_01HFhMPs6vF5zyeHDvPTvRcA

`dandi validate` already handles annexed files whose content has not been
fetched (the broken symlinks of a DataLad dataset) according to
`--missing-file-content`: `error`, `skip`, or `only-non-data`.  Those policies
were applied only when such a file was reached through its directory,
though: given directly on the command line, the file never got past argument
parsing, because `click.Path(exists=True)` follows the link and rejected it
with "does not exist".  Check the path with `lexists()` instead, so that

    dandi validate --missing-file-content=skip sub-01/sub-01.nwb

works the same as validating `sub-01/`, while paths that truly do not exist
are still rejected with the same error.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HFhMPs6vF5zyeHDvPTvRcA
@CodyCBakerPhD CodyCBakerPhD self-assigned this Sep 27, 2026
@CodyCBakerPhD
CodyCBakerPhD added this pull request to stack #1938 September 27, 2026 18:05
@codecov

codecov Bot commented Sep 27, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.33%. Comparing base (b294fc9) to head (4f316f7).

Additional details and impacted files
@@                       Coverage Diff                        @@
##           claude/docs-cli-options-sync    #1937      +/-   ##
================================================================
+ Coverage                         78.30%   78.33%   +0.02%     
================================================================
  Files                                92       92              
  Lines                             14068    14087      +19     
================================================================
+ Hits                              11016    11035      +19     
  Misses                             3052     3052              
Flag Coverage Δ
unittests 78.33% <100.00%> (+0.02%) ⬆️

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.

@CodyCBakerPhD CodyCBakerPhD added bug Something isn't working patch Increment the patch version when merged cmd-validate labels Sep 27, 2026
@CodyCBakerPhD
CodyCBakerPhD removed this pull request from stack #1938 September 27, 2026 19:28
@CodyCBakerPhD
CodyCBakerPhD added this pull request to stack #1940 September 27, 2026 19:29
@CodyCBakerPhD
CodyCBakerPhD removed this pull request from stack #1940 September 27, 2026 20:17
@CodyCBakerPhD
CodyCBakerPhD added this pull request to stack #1942 September 27, 2026 20:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working cmd-validate patch Increment the patch version when merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants