tewip-ai 0.69.4 → 0.69.5
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.
|
@@ -19,6 +19,54 @@ import { TEWIP_LABEL } from './jira-command.js';
|
|
|
19
19
|
import { trackerFromEnv, trackerHelp } from './trackers.js';
|
|
20
20
|
/** Bugs Tewip filed carry this as well, so a second run finds them and does not file again. */
|
|
21
21
|
export const BUG_LABEL = 'tewip-bug';
|
|
22
|
+
/**
|
|
23
|
+
* How sure Tewip has to be before it puts a person's name on a ticket.
|
|
24
|
+
*
|
|
25
|
+
* Named and exported because of what it collides with. Phase 55 capped a model-only diagnosis at
|
|
26
|
+
* **0.45** - the model is not reliable enough for its word alone to be acted on - and this bar has
|
|
27
|
+
* been 0.8 since Phase 10. The two numbers were set eight weeks apart and never compared, and
|
|
28
|
+
* together they mean **a bug only the model recognised can never be filed**, whatever it says.
|
|
29
|
+
*
|
|
30
|
+
* Measured over 1,964 real failures from five public projects (gutenberg, supabase, lxdui, penpot,
|
|
31
|
+
* jupyterlab) with the rules alone: **20 REAL_BUG verdicts, of which 1 reaches 0.8.** Four of the
|
|
32
|
+
* five projects produce none at all. On a real jest report of a plain value mismatch - "Expected: 4,
|
|
33
|
+
* Received: 3", which is as clear as a real bug gets - the verdict is REAL_BUG at 0.45 from the
|
|
34
|
+
* model, and `bugs` files nothing.
|
|
35
|
+
*
|
|
36
|
+
* The bar is not lowered here. A ticket opened on a model's unsupported word is the thing this
|
|
37
|
+
* project exists not to do, and 0.45 is the honest reading of how often that word is right. What
|
|
38
|
+
* changes is that the refusal now says which of the two reasons applies, because "none of them is a
|
|
39
|
+
* real bug Tewip is confident about" was being printed for twenty failures Tewip had called real
|
|
40
|
+
* bugs.
|
|
41
|
+
*/
|
|
42
|
+
export const CONFIDENT_ENOUGH = 0.8;
|
|
43
|
+
/**
|
|
44
|
+
* Why nothing was filed - the two cases told apart.
|
|
45
|
+
*
|
|
46
|
+
* The old sentence was one line for both: `${items.length} failure(s), and none of them is a real
|
|
47
|
+
* bug Tewip is confident about (${kinds})`, where `kinds` was every category present. On a real
|
|
48
|
+
* report it printed **"none of them is a real bug Tewip is confident about (REAL_BUG, ENV)"** -
|
|
49
|
+
* listing REAL_BUG inside the sentence denying there was one. A reader cannot tell from that whether
|
|
50
|
+
* Tewip found nothing or found something it would not act on, and those call for opposite next steps.
|
|
51
|
+
*/
|
|
52
|
+
export function whyNothingWasFiled(items, unsure) {
|
|
53
|
+
const kinds = [...new Set(items.filter((i) => i.diagnosis.category !== 'REAL_BUG').map((i) => i.diagnosis.category))];
|
|
54
|
+
if (unsure.length === 0) {
|
|
55
|
+
return (`${items.length} failure(s), and none of them looks like the application being wrong` +
|
|
56
|
+
`${kinds.length > 0 ? ` - they are ${kinds.join(', ')}` : ''}. Nothing was filed, which is the point.`);
|
|
57
|
+
}
|
|
58
|
+
const highest = Math.max(...unsure.map((i) => i.diagnosis.confidence));
|
|
59
|
+
const byModel = unsure.filter((i) => /AI|gpt|claude|model/i.test(i.source)).length;
|
|
60
|
+
return [
|
|
61
|
+
`${items.length} failure(s). ${unsure.length} of them Tewip reads as a real bug, and none of those reaches the ${CONFIDENT_ENOUGH.toFixed(2)} confidence it requires before opening a ticket in somebody's name - the highest is ${highest.toFixed(2)}.`,
|
|
62
|
+
byModel > 0
|
|
63
|
+
? `${byModel === unsure.length ? 'All' : `${byModel}`} of them came from the AI layer, which is capped at 0.45 on purpose: a model's unsupported word is not enough to file on. A person's correction on the failure in CI, or a rule that agrees, is what would make it enough.`
|
|
64
|
+
: '',
|
|
65
|
+
`Nothing was filed. These are listed in \`tewip explain\` with their evidence${kinds.length > 0 ? `, alongside ${kinds.join(', ')} failures that are deliberately never filed` : ''}.`,
|
|
66
|
+
]
|
|
67
|
+
.filter(Boolean)
|
|
68
|
+
.join('\n');
|
|
69
|
+
}
|
|
22
70
|
const isBlobDir = (path) => statSync(path).isDirectory() && readdirSync(path).some((f) => /^report.*\.zip$/.test(f));
|
|
23
71
|
/** The bug report a developer actually wants: what failed, what it did, and why Tewip believes it. */
|
|
24
72
|
export function bugBody(item, runUrl) {
|
|
@@ -76,15 +124,15 @@ export async function runBugs(cmd) {
|
|
|
76
124
|
const items = await buildItems(imported.records, index, { dataset: `local: ${name}`, llm: llmFromEnv(), corrections: loadCorrections(historyDir) });
|
|
77
125
|
// Only what Tewip itself calls a bug, and only when it is confident enough to put a person's name
|
|
78
126
|
// on it. Everything else is deliberately left out.
|
|
79
|
-
const bugs = items.filter((i) => i.diagnosis.category === 'REAL_BUG' && i.diagnosis.confidence >=
|
|
127
|
+
const bugs = items.filter((i) => i.diagnosis.category === 'REAL_BUG' && i.diagnosis.confidence >= CONFIDENT_ENOUGH);
|
|
128
|
+
const unsure = items.filter((i) => i.diagnosis.category === 'REAL_BUG' && i.diagnosis.confidence < CONFIDENT_ENOUGH);
|
|
80
129
|
const lines = [`Report: ${cmd.report}`, `Project: ${cmd.projectKey}`, ''];
|
|
81
130
|
if (items.length === 0) {
|
|
82
131
|
console.log('Every test in that report passed. Nothing to file.');
|
|
83
132
|
return [];
|
|
84
133
|
}
|
|
85
134
|
if (bugs.length === 0) {
|
|
86
|
-
|
|
87
|
-
console.log(`${items.length} failure(s), and none of them is a real bug Tewip is confident about (${kinds}). Nothing was filed, which is the point.`);
|
|
135
|
+
console.log(whyNothingWasFiled(items, unsure));
|
|
88
136
|
return [];
|
|
89
137
|
}
|
|
90
138
|
const tracker = chosen?.tracker.canWrite() ? chosen.tracker : null;
|
|
@@ -122,8 +170,17 @@ export async function runBugs(cmd) {
|
|
|
122
170
|
lines.push(` filed ${key}: ${summary}`);
|
|
123
171
|
filed++;
|
|
124
172
|
}
|
|
125
|
-
|
|
126
|
-
|
|
173
|
+
// `items.length - bugs.length` was described as "flaky tests, environment or test data", which is
|
|
174
|
+
// untrue of a REAL_BUG sitting below the bar: a bug Tewip is 0.45 sure of was being counted, in
|
|
175
|
+
// print, as a flaky test. And the `max` cap was silent - the same mistake `prove` made in Phase 58,
|
|
176
|
+
// where a sampled answer read as a whole one.
|
|
177
|
+
const notBugs = items.length - bugs.length - unsure.length;
|
|
178
|
+
const beyondCap = Math.max(0, bugs.length - cmd.max);
|
|
179
|
+
lines.push('', `${bugs.length} of ${items.length} failure(s) look like real bugs.` +
|
|
180
|
+
(notBugs > 0 ? ` ${notBugs} were flaky tests, environment or test data and were deliberately not filed.` : '') +
|
|
181
|
+
(unsure.length > 0 ? ` ${unsure.length} more look like real bugs but below the ${CONFIDENT_ENOUGH.toFixed(2)} confidence needed to file one, so they were not.` : ''));
|
|
182
|
+
if (beyondCap > 0)
|
|
183
|
+
lines.push(`${beyondCap} were past the --max ${cmd.max} limit and were not looked at. Raise it with \`--max ${bugs.length}\`.`);
|
|
127
184
|
lines.push(cmd.create ? `${filed} ticket(s) created in ${tracker?.name}. Tewip never moves, assigns or closes one.` : 'Nothing was created. Add --create to file them.');
|
|
128
185
|
console.log(lines.join('\n'));
|
|
129
186
|
return bugs;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tewip-ai",
|
|
3
|
-
"version": "0.69.
|
|
3
|
+
"version": "0.69.5",
|
|
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": [
|