Repository navigation
fix(project): report no default entry when a path component is a file - #511
Merged
Merged
Conversation
A directory whose src is a regular file made the src/main.opy probe fail ENOTDIR and surface as EntryUnreadable; upstream-equivalent behavior is no default entry, matching the empty-directory result and provider targetNotFound. A direct entry through a file keeps EntryUnreadable. Fixes #497
e54-bot
commented
Oct 9, 2026
e54-bot
left a comment
Contributor
Author
There was a problem hiding this comment.
Verified locally — the fix is correct and both acceptance criteria hold.
AC check
- (a) Parity case: exercised end-to-end via
opy-cli check.d(dir containing a regular filesrc) ande(empty dir) now print the identicalcannot find a default OPY entryresult.DefaultEntryNotFound→is_entry_not_found() == true→targetNotFoundforDirectorytargets (crates/opy-provider/src/main.rs:1056-1060), matchinge. - (b) The new test asserts only the shared outcome (
is_entry_not_found()+DefaultEntryNotFound), which holds under both arms now handled — UnixNotADirectoryand WindowsNotFound— and its comment states it was verified on macOS.
Edge cases exercised (scratch dirs + opy-cli check):
- dir with file
srcAND a validmain.opy→ loadsmain.opy; first candidate wins and the probe order is unchanged. src/dir containingmain.opy→ normal case loads, unaffected.srcsymlink → regular file →DefaultEntryNotFound(fs::metadatafollows links →ENOTDIRarm).srcdangling symlink →DefaultEntryNotFound(NotFoundarm).main.opyas a directory →DefaultEntryNotFoundvia the pre-existing 'present but not a regular file' arm.file.opy/child.opydirect entry → stillEntryUnreadable(cannot read entry: Not a directory (os error 20)), preserving the issue's separate-question clause.
Windows reasoning: fs::metadata through a file component maps to NotFound there, and ERROR_DIRECTORY — if any Windows API surfaces it — maps to NotADirectory; both kinds are handled, so the d/e parity holds on Windows either way. MSRV 1.85 covers ErrorKind::NotADirectory (stable since 1.83).
Validation: cargo test -p opy-rs --lib project — 19/19 pass, incl. file_named_src_in_a_directory_is_default_entry_not_found. cargo fmt --all --check, cargo clippy -p opy-rs --lib -- -D warnings, and git diff --check clean.
Non-blocking notes:
- The neighboring
entry_inside_a_file_is_not_classified_as_missingcomment (project.rs:266-267) still claims canonicalization failsENOTDIR'on every platform' — per this issue's own findings Windows reports a not-found error for a path through a file, so that claim is stale. Worth correcting opportunistically. - The stated reason for the direct-entry case (
EntryUnreadable/entryUnreadable) is Unix-accurate; on Windows the same input likely classifiesEntryNotFound/entryNotFound, so it is not literally consistent across platforms. Distinguishing it there would require component-wise probing — fine to leave as the issue's 'separate question', but a comment or follow-up reference would keep the divergence explicit.
This was referenced Oct 9, 2026
Merged
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
src(and nomain.opy) was reportedEntryUnreadablebecause thesrc/main.opyprobe failedENOTDIR; it now reportsDefaultEntryNotFound, identical to an empty directory — andtargetNotFoundthrough the provider, matching the issue's parity case.file.opy/child.opy) keepsEntryUnreadable, per the issue's separate-question clause; the existingentry_inside_a_filetest already pins that reason.Fixes #497.
Test plan
cargo test -p opy-rs --lib project— 19/19, incl. newfile_named_src_in_a_directory_is_default_entry_not_found(asserts only the shared outcome; comment states verified platform)opy-cli checkond(filesrc) ande(empty) prints the identical default-entry errorcargo test --workspace --all-targets,cargo fmt,cargo clippy -D warningsclean