tewip-ai 0.70.2 → 0.70.4

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/README.md CHANGED
@@ -1035,6 +1035,11 @@ import does not show.
1035
1035
  notice it, then run the **whole** suite to find out which tests really catch it. A failure is dropping a
1036
1036
  catching test.
1037
1037
 
1038
+ Re-derived on 2026-10-17 against a suite that had grown to 1,136 tests: **9 judged changes, 0 catching
1039
+ tests lost, 5.7% of the suite selected.** The harness refuses to report at all when it could not read
1040
+ which tests caught anything, because a selection cannot be shown safe by changes nothing was observed
1041
+ to catch.
1042
+
1038
1043
  | Project | Judged cases | Catching test lost | Suite selected |
1039
1044
  | --- | --- | --- | --- |
1040
1045
  | This repository (node --test, 76 test files) | 8 | **0** | 7–9% |
@@ -7,6 +7,7 @@
7
7
  import { existsSync, mkdirSync, readdirSync, writeFileSync } from 'node:fs';
8
8
  import { dirname, join, resolve } from 'node:path';
9
9
  import { HistoryIndex } from '../history.js';
10
+ import { loadCorrections } from '../corrections.js';
10
11
  import { buildItems } from '../../outlets/items.js';
11
12
  import { digestView } from '../../outlets/views/digest.js';
12
13
  import { qualityView } from '../../outlets/views/quality.js';
@@ -36,9 +37,13 @@ export async function runNote(cmd) {
36
37
  continue;
37
38
  totalRuns += runs.length;
38
39
  totalFailures += records.length;
39
- // The diagnoses were made when each failure happened; nothing is judged again here.
40
+ // The diagnoses were made when each failure happened; nothing is judged again here - except
41
+ // where a person overruled one. This note is the report a lead reads, and it was printing
42
+ // "Diagnosis: LOCATOR_DRIFT, confidence 0.95, source: rules" about a test somebody had corrected
43
+ // to TIMING, because the corrections were never loaded here at all.
40
44
  const index = new HistoryIndex(records, runs);
41
- const items = await buildItems(records, index, { dataset: `history: ${name}`, llm: null, reuseStoredDiagnoses: true });
45
+ const where = join(cmd.root, '.tewip', 'history', name);
46
+ const items = await buildItems(records, index, { dataset: `history: ${name}`, llm: null, reuseStoredDiagnoses: true, corrections: loadCorrections(where) });
42
47
  parts.push(`## ${name}`, '', `${runs.length} run(s), ${records.length} failure(s).`, '');
43
48
  if (items.length > 0) {
44
49
  parts.push(digestView(items, runs, `history: ${name}`).markdown, '', qualityView(items, `history: ${name}`).markdown, '');
@@ -4,6 +4,7 @@ import { extractLocator } from '../engine/error-parse.js';
4
4
  import { decide } from '../engine/decide.js';
5
5
  import { lastFailedAttempts } from '../engine/dataset.js';
6
6
  import { failingCodeOf } from '../engine/llm/context.js';
7
+ import { applyCorrection, correctionFor } from '../engine/corrections.js';
7
8
  import { diagnosePipeline } from '../engine/pipeline.js';
8
9
  import { truncate } from '../engine/signature.js';
9
10
  import { designDebt } from './design-debt.js';
@@ -47,7 +48,24 @@ export async function buildItems(records, index, { dataset, llm, reuseStoredDiag
47
48
  const stored = reuseStoredDiagnoses ? cases.map((c) => c.diagnosis) : cases.map(() => undefined);
48
49
  const missing = cases.filter((_, i) => !stored[i]);
49
50
  const fresh = await diagnosePipeline(missing, index, llm, { corrections });
50
- const diagnoses = stored.map((d) => d ?? fresh.shift());
51
+ // A correction outranks a stored diagnosis, which it did not.
52
+ //
53
+ // `diagnosePipeline` applies corrections, but only to the failures in `missing` - the ones with no
54
+ // stored diagnosis. `explain` stores one for every failure it diagnoses, so on any history a team
55
+ // actually keeps, **every** failure has one and a correction reached none of them. Field-tested:
56
+ // three real corrections of real diagnoses, `learn` reported the pattern perfectly, and the weekly
57
+ // note still said "Diagnosis: LOCATOR_DRIFT, confidence 0.95, source: rules" about a test a person
58
+ // had overruled to TIMING - directly against what `correct` had just promised in print, "Tewip will
59
+ // answer with your decision the next time that test fails the same way, and say it was yours."
60
+ //
61
+ // This is the whole hierarchy of the product: what the team decided beats what the tool decided.
62
+ // Fixing it here fixes every caller at once, which matters because three of them reuse stored
63
+ // diagnoses and two of those did not even pass the corrections along.
64
+ const diagnoses = cases.map((record, i) => {
65
+ const own = stored[i] ?? fresh.shift();
66
+ const correction = corrections.length > 0 ? correctionFor(record, corrections) : null;
67
+ return correction ? applyCorrection(own, correction) : own;
68
+ });
51
69
  const failedAttempts = new Map();
52
70
  for (const r of records)
53
71
  failedAttempts.set(`${r.runId} ${r.testId}`, [...(failedAttempts.get(`${r.runId} ${r.testId}`) ?? []), r]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tewip-ai",
3
- "version": "0.70.2",
3
+ "version": "0.70.4",
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": [