tewip-ai 0.65.0 → 0.66.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/engine/flaky/flaky.js +24 -1
- package/package.json +1 -1
|
@@ -70,7 +70,9 @@ const flakyShare = (test) => {
|
|
|
70
70
|
* quarantine needs the test to have failed in several runs, and to be unreliable rather than
|
|
71
71
|
* consistently wrong.
|
|
72
72
|
*/
|
|
73
|
-
|
|
73
|
+
/** The verdict for one test, and the sentence that justifies it. Exported so it can be tested
|
|
74
|
+
* against the shapes real projects produce rather than only through a whole report. */
|
|
75
|
+
export function decide(test, { minRuns, alwaysFailsAbove }) {
|
|
74
76
|
const rate = share(test);
|
|
75
77
|
const percent = `${Math.round(rate * 100)}% of the ${test.totalRuns} run(s) it was in`;
|
|
76
78
|
const realBugs = test.categories.find((c) => c.category === 'REAL_BUG')?.count ?? 0;
|
|
@@ -80,6 +82,27 @@ function decide(test, { minRuns, alwaysFailsAbove }) {
|
|
|
80
82
|
if (rate > alwaysFailsAbove && test.totalRuns >= minRuns) {
|
|
81
83
|
return { verdict: 'fix-now', why: `it fails in ${percent}. That is not flakiness, it is a test that does not work - hiding it would hide whatever it is telling you.` };
|
|
82
84
|
}
|
|
85
|
+
// Observed, not inferred. A test that failed and then passed on a retry within the same run did
|
|
86
|
+
// both on the same code, same commit, same machine: that is not evidence of flakiness, it is
|
|
87
|
+
// flakiness, and no diagnosis is needed to see it.
|
|
88
|
+
//
|
|
89
|
+
// This mattered more than it looks. Everything below rests on `flakyShare`, which counts how many
|
|
90
|
+
// failures a *previous* `tewip explain` already called flaky - so on a project's raw history,
|
|
91
|
+
// where nothing has been diagnosed yet, no test could ever qualify and the command recommended
|
|
92
|
+
// quarantining nothing at all. Measured on 1,305 real failures from WordPress/gutenberg: **124 of
|
|
93
|
+
// the 180 failing tests had recovered on retry, and all 124 were filed under "watch"**. One of
|
|
94
|
+
// them had done it 93 separate times.
|
|
95
|
+
//
|
|
96
|
+
// Phase 56 is where this comes from: of the signals available when a test fails, non-determinism
|
|
97
|
+
// is the one that is genuinely decisive, and it costs nothing to read.
|
|
98
|
+
if (test.recoveredOnRetry > 0 && test.failedRuns >= minRuns) {
|
|
99
|
+
const times = test.recoveredOnRetry === 1 ? 'once' : `${test.recoveredOnRetry} times`;
|
|
100
|
+
const spread = test.branches.length > 1 ? ` It failed on ${test.branches.length} different branches, so it is the test rather than one person's change.` : '';
|
|
101
|
+
return {
|
|
102
|
+
verdict: 'quarantine',
|
|
103
|
+
why: `it failed and then passed on a retry in the same run ${times}: the same code did both, which is what a flaky test is. It failed in ${percent}.${spread}`,
|
|
104
|
+
};
|
|
105
|
+
}
|
|
83
106
|
if (test.failedRuns >= minRuns && flakyShare(test) >= 0.5) {
|
|
84
107
|
const spread = test.branches.length > 1 ? ` It failed on ${test.branches.length} different branches, so it is the test rather than one person's change.` : '';
|
|
85
108
|
return { verdict: 'quarantine', why: `it failed in ${percent}, and Tewip read most of those as the test being unreliable.${spread}` };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tewip-ai",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.66.0",
|
|
4
4
|
"mcpName": "io.github.hmamut39/tewip",
|
|
5
5
|
"description": "Tewip finds why each failing test failed - real bug, flaky test, environment, test data or changed selector - for any stack, from the command line, CI, or your editor.",
|
|
6
6
|
"keywords": [
|