Skip to content

fix(core): keep files excluded by FinderConfig out of found files - #387

Merged
roxblnfk merged 7 commits into
1.xfrom
fix/finder-excluded-files
Oct 13, 2026
Merged

roxblnfk merged 7 commits into
1.xfrom
fix/finder-excluded-files

Conversation

@roxblnfk

@roxblnfk roxblnfk commented Oct 13, 2026 •

Copy link
Copy Markdown
Member

What was changed

  • A file listed in FinderConfig excludes is no longer returned by Finder, and an excluded file outside the includes is no longer added to the results. Before, test discovery ran tests from a file excluded in a suite's location.
  • Excludes now match paths spelled in another letter case on Windows or reached through a symlink. Before, such an exclude was ignored, or the filter hung.
  • An exclude now covers everything beneath it, even above an include: include core/X with exclude core finds nothing.
  • Excluded directories outside the includes are no longer scanned just to be filtered out.

Why?

Excluded files were passed to Symfony append(), and appended entries skip every filter, including files() and withFilter(). Found while reporting unloaded source files for coverage (#383), where an excluded file showed up as fully uncovered.

Checklist

  • Tested
    • Unit tests added
    • tests/Tokenizer suite passes locally on Windows and Linux

@roxblnfk
roxblnfk requested a review from a team as a code owner October 13, 2026 06:05
@codecov

codecov Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

A file listed in `exclude` was appended to the Symfony finder, and appended entries skip every filter, so the excluded file came back from the search, and one outside the includes was added to it. Test discovery ran tests from a file excluded in a suite's `location`. Excluded paths now only feed the filter, which also stops excluded directories from being scanned for nothing.

The filter walks up from a file to its include directory; when the include is spelled unlike the real path (letter case, a symlink), it never met it and looped forever at the filesystem root. The walk now stops there and keeps the file.

Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
…symlinks

Excludes are resolved through realpath() and compared to found entries with
Path::isWithin(), which ignores letter case on Windows. This replaces the
string walk up the parent directories.

Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
test(core): pin that a file listed in include survives an excluded directory

Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
An empty result used to pass the per-entry isDir() loop, so over-exclusion went unnoticed.

Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
@roxblnfk
roxblnfk force-pushed the fix/finder-excluded-files branch from 2797ee3 to 3ec3a24 Compare October 13, 2026 09:39
…de filter

A dangling symlink has no real path, and passing `false` on to `Path::create()` threw a TypeError whenever excludes were configured.

Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
Without pruning, Symfony walked every entry beneath an excluded directory only to filter each one out, and failed on an excluded directory it could not read.

Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
@roxblnfk
roxblnfk force-pushed the fix/finder-excluded-files branch from 85e849a to 7c46d17 Compare October 13, 2026 15:22
@roxblnfk
roxblnfk merged commit 9bbcdd7 into 1.x Oct 13, 2026
29 of 31 checks passed
@roxblnfk
roxblnfk deleted the fix/finder-excluded-files branch October 13, 2026 15:28
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.

1 participant