[test optimization] Fix attempt to fix in vitest #7785
[test optimization] Fix attempt to fix in vitest #7785juan-fernandez merged 2 commits intomasterfrom
Conversation
The shouldFlipStatus flag was resetting task.result.state to 'pass' for ALL attempt-to-fix tests during retries. Per spec, only quarantined or disabled test results should be ignored. Split into two flags: - shouldTrackStatuses: tracks retry outcomes for all ATF/EFD tests (needed to compute attemptToFixPassed/Failed) - shouldFlipStatus: only resets vitest's internal state for EFD and quarantined/disabled ATF tests, so plain ATF failures still propagate to the exit code Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Overall package sizeSelf size: 4.98 MB Dependency sizes| name | version | self size | total size | |------|---------|-----------|------------| | import-in-the-middle | 3.0.0 | 81.15 kB | 815.98 kB | | dc-polyfill | 0.1.10 | 26.73 kB | 26.73 kB |🤖 This report was automatically generated by heaviest-objects-in-the-universe |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #7785 +/- ##
==========================================
- Coverage 80.36% 80.34% -0.02%
==========================================
Files 743 743
Lines 32296 32296
==========================================
- Hits 25955 25949 -6
- Misses 6341 6347 +6 Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This comment has been minimized.
This comment has been minimized.
BenchmarksBenchmark execution time: 2026-03-16 11:21:53 Comparing candidate commit 326f14c in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 234 metrics, 26 unstable metrics. |
Adds a regression test that fails the first attempt but passes all retries. Before the fix, shouldFlipStatus would reset intermediate states to 'pass' for all ATF tests, causing vitest to exit with code 0 even though the test is not quarantined/disabled. The new test asserts exit code 1 for this case. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
What does this PR do?
Fixes the vitest instrumentation to only suppress attempt-to-fix (ATF) test failures when the test is also quarantined or disabled, aligning with the test management spec.
Motivation
The spec states: "If test is tagged with
test.test_management.is_test_disabledortest.test_management.is_quarantined, then the test results are ignored."The
shouldFlipStatusflag was resettingtask.result.stateto'pass'for ALL ATF tests during retries, causing vitest to exit with code 0 even for plain ATF tests that fail. Only quarantined/disabled ATF tests should have their failures suppressed.