Repository navigation
fix: match file filters against paths relative to the repository root - #624
Merged
sng-asyncfunc merged 1 commit intoNov 6, 2026
Merged
Conversation
iterate_files passed absolute paths to _should_process_file, so the excluded and included directory rules were checked against every directory above the repository too. A local repository under /tmp, build or docs had every file excluded, and included_dirs matched all files when the root sat under a directory with the same name. Compare the rules with the path relative to the root instead. Signed-off-by: Lucas Barros <lucasbarros.kam@gmail.com>
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.
iterate_filespasses the absolute file path to_should_process_file, which then checksexcluded_dirsandincluded_dirsagainst every part ofPath.resolve().parts. So the rules also match the directories above the repository root:/tmp/...,.../build/...,.../docs/...,.../out/...,.../bin/...(all in the defaultexcluded_dirs) gets every file excluded. The wiki structure gets an empty file tree and indexing ends with "No valid documents with embeddings found".included_dirs=["src"]includes every file when the repository itself lives under somesrc/directory.tests/conftest.pyalready works around this by removing./tmp/and./temp/from the config, since pytest'stmp_pathsits under/tmpon Linux.The fix compares the rules with the path relative to the root (
p.relative_to(root_dir)), whichiterate_filesalready computed for its return value. Both callers (read_all_documentsand the wiki structure tree) go throughiterate_files, so they keep matching each other.Tests
Added two cases to
tests/test_config.py, using the real defaultfile_filters(noexclude_test_configfixture):tmp/,build/anddocs/parents keeps its files;included_dirs=["folder"]with the root under afolder/parent only returnsfolder/code.py.All four fail on
main(empty set / extra file) and pass with the change.pytest tests/test_config.py tests/backend: same 7 pre-existing failures intest_wiki_tasks_api.pybefore and after, everything else passes.ruff checkandruff format --checkare clean.This touches the same lines as #593 (nested directory rules). The two are independent, but whichever lands second needs a small rebase.