skillfit 0.11.0 → 0.13.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.
Files changed (172) hide show
  1. package/README.md +68 -104
  2. package/README.zh-CN.md +68 -101
  3. package/benches/README.md +6 -2
  4. package/dist/cli.js +28 -16
  5. package/dist/commands/bench-calibration.js +5 -1
  6. package/dist/commands/bench-check-report.js +1 -34
  7. package/dist/commands/bench-draft.js +167 -0
  8. package/dist/commands/bench-draft.test.js +168 -0
  9. package/dist/commands/bench-manage.js +5 -4
  10. package/dist/commands/bench-source.js +101 -0
  11. package/dist/commands/bench-source.test.js +84 -0
  12. package/dist/commands/bench.js +157 -328
  13. package/dist/commands/eval-api-failure.test.js +46 -0
  14. package/dist/commands/eval-layout.test.js +126 -0
  15. package/dist/commands/eval-preflight-error.js +9 -0
  16. package/dist/commands/eval-preflight.js +4 -11
  17. package/dist/commands/eval-report.js +6 -459
  18. package/dist/commands/eval.js +7 -32
  19. package/dist/commands/install.js +14 -98
  20. package/dist/harness/agent-preflight.js +18 -2
  21. package/dist/harness/bench-check.js +277 -0
  22. package/dist/harness/bench-diagnostics.js +34 -0
  23. package/dist/harness/bench-location.js +29 -0
  24. package/dist/harness/bench-location.test.js +33 -0
  25. package/dist/harness/bench.js +8 -3
  26. package/dist/harness/eval-acceptance.js +1 -1
  27. package/dist/harness/eval-audit.js +2 -2
  28. package/dist/harness/eval-manifest.js +456 -0
  29. package/dist/harness/evaluation-layout.js +30 -0
  30. package/dist/harness/executors/api.js +20 -7
  31. package/dist/harness/executors/cli.js +15 -25
  32. package/dist/harness/experiment-session.js +5 -15
  33. package/dist/harness/hash.js +3 -1
  34. package/dist/harness/runner.js +5 -4
  35. package/dist/harness/single-arm-audit.js +1 -1
  36. package/dist/harness/trigger.js +1 -1
  37. package/dist/harness/verifier-timeout.js +8 -0
  38. package/dist/harness/verifier-timeout.test.js +76 -0
  39. package/dist/install/constants.js +1 -0
  40. package/dist/install/transaction.js +112 -0
  41. package/docs/README.md +65 -0
  42. package/docs/architecture.md +86 -0
  43. package/docs/archive-delivery.md +83 -0
  44. package/docs/archive-inventory.md +91 -0
  45. package/docs/bench-authoring.md +23 -3
  46. package/docs/bench-drafting.md +75 -0
  47. package/docs/case-management.md +12 -1
  48. package/docs/eval-agent-preflight.md +15 -2
  49. package/docs/eval-costs.md +28 -2
  50. package/docs/eval-planning.md +14 -0
  51. package/docs/evaluation-input-snapshots.md +20 -4
  52. package/docs/evaluation-reports.md +1 -1
  53. package/docs/first-real-eval.md +28 -3
  54. package/docs/growth-roadmap-2026-10.md +23 -18
  55. package/docs/package-contents.md +73 -0
  56. package/docs/plans/2026-10-17-workflow-foundations.md +37 -2
  57. package/docs/plans/2026-10-20-archive-replay-verification.json +125 -0
  58. package/docs/plans/2026-10-20-archive-source-verification.json +256 -0
  59. package/docs/plans/2026-10-20-delivery-verification.json +146 -0
  60. package/docs/plans/2026-10-20-docs-architecture-cleanup.md +233 -0
  61. package/docs/plans/2026-10-20-install-transactions-and-archive-delivery.md +233 -0
  62. package/docs/plans/2026-10-21-npm-0.13.0-release.md +41 -0
  63. package/docs/releases/0.11.0-ci-registry-install.json +130 -0
  64. package/docs/releases/0.11.0-feature-smoke.json +1576 -0
  65. package/docs/releases/0.11.0-local-attempt-1.json +24 -0
  66. package/docs/releases/0.11.0-local-attempt-1.log +19 -0
  67. package/docs/releases/0.11.0-local-registry-install.json +25 -0
  68. package/docs/releases/0.11.0-registry-metadata.json +33 -0
  69. package/docs/releases/0.11.0-signatures.txt +12 -0
  70. package/docs/releases/0.11.0-verification.json +95 -0
  71. package/docs/releases/0.11.0.md +54 -11
  72. package/docs/releases/0.12.0-attestation-check.json +22 -0
  73. package/docs/releases/0.12.0-attestations.json +155 -0
  74. package/docs/releases/0.12.0-ci-registry-install.json +90 -0
  75. package/docs/releases/0.12.0-feature-smoke.json +34 -0
  76. package/docs/releases/0.12.0-feature-smoke.mjs +73 -0
  77. package/docs/releases/0.12.0-foundations-smoke.json +1576 -0
  78. package/docs/releases/0.12.0-local-registry-install.json +75 -0
  79. package/docs/releases/0.12.0-preparation-attempt-1.json +22 -0
  80. package/docs/releases/0.12.0-registry-metadata.json +96 -0
  81. package/docs/releases/0.12.0-signatures.txt +6 -0
  82. package/docs/releases/0.12.0-verification.json +99 -0
  83. package/docs/releases/0.12.0.md +82 -0
  84. package/docs/releases/0.13.0-feature-smoke.mjs +114 -0
  85. package/docs/releases/0.13.0-preparation.json +102 -0
  86. package/docs/releases/0.13.0.md +61 -0
  87. package/docs/releases/archive-delivery-smoke.mjs +37 -0
  88. package/docs/reproducible-offline-example.md +1 -1
  89. package/docs/schemas/agent-preflight.schema.json +1 -1
  90. package/docs/verifier-contract.md +9 -0
  91. package/evidence/README.md +24 -1
  92. package/evidence/archive-catalog.v1.json +8044 -0
  93. package/evidence/fetch-archives.mjs +211 -0
  94. package/package.json +9 -2
  95. package/skills/skillfit/SKILL.md +25 -5
  96. package/dist/cli.test.js +0 -193
  97. package/dist/commands/bench-calibration.test.js +0 -237
  98. package/dist/commands/bench-check-json.test.js +0 -242
  99. package/dist/commands/bench-manage.test.js +0 -87
  100. package/dist/commands/bench.test.js +0 -1162
  101. package/dist/commands/bundle.test.js +0 -142
  102. package/dist/commands/calibration-cli.test.js +0 -145
  103. package/dist/commands/doctor.test.js +0 -280
  104. package/dist/commands/eval-agent-preflight.test.js +0 -245
  105. package/dist/commands/eval-export-modes.test.js +0 -350
  106. package/dist/commands/eval-export.test.js +0 -279
  107. package/dist/commands/eval-interruption.test.js +0 -238
  108. package/dist/commands/eval-preflight.test.js +0 -382
  109. package/dist/commands/eval-report.test.js +0 -367
  110. package/dist/commands/eval.test.js +0 -503
  111. package/dist/commands/evaluation-report.test.js +0 -243
  112. package/dist/commands/install.test.js +0 -555
  113. package/dist/commands/replay-cancellation.test.js +0 -105
  114. package/dist/commands/report.test.js +0 -110
  115. package/dist/commands/setup.test.js +0 -150
  116. package/dist/commands/upstream.test.js +0 -139
  117. package/dist/commands/workflow-entrypoints.test.js +0 -137
  118. package/dist/docs.test.js +0 -154
  119. package/dist/frontmatter.test.js +0 -49
  120. package/dist/harness/bench.test.js +0 -109
  121. package/dist/harness/bundle.test.js +0 -71
  122. package/dist/harness/codex-usage.test.js +0 -87
  123. package/dist/harness/costs.test.js +0 -92
  124. package/dist/harness/eval-budget.test.js +0 -237
  125. package/dist/harness/eval-component.test.js +0 -770
  126. package/dist/harness/eval-efficiency.test.js +0 -56
  127. package/dist/harness/execution-timing.test.js +0 -61
  128. package/dist/harness/executors/api.test.js +0 -136
  129. package/dist/harness/executors/cli.test.js +0 -510
  130. package/dist/harness/executors/mock.test.js +0 -43
  131. package/dist/harness/experiment-session.test.js +0 -317
  132. package/dist/harness/installed-skill.test.js +0 -162
  133. package/dist/harness/interruption.test.js +0 -31
  134. package/dist/harness/judge-accounting.test.js +0 -216
  135. package/dist/harness/judge.test.js +0 -181
  136. package/dist/harness/kimi-usage.test.js +0 -62
  137. package/dist/harness/native-diff.test.js +0 -53
  138. package/dist/harness/oss-lru-cache.test.js +0 -79
  139. package/dist/harness/oss-normalize-url.test.js +0 -64
  140. package/dist/harness/oss-regression-witness.test.js +0 -89
  141. package/dist/harness/oss-skill-followup.test.js +0 -59
  142. package/dist/harness/prompt.test.js +0 -48
  143. package/dist/harness/receipts.test.js +0 -148
  144. package/dist/harness/report.test.js +0 -297
  145. package/dist/harness/runner.test.js +0 -635
  146. package/dist/harness/skill-revision.test.js +0 -148
  147. package/dist/harness/stats.test.js +0 -124
  148. package/dist/harness/target.test.js +0 -60
  149. package/dist/harness/trigger.test.js +0 -261
  150. package/dist/harness/verifier-summary.test.js +0 -99
  151. package/dist/harness/verifier.test.js +0 -128
  152. package/dist/harness/waza-behavior.test.js +0 -139
  153. package/dist/mcp/probe.test.js +0 -139
  154. package/evidence/artifacts/2026-10-12-diagnosing-revision/calibration-records.tar.gz +0 -0
  155. package/evidence/artifacts/2026-10-12-diagnosing-revision/interrupted-records.tar.gz +0 -0
  156. package/evidence/artifacts/2026-10-12-diagnosing-revision/validation-records.tar.gz +0 -0
  157. package/evidence/artifacts/2026-10-12-diagnosing-v2/regression-records.tar.gz +0 -0
  158. package/evidence/artifacts/2026-10-12-diagnosing-v2/transfer-records.tar.gz +0 -0
  159. package/evidence/artifacts/2026-10-12-normalize-url-v2-available/readiness-records.tar.gz +0 -0
  160. package/evidence/artifacts/2026-10-12-normalize-url-v2-comparison/records.tar.gz +0 -0
  161. package/evidence/artifacts/2026-10-12-normalize-url-v2-recovery/records.tar.gz +0 -0
  162. package/evidence/artifacts/2026-10-12-normalize-url-v2-validated/records.tar.gz +0 -0
  163. package/evidence/artifacts/2026-10-13-debugging-completed-development/package.tar.gz +0 -0
  164. package/evidence/artifacts/2026-10-13-debugging-controls-and-sleep-stop/package.tar.gz +0 -0
  165. package/evidence/artifacts/2026-10-13-debugging-development-stops/package.tar.gz +0 -0
  166. package/evidence/artifacts/2026-10-14-debugging-followup-routing-stop/package.tar.gz +0 -0
  167. package/evidence/artifacts/2026-10-14-debugging-independent-validation/package.tar.gz +0 -0
  168. package/evidence/artifacts/2026-10-14-debugging-reading-pilot-and-cost-review/package.tar.gz +0 -0
  169. package/evidence/artifacts/2026-10-14-debugging-spending-stop/package.tar.gz +0 -0
  170. package/evidence/artifacts/2026-10-15-independent-comparison-regression-stop/package.tar.gz +0 -0
  171. package/evidence/artifacts/2026-10-15-native-diff-mechanism/package.tar.gz +0 -0
  172. package/evidence/artifacts/2026-10-15-receiver-mechanism-stop/package.tar.gz +0 -0
@@ -1,367 +0,0 @@
1
- import assert from 'node:assert/strict';
2
- import { mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
3
- import { tmpdir } from 'node:os';
4
- import { join } from 'node:path';
5
- import { test } from 'node:test';
6
- import { parseEvalReport, renderEvalMarkdown, runEvalReport } from './eval-report.js';
7
- import { summarizeCosts } from '../harness/costs.js';
8
- function manifest() {
9
- const conditions = {
10
- baseline: { passes: 0, trials: 2, errors: 0 },
11
- treatment: { passes: 2, trials: 2, errors: 0 },
12
- };
13
- return {
14
- schemaVersion: 4,
15
- runGroup: 'eval-20261001-123000',
16
- createdAt: '2026-10-01T12:30:00.000Z',
17
- target: { kind: 'skill', name: 'test | Skill', bundleSha256: 'a'.repeat(64) },
18
- bench: { name: 'one-task', contentSha256: 'b'.repeat(64), taskCount: 1 },
19
- executor: { kind: 'mock', model: 'mock' },
20
- trials: 2,
21
- tasks: [{ id: 'task-1', conditions, deltaPassRate: 1, verdict: 'inconclusive' }],
22
- overall: {
23
- conditions,
24
- deltaPassRate: 1,
25
- verdict: 'inconclusive',
26
- verdictReason: 'only 2 discordant pairs',
27
- stats: {
28
- discordant: { improved: 2, regressed: 0 },
29
- mcnemarP: 0.5,
30
- deltaCi: { lo: 0.2, hi: 1, resamples: 1000 },
31
- },
32
- },
33
- warnings: ['Only two pairs: indicative.', 'Avoid <private> details.'],
34
- };
35
- }
36
- function sixPairManifest() {
37
- const value = manifest();
38
- const conditions = {
39
- baseline: { passes: 3, trials: 6, errors: 0 },
40
- treatment: { passes: 6, trials: 6, errors: 0 },
41
- };
42
- value['trials'] = 6;
43
- const task = value['tasks'][0];
44
- Object.assign(task, { conditions, deltaPassRate: 0.5 });
45
- const overall = value['overall'];
46
- Object.assign(overall, { conditions, deltaPassRate: 0.5, verdictReason: 'only 3 discordant pairs' });
47
- Object.assign(overall['stats'], {
48
- discordant: { improved: 3, regressed: 0 },
49
- mcnemarP: 0.25,
50
- });
51
- return value;
52
- }
53
- function costManifest() {
54
- const value = manifest();
55
- value['trials'] = 3;
56
- const run = (input, passed) => ({ executorInvoked: true, passed, error: null,
57
- durationSeconds: 5, tokens: { input, cachedInput: input / 2, output: 2 }, usageStatus: 'final' });
58
- const baseline = [run(10, true), run(10, true), run(10, true)];
59
- const treatment = [run(8, true), run(8, false), { ...run(3, false), durationSeconds: 600, error: 'timeout', usageStatus: 'partial' }];
60
- const costs = summarizeCosts({ baseline, treatment }, { baseline: baseline.slice(0, 2), treatment: treatment.slice(0, 2) });
61
- const conditions = { baseline: { passes: 2, trials: 2, errors: 0 }, treatment: { passes: 1, trials: 2, errors: 1 } };
62
- const task = value['tasks'][0];
63
- Object.assign(task, { costs: structuredClone(costs), conditions, deltaPassRate: -0.5 });
64
- const overall = value['overall'];
65
- Object.assign(overall, { costs: structuredClone(costs), conditions, deltaPassRate: -0.5 });
66
- Object.assign(overall['stats'], { discordant: { improved: 0, regressed: 1 }, mcnemarP: 1 });
67
- return value;
68
- }
69
- test('report eval renders cache partitions, per-success regressions and timeout lower bounds', () => {
70
- const output = renderEvalMarkdown(parseEvalReport(costManifest()));
71
- assert.match(output, /Input tokens \| 20 \| 16 \| -20.0% \| 10.000 \/ 16.000 \| \+60.0%/);
72
- assert.match(output, /Input tokens \| 30 \| >= 19 \| n\/a \| 10.000 \/ >= 19.000 \| n\/a/);
73
- assert.match(output, /Cached input tokens/);
74
- assert.match(output, /Uncached input tokens/);
75
- assert.match(output, /Elapsed seconds/);
76
- assert.match(output, /3\/0\/0 \/ 2\/1\/0/);
77
- assert.match(output, /Overall verdict: \*\*inconclusive\*\*/);
78
- });
79
- test('report eval rejects contradictory cost counts, coverage, partitions and pooled totals', () => {
80
- const scenarios = [
81
- (costs) => { costs.paired.baseline.passes = 0; },
82
- (costs) => { costs.attempts.treatment.metrics.input.coverage.unknown = 3; },
83
- (costs) => { costs.attempts.treatment.metrics.cachedInput.knownTotal = 100; },
84
- (costs) => { costs.attempts.baseline.metrics.output.knownTotal = 99; },
85
- (costs) => { costs.notInvoked.baseline = 1; },
86
- ];
87
- for (const change of scenarios) {
88
- const value = costManifest();
89
- change(value['overall']['costs']);
90
- assert.throws(() => parseEvalReport(value), /costs|cache partition/);
91
- }
92
- });
93
- test('report eval keeps legacy manifests readable and does not infer missing cache usage', () => {
94
- const output = renderEvalMarkdown(parseEvalReport(manifest()));
95
- assert.match(output, /all-invocation costs were not recorded in this legacy manifest/);
96
- assert.ok(!output.includes('| Cached input tokens | 0'));
97
- });
98
- test('report eval renders a v4 manifest without executing an agent or writing a file', async () => {
99
- const dir = mkdtempSync(join(tmpdir(), 'skillfit-eval-report-'));
100
- try {
101
- const path = join(dir, 'manifest.json');
102
- const original = `${JSON.stringify(manifest(), null, 2)}\n`;
103
- writeFileSync(path, original);
104
- const output = [];
105
- await runEvalReport(path, (line) => output.push(line));
106
- assert.equal(readFileSync(path, 'utf8'), original);
107
- assert.equal(output.length, 1);
108
- const markdown = output[0] ?? '';
109
- assert.match(markdown, /# skillfit evaluation: test \\\| Skill/);
110
- assert.match(markdown, /Synthetic harness run/);
111
- assert.match(markdown, /\| task-1 \| 0\/2 \(0%\) \| 2\/2 \(100%\) \| 0\/0 \| \+100\.0pp \| inconclusive \|/);
112
- assert.match(markdown, /McNemar exact p=0\.5000/);
113
- assert.match(markdown, /\[\+20\.0pp, \+100\.0pp\]/);
114
- assert.match(markdown, /below the conclusive bar \(8 tasks × 5 trials\)/);
115
- assert.match(markdown, /&lt;private&gt;/);
116
- assert.ok(!markdown.includes(dir), 'the portable report must not include the local manifest directory');
117
- }
118
- finally {
119
- rmSync(dir, { recursive: true, force: true });
120
- }
121
- });
122
- test('report eval refuses old and incomplete manifests instead of guessing metrics', () => {
123
- assert.throws(() => parseEvalReport({ ...manifest(), schemaVersion: 3 }), /Only evaluation manifest schemaVersion 4/);
124
- const missing = manifest();
125
- delete missing['overall'];
126
- assert.throws(() => parseEvalReport(missing), /overall must be an object/);
127
- const wrongCount = manifest();
128
- wrongCount['bench'] = { name: 'one-task', contentSha256: 'b'.repeat(64), taskCount: 2 };
129
- assert.throws(() => parseEvalReport(wrongCount), /taskCount must match/);
130
- const wrongVerdict = manifest();
131
- wrongVerdict['overall']['verdict'] = 'effective';
132
- assert.throws(() => parseEvalReport(wrongVerdict), /disagrees with the metrics protocol/);
133
- const impossiblePairs = manifest();
134
- const impossibleStats = impossiblePairs['overall']['stats'];
135
- impossibleStats['discordant'] = { improved: 3, regressed: 0 };
136
- assert.throws(() => parseEvalReport(impossiblePairs), /exceeds the number of paired trials/);
137
- });
138
- test('report eval rejects discordant counts that contradict the marginal pass difference', () => {
139
- const value = sixPairManifest();
140
- const overall = value['overall'];
141
- overall['verdict'] = 'effective';
142
- overall['verdictReason'] = '6 improvements, no regressions';
143
- Object.assign(overall['stats'], {
144
- discordant: { improved: 6, regressed: 0 },
145
- mcnemarP: 0.03125,
146
- });
147
- const original = JSON.stringify(value);
148
- assert.throws(() => parseEvalReport(value), /discordant\.improved - regressed disagrees with treatment\.passes - baseline\.passes/);
149
- assert.equal(JSON.stringify(value), original, 'contradictory counts must not be silently corrected');
150
- });
151
- for (const { passes, sharedOutcome } of [
152
- { passes: 1, sharedOutcome: 'success' },
153
- { passes: 5, sharedOutcome: 'failure' },
154
- ]) {
155
- test(`report eval rejects negative shared ${sharedOutcome} counts despite a matching pass difference`, () => {
156
- const value = sixPairManifest();
157
- const task = value['tasks'][0];
158
- const overall = value['overall'];
159
- const conditions = task['conditions'];
160
- conditions['baseline']['passes'] = passes;
161
- conditions['treatment']['passes'] = passes;
162
- task['deltaPassRate'] = 0;
163
- overall['deltaPassRate'] = 0;
164
- Object.assign(overall['stats'], {
165
- discordant: { improved: 2, regressed: 2 },
166
- mcnemarP: 1,
167
- });
168
- assert.throws(() => parseEvalReport(value), new RegExp(`discordant implies a negative shared ${sharedOutcome} count`));
169
- });
170
- }
171
- test('report eval accepts the valid six-pair counterpart as inconclusive without changing its data', () => {
172
- const value = sixPairManifest();
173
- const original = JSON.stringify(value);
174
- const report = parseEvalReport(value);
175
- assert.equal(report.overall.improved, 3);
176
- assert.equal(report.overall.regressed, 0);
177
- assert.equal(report.overall.mcnemarP, 0.25);
178
- assert.equal(report.overall.verdict, 'inconclusive');
179
- assert.match(renderEvalMarkdown(report), /McNemar exact p=0\.2500/);
180
- assert.equal(JSON.stringify(value), original);
181
- });
182
- test('report eval renders missing CI and zero graded trials explicitly', () => {
183
- const value = manifest();
184
- const overall = value['overall'];
185
- const stats = overall['stats'];
186
- stats['deltaCi'] = null;
187
- stats['discordant'] = { improved: 0, regressed: 0 };
188
- stats['mcnemarP'] = 1;
189
- const conditions = {
190
- baseline: { passes: 0, trials: 0, errors: 2 },
191
- treatment: { passes: 0, trials: 0, errors: 2 },
192
- };
193
- overall['conditions'] = conditions;
194
- overall['deltaPassRate'] = 0;
195
- value['tasks'][0]['conditions'] = conditions;
196
- value['tasks'][0]['deltaPassRate'] = 0;
197
- const markdown = renderEvalMarkdown(parseEvalReport(value));
198
- assert.match(markdown, /0\/0 \(n\/a\)/);
199
- assert.match(markdown, /Δpass 95% CI: n\/a \(no graded pairs\)/);
200
- });
201
- test('report eval escapes Markdown links supplied by manifest fields', () => {
202
- const value = manifest();
203
- value['target']['name'] = '[click](https://example.com)';
204
- const markdown = renderEvalMarkdown(parseEvalReport(value));
205
- assert.match(markdown, /# skillfit evaluation: \\\[click\\\]\(https:\/\/example\.com\)/);
206
- assert.ok(!markdown.includes('# skillfit evaluation: [click]('));
207
- });
208
- test('real reports show facets, bounded decisions and partial token coverage', () => {
209
- const value = manifest();
210
- value['executor'] = { kind: 'cli', model: 'cli-configured' };
211
- value['inputMode'] = 'workspace';
212
- const task = value['tasks'][0];
213
- const conditions = task['conditions'];
214
- Object.assign(conditions['baseline'], { meanScore: 0.5, tokens: { input: 40, output: 2 }, tokenCoverage: { input: 1, output: 1 } });
215
- Object.assign(conditions['treatment'], { meanScore: 1, tokens: { input: 80, output: 4 }, tokenCoverage: { input: 2, output: 2 } });
216
- task['scoreDelta'] = 0.5;
217
- value['overall']['scoreDelta'] = 0.5;
218
- task['facets'] = [{ name: 'Unicode | regression', baselinePassRate: 0.5, treatmentPassRate: 1, baselineTrials: 2, treatmentTrials: 2 }];
219
- const stats = value['overall']['stats'];
220
- stats['scoreDeltaCi'] = { lo: 0.1, hi: 0.9, resamples: 1000 };
221
- const markdown = renderEvalMarkdown(parseEvalReport(value));
222
- assert.match(markdown, /Input: workspace/);
223
- assert.match(markdown, /\| task-1 \| 50\.0% \| 100\.0% \| \+50\.0pp \|/);
224
- assert.match(markdown, /Unicode \\\| regression \| 50\.0% \(n=2\) \| 100\.0% \(n=2\)/);
225
- assert.match(markdown, /Δscore 95% paired-bootstrap CI/);
226
- assert.match(markdown, /Inconclusive means insufficient evidence/);
227
- assert.match(markdown, /Activation is unmeasured/);
228
- assert.match(markdown, /Token coverage is partial or unrecorded/);
229
- assert.match(markdown, /40 \(1\/2 runs\)/);
230
- assert.ok(!markdown.includes('Mean recorded tokens'));
231
- });
232
- test('report warns when only the graded-score interval collapses', () => {
233
- const value = manifest();
234
- const task = value['tasks'][0];
235
- const conditions = task['conditions'];
236
- conditions['baseline']['meanScore'] = 0.5;
237
- conditions['treatment']['meanScore'] = 1;
238
- task['scoreDelta'] = 0.5;
239
- const overall = value['overall'];
240
- overall['scoreDelta'] = 0.5;
241
- overall['stats']['scoreDeltaCi'] = { point: 0.5, lo: 0.5, hi: 0.5, resamples: 1000 };
242
- const markdown = renderEvalMarkdown(parseEvalReport(value));
243
- assert.match(markdown, /Δpass 95% paired-bootstrap CI.*\[\+20\.0pp, \+100\.0pp\]/);
244
- assert.match(markdown, /Δscore 95% paired-bootstrap CI.*\[\+50\.0pp, \+50\.0pp\]/);
245
- assert.match(markdown, /interval collapsed.*does not establish zero uncertainty/);
246
- });
247
- test('report rejects invalid score, facet denominators, coverage and unpaired counts', () => {
248
- for (const mutate of [
249
- (task) => { task['facets'] = [{ name: 'a', baselinePassRate: 1, treatmentPassRate: 1, baselineTrials: 3, treatmentTrials: 2 }]; },
250
- (task) => { task['facets'] = [{ name: 'a', baselinePassRate: 0.5, treatmentPassRate: 1, baselineTrials: 1, treatmentTrials: 2 }]; },
251
- (task) => { (task['conditions']['baseline'])['meanScore'] = 2; },
252
- (task) => { (task['conditions']['baseline'])['tokenCoverage'] = { input: 3, output: 0 }; },
253
- (task) => { (task['conditions']['baseline'])['trials'] = 1; },
254
- ]) {
255
- const value = manifest();
256
- mutate(value['tasks'][0]);
257
- assert.throws(() => parseEvalReport(value), /denominator|finite number|coverage cannot|tokenCoverage cannot|equal numbers/);
258
- }
259
- const value = manifest();
260
- value['inputMode'] = 'invented';
261
- assert.throws(() => parseEvalReport(value), /inputMode must/);
262
- });
263
- test('legacy real manifests expose missing provenance and token coverage', () => {
264
- const value = manifest();
265
- value['executor'] = { kind: 'cli', model: 'cli-configured' };
266
- const conditions = value['overall']['conditions'];
267
- for (const c of Object.values(conditions))
268
- c['tokens'] = { input: 40, output: 2 };
269
- const markdown = renderEvalMarkdown(parseEvalReport(value));
270
- assert.match(markdown, /legacy manifest; not recorded/);
271
- assert.match(markdown, /coverage unrecorded/);
272
- assert.match(markdown, /Token coverage is partial or unrecorded/);
273
- });
274
- test('report cross-checks usage coverage/totals and rejects contradictory usage', () => {
275
- for (const mutation of ['coverage-total', 'token-total', 'missing-task', 'null-tokens', 'zero-coverage']) {
276
- const value = JSON.parse(JSON.stringify(manifest()));
277
- const task = value['tasks'][0];
278
- const taskConditions = task['conditions'];
279
- const overallConditions = value['overall']['conditions'];
280
- for (const conditions of [taskConditions, overallConditions]) {
281
- for (const c of Object.values(conditions))
282
- Object.assign(c, {
283
- tokens: { input: 10, output: 2 }, tokenCoverage: { input: 1, output: 1 },
284
- });
285
- }
286
- const aggregate = overallConditions['baseline'];
287
- if (mutation === 'coverage-total')
288
- aggregate['tokenCoverage'] = { input: 2, output: 2 };
289
- if (mutation === 'token-total')
290
- aggregate['tokens'] = { input: 10000, output: 1000 };
291
- if (mutation === 'missing-task')
292
- delete taskConditions['baseline']['tokenCoverage'];
293
- if (mutation === 'null-tokens')
294
- aggregate['tokens'] = null;
295
- if (mutation === 'zero-coverage')
296
- aggregate['tokenCoverage'] = { input: 0, output: 0 };
297
- assert.throws(() => parseEvalReport(value), /disagrees with task totals|requires recorded coverage|contradicts/);
298
- }
299
- });
300
- test('report refuses a score interval without paired score observations', () => {
301
- const value = manifest();
302
- const overall = value['overall'];
303
- overall['stats']['scoreDeltaCi'] = { lo: 0.5, hi: 1, resamples: 1000 };
304
- assert.throws(() => parseEvalReport(value), /scoreDeltaCi requires paired graded score observations/);
305
- });
306
- test('report uses completed scale after exclusions and warns about collapsed intervals', () => {
307
- const value = manifest();
308
- value['executor'] = { kind: 'cli', model: 'offline' };
309
- value['trials'] = 5;
310
- value['bench']['taskCount'] = 8;
311
- const conditions = { baseline: { passes: 0, trials: 4, errors: 1 }, treatment: { passes: 4, trials: 4, errors: 0 } };
312
- value['tasks'] = Array.from({ length: 8 }, (_, i) => ({ id: `task-${i}`, conditions, deltaPassRate: 1, verdict: 'inconclusive' }));
313
- Object.assign(value['overall'], {
314
- conditions: { baseline: { passes: 0, trials: 32, errors: 8 }, treatment: { passes: 32, trials: 32, errors: 0 } },
315
- verdict: 'effective', stats: { discordant: { improved: 32, regressed: 0 }, mcnemarP: 2 * 0.5 ** 32,
316
- deltaCi: { lo: 1, hi: 1, resamples: 1000 } },
317
- });
318
- const markdown = renderEvalMarkdown(parseEvalReport(value));
319
- assert.match(markdown, /Completed scale: 0 task\(s\) have at least 5 graded pairs/);
320
- assert.match(markdown, /interval collapsed.*does not establish zero uncertainty/);
321
- assert.match(markdown, /No installation recommendation: this run is below 8 tasks/);
322
- });
323
- test('managed reports refuse contradictory call coverage and withhold decisions for partial runs', () => {
324
- const value = manifest();
325
- value['executor'] = { kind: 'cli', model: 'offline' };
326
- value['experiment'] = { schemaVersion: 1, status: 'stopped', plannedCalls: 4, maxCalls: 4,
327
- callsStarted: 1, callsFinished: 1, stopReason: 'frozen input changed', planSha256: 'c'.repeat(64) };
328
- const markdown = renderEvalMarkdown(parseEvalReport(value));
329
- assert.match(markdown, /Session: stopped; 1\/4/);
330
- assert.match(markdown, /No installation decision: the frozen experiment/);
331
- assert.match(markdown, /Retain this run without adding replacement samples/);
332
- const session = value['experiment'];
333
- for (const change of [{ status: 'completed', stopReason: null }, { callsStarted: 5 }, { callsFinished: 2 },
334
- { maxCalls: 3 }, { status: 'incomplete', stopReason: null, callsStarted: 4, callsFinished: 4 }]) {
335
- assert.throws(() => parseEvalReport({ ...value, experiment: { ...session, ...change } }), /contradict/);
336
- }
337
- });
338
- test('installed report validates and distinguishes read observations from task quality', () => {
339
- const value = manifest();
340
- value['inputMode'] = 'workspace';
341
- value['skillDelivery'] = { mode: 'installed', installDir: '.agents/skills' };
342
- value['target']['files'] = ['SKILL.md'];
343
- const conditions = value['overall']['conditions'];
344
- conditions['baseline']['skillReads'] = { observed: 0, unobserved: 0, unknown: 2 };
345
- conditions['treatment']['skillReads'] = { observed: 1, unobserved: 1, unknown: 0 };
346
- const markdown = renderEvalMarkdown(parseEvalReport(value));
347
- assert.match(markdown, /Native Skill-read observations/);
348
- assert.match(markdown, /no body read was detected/);
349
- assert.match(markdown, /not trigger precision or recall/);
350
- conditions['treatment']['skillReads'] = { observed: 2, unobserved: 1, unknown: 0 };
351
- assert.throws(() => parseEvalReport(value), /must total the surviving graded trials/);
352
- });
353
- test('revision report rejects incompatible baseline identities and preserves legacy interpretation', () => {
354
- const value = manifest();
355
- assert.ok(!renderEvalMarkdown(parseEvalReport(value)).includes('Baseline Skill:'));
356
- value['inputMode'] = 'workspace';
357
- value['skillDelivery'] = { mode: 'installed', installDir: '.agents/skills' };
358
- value['target']['files'] = ['SKILL.md'];
359
- const baseline = { kind: 'skill', name: 'test | Skill', bundleSha256: 'b'.repeat(64), sourceDir: '/previous', files: ['SKILL.md'] };
360
- value['baselineTarget'] = baseline;
361
- assert.match(renderEvalMarkdown(parseEvalReport(value)), /Baseline Skill: test \\?\| Skill/);
362
- for (const change of [{ kind: 'rules' }, { name: 'different' }, { bundleSha256: 'a'.repeat(64) },
363
- { bundleSha256: 'bad' }, { files: ['script.js'] }, { sourceDir: '' }]) {
364
- assert.throws(() => parseEvalReport({ ...value, baselineTarget: { ...baseline, ...change } }), /baselineTarget|fingerprint/);
365
- }
366
- assert.throws(() => parseEvalReport({ ...value, skillDelivery: undefined }), /requires two installed Skill/);
367
- });