Skip to content

fix(sharding): prevent shard filters from matching classes outside their partition - #1884

Open
MrPunyapal wants to merge 2 commits into
pestphp:5.xfrom
MrPunyapal:fix/shard-filter-class-boundary
Open

fix(sharding): prevent shard filters from matching classes outside their partition#1884
MrPunyapal wants to merge 2 commits into
pestphp:5.xfrom
MrPunyapal:fix/shard-filter-class-boundary

Conversation

@MrPunyapal

@MrPunyapal MrPunyapal commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator

What:

  • Bug Fix

Description:

Shard filters are matched by PHPUnit as unanchored regular expressions against Class::method, so any class whose name started with another class assigned to a different shard also ran there (e.g. Tests\Feature\After matching Tests\Feature\AfterAll). Splitting Pest's own suite 1/2 executed 218 tests in both shards; with this change, zero.

The generated filter now requires :: right after each class path. A class that is also the prefix of another class in the same shard keeps its own alternative.

Before: Tests\\Feature\\(After|AfterAll) → after: Tests\\Feature\\(After(?=::)|AfterAll(?=::))

@MrPunyapal
MrPunyapal force-pushed the fix/shard-filter-class-boundary branch from 3fd33cf to 4c96d43 Compare August 27, 2026 16:30
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