[Bug]: [mutate] Windows: the 5 s minimum per-mutant timeout is shorter than a child boot under Xdebug, so untested mutants are scored as killed
I maintainer di solito rispondono entro 5 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 30/100
Direzione di ricerca
Start in MutationTest::calculateTimeout() and MutationTest::start(), where the per-mutant timeout is computed and the child's arguments and XDEBUG_MODE are set, then in hasFinished(), which maps ProcessTimedOutException to Timeout. The mutation code lives in pestphp/pest-plugin-mutate, which the issue says is where to work. Done means a mutant that no test covers is reported as untested rather than killed, with the fix chosen by the maintainers from the options listed.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
What Happened
On Windows, pest --mutate scores some mutants as killed when no test can kill them, because their child process times out before the covering test has even run.
MutationTest::calculateTimeout() gives each mutant run the initial suite duration plus max(5, 20%):
return (int) ($initialTestSuiteDuration + max(5, $initialTestSuiteDuration * 0.2));
When the targeted test set is small (a single test file, as when mutating one class), the initial suite takes ~2 s, so each child gets ~7 s. On Windows, booting a child Pest process (Laravel app) takes 4 to 7 s on its own, partly because children inherit XDEBUG_MODE=coverage and the --coverage-php=... argument (see the TODO: filter arguments to remove unnecessary stuff (Teamcity, Coverage, etc.) in MutationTest::start()). Some legitimate runs exceed the budget, hasFinished() maps the ProcessTimedOutException to Timeout, and the score counts Timeout as killed.
Expected: a mutant that no test kills is reported as untested, regardless of process start-up time.
How to Reproduce
-
On Windows, with Xdebug, write a test that executes a class but asserts nothing about it:
it('runs the code without checking anything', function () { (new SomeValueObject(120.5, 80.0))->format(); expect(true)->toBeTrue(); }); -
XDEBUG_MODE=coverage php vendor/bin/pest tests/Unit/SanityTest.php --mutate --class='App\Domain\SomeValueObject' --covered-only --no-cache
Result: Mutations: 15 untested, 6 timeout, 0 tested, score 28.57 %. No test can kill any of these 21 mutants, so the expected score is 0 %.
With the minimum raised from 5 to 30 s on Windows (max(PHP_OS_FAMILY === 'Windows' ? 30 : 5, ...)), the same run reports 21 untested, 0 tested, score 0.00 %.
This was measured with the child-launch fix from #1916 applied (otherwise every mutant is scored as killed and this bug is invisible).
Sample Repository
None (private project). The reproduction above only needs any Laravel app with Pest and one class.
Pest Version
3.8.6 (pestphp/pest-plugin-mutate v3.0.5, symfony/process v7.4.8)
PHP Version
8.4.15 ZTS (x64), Xdebug 3.5.3
Operation System
Windows
Notes
Filed here because issues are disabled on pestphp/pest-plugin-mutate.
Related: #1843 (timed-out mutants scored as killed, different root cause: a deadlock) and #1916 (child process fails to launch on Windows, also scored as killed). pestphp/pest-plugin-mutate#45 would make all three visible instead of silent.
Possible fixes, from least to most invasive:
- do not pass coverage arguments/env to the per-mutant children (the existing TODO), which removes most of the start-up cost;
- a higher minimum timeout, or a
--mutate-timeoutoption; - report
Timeoutseparately from kills in the score.
- Lingua principale
- PHP
- Stelle
- 11.8k
- Fork
- 559
- Merge medio
- 5g 23h
- PR unite (30g)
- 24
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di pestphp/pest
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 5 giorni
-
[Bug]: --mutate hides unreadable files, so mutants behind a failed read can never be killedForse di nuovo libera Una pull request per questa issue è stata chiusa senza essere unita. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
I maintainer di solito rispondono entro 5 giorni
-
[Bug]: [mutate] Windows: @pest-mutate-ignore comments land on line 1 in files with LF line endingsForse già presa @webdevsamran l’ha presa 57 giorni fa. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 5 giorni
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 80/100
I maintainer di solito rispondono entro 5 giorni
-
[pest-plugin-browser] Page::waitForLoadState() never sends its message — waitForEvent() is a silent no-opForse già presa @asllanmaciel l’ha presa 70 giorni fa. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
pestphp/pest#1892 · 2 commenti ·
I maintainer di solito rispondono entro 5 giorni
Tutte le issue di pestphp/pest
Issue simili
-
nginx update required due to NGINX2RootForse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 65/100
mailcow/mailcow-dockerized#7668 · 5 commenti · 2 reazioni ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
lara-zeus/spatie-translatable#80 ·
I maintainer di solito rispondono entro 1 giorno
-
small
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
uiowa/uiowa#10296 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
asyncapi/modelina#2709 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
My-Little-Forum/mylittleforum#937 ·