You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Refuse a Path That Does Not Exist, Rather Than Scanning the Caller's Directory
`discover` reads any argument that is neither a file nor a directory as
`.`, so a typo scanned the caller's directory while the rule set anchored
on the missing path's parent. The run then described one tree and judged it
by another, which is this PR's own subject in a different guise.
A missing path is now refused, naming each one.
Two existing cases passed fake paths as a mocking convenience and were
refused by the new check before reaching the guard they exist to test. They
use real directories now, which preserves what they assert rather than
loosening the check to accommodate them.
Two cases added: a missing path is refused, and an existing one is not.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
# Only a repository declares a model, so two of them refuse and anything else resolves to one anchor.
1111
1111
# TestScanRootDecidesTheRuleSet carries the cases and the reason each one exists.
1112
1112
scan_paths=a.pathsor ['.']
1113
+
# A path that does not exist is refused rather than absorbed.
1114
+
# `discover` reads a non-file, non-directory argument as `.`, so a typo scanned the caller's directory while the rule set anchored on the missing path's parent.
1115
+
absent= [pforpinscan_pathsifnotPath(p).exists()]
1116
+
ifabsent:
1117
+
print(f"error: requested path(s) do not exist: {', '.join(sorted(absent))}. Refusing "
1118
+
'rather than falling back to the current directory, which would scan one tree and '
1119
+
'choose the rule set from another.', file=sys.stderr)
0 commit comments