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.
- package/README.md +68 -104
- package/README.zh-CN.md +68 -101
- package/benches/README.md +6 -2
- package/dist/cli.js +28 -16
- package/dist/commands/bench-calibration.js +5 -1
- package/dist/commands/bench-check-report.js +1 -34
- package/dist/commands/bench-draft.js +167 -0
- package/dist/commands/bench-draft.test.js +168 -0
- package/dist/commands/bench-manage.js +5 -4
- package/dist/commands/bench-source.js +101 -0
- package/dist/commands/bench-source.test.js +84 -0
- package/dist/commands/bench.js +157 -328
- package/dist/commands/eval-api-failure.test.js +46 -0
- package/dist/commands/eval-layout.test.js +126 -0
- package/dist/commands/eval-preflight-error.js +9 -0
- package/dist/commands/eval-preflight.js +4 -11
- package/dist/commands/eval-report.js +6 -459
- package/dist/commands/eval.js +7 -32
- package/dist/commands/install.js +14 -98
- package/dist/harness/agent-preflight.js +18 -2
- package/dist/harness/bench-check.js +277 -0
- package/dist/harness/bench-diagnostics.js +34 -0
- package/dist/harness/bench-location.js +29 -0
- package/dist/harness/bench-location.test.js +33 -0
- package/dist/harness/bench.js +8 -3
- package/dist/harness/eval-acceptance.js +1 -1
- package/dist/harness/eval-audit.js +2 -2
- package/dist/harness/eval-manifest.js +456 -0
- package/dist/harness/evaluation-layout.js +30 -0
- package/dist/harness/executors/api.js +20 -7
- package/dist/harness/executors/cli.js +15 -25
- package/dist/harness/experiment-session.js +5 -15
- package/dist/harness/hash.js +3 -1
- package/dist/harness/runner.js +5 -4
- package/dist/harness/single-arm-audit.js +1 -1
- package/dist/harness/trigger.js +1 -1
- package/dist/harness/verifier-timeout.js +8 -0
- package/dist/harness/verifier-timeout.test.js +76 -0
- package/dist/install/constants.js +1 -0
- package/dist/install/transaction.js +112 -0
- package/docs/README.md +65 -0
- package/docs/architecture.md +86 -0
- package/docs/archive-delivery.md +83 -0
- package/docs/archive-inventory.md +91 -0
- package/docs/bench-authoring.md +23 -3
- package/docs/bench-drafting.md +75 -0
- package/docs/case-management.md +12 -1
- package/docs/eval-agent-preflight.md +15 -2
- package/docs/eval-costs.md +28 -2
- package/docs/eval-planning.md +14 -0
- package/docs/evaluation-input-snapshots.md +20 -4
- package/docs/evaluation-reports.md +1 -1
- package/docs/first-real-eval.md +28 -3
- package/docs/growth-roadmap-2026-10.md +23 -18
- package/docs/package-contents.md +73 -0
- package/docs/plans/2026-10-17-workflow-foundations.md +37 -2
- package/docs/plans/2026-10-20-archive-replay-verification.json +125 -0
- package/docs/plans/2026-10-20-archive-source-verification.json +256 -0
- package/docs/plans/2026-10-20-delivery-verification.json +146 -0
- package/docs/plans/2026-10-20-docs-architecture-cleanup.md +233 -0
- package/docs/plans/2026-10-20-install-transactions-and-archive-delivery.md +233 -0
- package/docs/plans/2026-10-21-npm-0.13.0-release.md +41 -0
- package/docs/releases/0.11.0-ci-registry-install.json +130 -0
- package/docs/releases/0.11.0-feature-smoke.json +1576 -0
- package/docs/releases/0.11.0-local-attempt-1.json +24 -0
- package/docs/releases/0.11.0-local-attempt-1.log +19 -0
- package/docs/releases/0.11.0-local-registry-install.json +25 -0
- package/docs/releases/0.11.0-registry-metadata.json +33 -0
- package/docs/releases/0.11.0-signatures.txt +12 -0
- package/docs/releases/0.11.0-verification.json +95 -0
- package/docs/releases/0.11.0.md +54 -11
- package/docs/releases/0.12.0-attestation-check.json +22 -0
- package/docs/releases/0.12.0-attestations.json +155 -0
- package/docs/releases/0.12.0-ci-registry-install.json +90 -0
- package/docs/releases/0.12.0-feature-smoke.json +34 -0
- package/docs/releases/0.12.0-feature-smoke.mjs +73 -0
- package/docs/releases/0.12.0-foundations-smoke.json +1576 -0
- package/docs/releases/0.12.0-local-registry-install.json +75 -0
- package/docs/releases/0.12.0-preparation-attempt-1.json +22 -0
- package/docs/releases/0.12.0-registry-metadata.json +96 -0
- package/docs/releases/0.12.0-signatures.txt +6 -0
- package/docs/releases/0.12.0-verification.json +99 -0
- package/docs/releases/0.12.0.md +82 -0
- package/docs/releases/0.13.0-feature-smoke.mjs +114 -0
- package/docs/releases/0.13.0-preparation.json +102 -0
- package/docs/releases/0.13.0.md +61 -0
- package/docs/releases/archive-delivery-smoke.mjs +37 -0
- package/docs/reproducible-offline-example.md +1 -1
- package/docs/schemas/agent-preflight.schema.json +1 -1
- package/docs/verifier-contract.md +9 -0
- package/evidence/README.md +24 -1
- package/evidence/archive-catalog.v1.json +8044 -0
- package/evidence/fetch-archives.mjs +211 -0
- package/package.json +9 -2
- package/skills/skillfit/SKILL.md +25 -5
- package/dist/cli.test.js +0 -193
- package/dist/commands/bench-calibration.test.js +0 -237
- package/dist/commands/bench-check-json.test.js +0 -242
- package/dist/commands/bench-manage.test.js +0 -87
- package/dist/commands/bench.test.js +0 -1162
- package/dist/commands/bundle.test.js +0 -142
- package/dist/commands/calibration-cli.test.js +0 -145
- package/dist/commands/doctor.test.js +0 -280
- package/dist/commands/eval-agent-preflight.test.js +0 -245
- package/dist/commands/eval-export-modes.test.js +0 -350
- package/dist/commands/eval-export.test.js +0 -279
- package/dist/commands/eval-interruption.test.js +0 -238
- package/dist/commands/eval-preflight.test.js +0 -382
- package/dist/commands/eval-report.test.js +0 -367
- package/dist/commands/eval.test.js +0 -503
- package/dist/commands/evaluation-report.test.js +0 -243
- package/dist/commands/install.test.js +0 -555
- package/dist/commands/replay-cancellation.test.js +0 -105
- package/dist/commands/report.test.js +0 -110
- package/dist/commands/setup.test.js +0 -150
- package/dist/commands/upstream.test.js +0 -139
- package/dist/commands/workflow-entrypoints.test.js +0 -137
- package/dist/docs.test.js +0 -154
- package/dist/frontmatter.test.js +0 -49
- package/dist/harness/bench.test.js +0 -109
- package/dist/harness/bundle.test.js +0 -71
- package/dist/harness/codex-usage.test.js +0 -87
- package/dist/harness/costs.test.js +0 -92
- package/dist/harness/eval-budget.test.js +0 -237
- package/dist/harness/eval-component.test.js +0 -770
- package/dist/harness/eval-efficiency.test.js +0 -56
- package/dist/harness/execution-timing.test.js +0 -61
- package/dist/harness/executors/api.test.js +0 -136
- package/dist/harness/executors/cli.test.js +0 -510
- package/dist/harness/executors/mock.test.js +0 -43
- package/dist/harness/experiment-session.test.js +0 -317
- package/dist/harness/installed-skill.test.js +0 -162
- package/dist/harness/interruption.test.js +0 -31
- package/dist/harness/judge-accounting.test.js +0 -216
- package/dist/harness/judge.test.js +0 -181
- package/dist/harness/kimi-usage.test.js +0 -62
- package/dist/harness/native-diff.test.js +0 -53
- package/dist/harness/oss-lru-cache.test.js +0 -79
- package/dist/harness/oss-normalize-url.test.js +0 -64
- package/dist/harness/oss-regression-witness.test.js +0 -89
- package/dist/harness/oss-skill-followup.test.js +0 -59
- package/dist/harness/prompt.test.js +0 -48
- package/dist/harness/receipts.test.js +0 -148
- package/dist/harness/report.test.js +0 -297
- package/dist/harness/runner.test.js +0 -635
- package/dist/harness/skill-revision.test.js +0 -148
- package/dist/harness/stats.test.js +0 -124
- package/dist/harness/target.test.js +0 -60
- package/dist/harness/trigger.test.js +0 -261
- package/dist/harness/verifier-summary.test.js +0 -99
- package/dist/harness/verifier.test.js +0 -128
- package/dist/harness/waza-behavior.test.js +0 -139
- package/dist/mcp/probe.test.js +0 -139
- package/evidence/artifacts/2026-10-12-diagnosing-revision/calibration-records.tar.gz +0 -0
- package/evidence/artifacts/2026-10-12-diagnosing-revision/interrupted-records.tar.gz +0 -0
- package/evidence/artifacts/2026-10-12-diagnosing-revision/validation-records.tar.gz +0 -0
- package/evidence/artifacts/2026-10-12-diagnosing-v2/regression-records.tar.gz +0 -0
- package/evidence/artifacts/2026-10-12-diagnosing-v2/transfer-records.tar.gz +0 -0
- package/evidence/artifacts/2026-10-12-normalize-url-v2-available/readiness-records.tar.gz +0 -0
- package/evidence/artifacts/2026-10-12-normalize-url-v2-comparison/records.tar.gz +0 -0
- package/evidence/artifacts/2026-10-12-normalize-url-v2-recovery/records.tar.gz +0 -0
- package/evidence/artifacts/2026-10-12-normalize-url-v2-validated/records.tar.gz +0 -0
- package/evidence/artifacts/2026-10-13-debugging-completed-development/package.tar.gz +0 -0
- package/evidence/artifacts/2026-10-13-debugging-controls-and-sleep-stop/package.tar.gz +0 -0
- package/evidence/artifacts/2026-10-13-debugging-development-stops/package.tar.gz +0 -0
- package/evidence/artifacts/2026-10-14-debugging-followup-routing-stop/package.tar.gz +0 -0
- package/evidence/artifacts/2026-10-14-debugging-independent-validation/package.tar.gz +0 -0
- package/evidence/artifacts/2026-10-14-debugging-reading-pilot-and-cost-review/package.tar.gz +0 -0
- package/evidence/artifacts/2026-10-14-debugging-spending-stop/package.tar.gz +0 -0
- package/evidence/artifacts/2026-10-15-independent-comparison-regression-stop/package.tar.gz +0 -0
- package/evidence/artifacts/2026-10-15-native-diff-mechanism/package.tar.gz +0 -0
- package/evidence/artifacts/2026-10-15-receiver-mechanism-stop/package.tar.gz +0 -0
|
@@ -1,297 +0,0 @@
|
|
|
1
|
-
import assert from 'node:assert/strict';
|
|
2
|
-
import { test } from 'node:test';
|
|
3
|
-
import { buildWarnings, formatDeltaPp, formatPassRate, formatPp1, renderSummary, verdictFor, } from './report.js';
|
|
4
|
-
import { mcnemarExactP, pairedDeltaBootstrapCI } from './stats.js';
|
|
5
|
-
function flags(passes, trials) {
|
|
6
|
-
return Array.from({ length: trials }, (_, i) => i < passes);
|
|
7
|
-
}
|
|
8
|
-
function discordants(outcomes) {
|
|
9
|
-
let improved = 0;
|
|
10
|
-
let regressed = 0;
|
|
11
|
-
for (let i = 0; i < outcomes.baseline.length; i++) {
|
|
12
|
-
if (outcomes.treatment[i] && !outcomes.baseline[i])
|
|
13
|
-
improved++;
|
|
14
|
-
else if (outcomes.baseline[i] && !outcomes.treatment[i])
|
|
15
|
-
regressed++;
|
|
16
|
-
}
|
|
17
|
-
return { improved, regressed };
|
|
18
|
-
}
|
|
19
|
-
function stats(passes, trials, meanScore = null, errors = 0) {
|
|
20
|
-
return { passes, trials, errors, passRate: passes / trials, meanScore, tokens: null };
|
|
21
|
-
}
|
|
22
|
-
function taskSummary(id, baselinePasses, treatmentPasses, trials, extras = {}) {
|
|
23
|
-
const baseline = stats(baselinePasses, trials);
|
|
24
|
-
const treatment = stats(treatmentPasses, trials);
|
|
25
|
-
const outcomes = { baseline: flags(baselinePasses, trials), treatment: flags(treatmentPasses, trials) };
|
|
26
|
-
const deltaPassRate = treatment.passRate - baseline.passRate;
|
|
27
|
-
const { verdict, reason } = verdictFor({ ...discordants(outcomes), deltaPassRate });
|
|
28
|
-
return {
|
|
29
|
-
id,
|
|
30
|
-
conditions: { baseline, treatment },
|
|
31
|
-
outcomes,
|
|
32
|
-
scores: {
|
|
33
|
-
baseline: Array(trials).fill(null),
|
|
34
|
-
treatment: Array(trials).fill(null),
|
|
35
|
-
},
|
|
36
|
-
deltaPassRate,
|
|
37
|
-
scoreDelta: null,
|
|
38
|
-
facets: [],
|
|
39
|
-
verifierNotes: [],
|
|
40
|
-
tokenDelta: null,
|
|
41
|
-
verdict,
|
|
42
|
-
verdictReason: reason,
|
|
43
|
-
judge: null,
|
|
44
|
-
...extras,
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
function manifestWith(tasks, executorKind = 'mock') {
|
|
48
|
-
const trials = tasks[0]?.conditions.baseline.trials ?? 0;
|
|
49
|
-
const totalPasses = (condition) => tasks.reduce((sum, task) => sum + task.conditions[condition].passes, 0);
|
|
50
|
-
const totalTrials = tasks.reduce((sum, task) => sum + task.conditions.baseline.trials, 0);
|
|
51
|
-
const baseline = stats(totalPasses('baseline'), totalTrials);
|
|
52
|
-
const treatment = stats(totalPasses('treatment'), totalTrials);
|
|
53
|
-
const deltaPassRate = treatment.passRate - baseline.passRate;
|
|
54
|
-
const discordant = tasks.reduce((acc, task) => {
|
|
55
|
-
const d = discordants(task.outcomes);
|
|
56
|
-
return { improved: acc.improved + d.improved, regressed: acc.regressed + d.regressed };
|
|
57
|
-
}, { improved: 0, regressed: 0 });
|
|
58
|
-
const { verdict, reason } = verdictFor({ ...discordant, deltaPassRate });
|
|
59
|
-
return {
|
|
60
|
-
schemaVersion: 4,
|
|
61
|
-
runGroup: 'g',
|
|
62
|
-
createdAt: '2026-09-19T00:00:00.000Z',
|
|
63
|
-
target: { kind: 'skill', name: 's', sourceDir: '/s', bundleSha256: 'a'.repeat(64), files: ['SKILL.md'] },
|
|
64
|
-
bench: { name: 'b', dir: '/b', contentSha256: 'b'.repeat(64), taskCount: tasks.length },
|
|
65
|
-
executor: { kind: executorKind, model: executorKind },
|
|
66
|
-
judge: null,
|
|
67
|
-
trials,
|
|
68
|
-
tasks,
|
|
69
|
-
overall: {
|
|
70
|
-
conditions: { baseline, treatment },
|
|
71
|
-
deltaPassRate,
|
|
72
|
-
scoreDelta: null,
|
|
73
|
-
tokenDelta: null,
|
|
74
|
-
verdict,
|
|
75
|
-
verdictReason: reason,
|
|
76
|
-
stats: {
|
|
77
|
-
discordant,
|
|
78
|
-
mcnemarP: mcnemarExactP(discordant.improved, discordant.regressed),
|
|
79
|
-
deltaCi: pairedDeltaBootstrapCI(tasks.map((task) => task.outcomes)),
|
|
80
|
-
scoreDeltaCi: null,
|
|
81
|
-
},
|
|
82
|
-
},
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
test('verdictFor is inconclusive below 6 discordant pairs, however large the delta', () => {
|
|
86
|
-
const outcome = verdictFor({ improved: 5, regressed: 0, deltaPassRate: 1 });
|
|
87
|
-
assert.equal(outcome.verdict, 'inconclusive');
|
|
88
|
-
assert.match(outcome.reason, /only 5 discordant pair/);
|
|
89
|
-
});
|
|
90
|
-
test('verdictFor reaches significance at 6 one-sided discordant pairs', () => {
|
|
91
|
-
assert.equal(verdictFor({ improved: 6, regressed: 0, deltaPassRate: 1 }).verdict, 'effective');
|
|
92
|
-
assert.equal(verdictFor({ improved: 0, regressed: 6, deltaPassRate: -1 }).verdict, 'ineffective');
|
|
93
|
-
});
|
|
94
|
-
test('verdictFor rejects balanced discordance and zero delta', () => {
|
|
95
|
-
const balanced = verdictFor({ improved: 3, regressed: 3, deltaPassRate: 0 });
|
|
96
|
-
assert.equal(balanced.verdict, 'inconclusive');
|
|
97
|
-
assert.match(balanced.reason, /not significant/);
|
|
98
|
-
const lopsidedButWeak = verdictFor({ improved: 5, regressed: 2, deltaPassRate: 0.43 });
|
|
99
|
-
assert.equal(lopsidedButWeak.verdict, 'inconclusive');
|
|
100
|
-
});
|
|
101
|
-
test('buildWarnings flags a bench the baseline already passes', () => {
|
|
102
|
-
const manifest = manifestWith([taskSummary('easy', 3, 3, 3)], 'api');
|
|
103
|
-
const warnings = buildWarnings(manifest);
|
|
104
|
-
assert.ok(warnings.some((w) => w.includes('"easy"') && w.includes('too easy')));
|
|
105
|
-
});
|
|
106
|
-
test('buildWarnings stays quiet about difficulty below the 90% threshold', () => {
|
|
107
|
-
const manifest = manifestWith([taskSummary('ok', 2, 2, 4)], 'api');
|
|
108
|
-
assert.ok(!buildWarnings(manifest).some((w) => w.includes('too easy')));
|
|
109
|
-
});
|
|
110
|
-
test('buildWarnings flags mock executors as synthetic', () => {
|
|
111
|
-
const manifest = manifestWith([taskSummary('t', 0, 3, 3)], 'mock');
|
|
112
|
-
assert.ok(buildWarnings(manifest).some((w) => w.includes('synthetic')));
|
|
113
|
-
});
|
|
114
|
-
test('buildWarnings warns when discordant pairs cannot certify anything but huge effects', () => {
|
|
115
|
-
const manifest = manifestWith([taskSummary('t', 1, 3, 3)], 'api');
|
|
116
|
-
assert.ok(buildWarnings(manifest).some((w) => w.includes('Only 2 discordant pair')));
|
|
117
|
-
});
|
|
118
|
-
test('renderSummary prints the table, significance block, and indicative scale note', () => {
|
|
119
|
-
const base = manifestWith([taskSummary('review-r1', 0, 3, 3)]);
|
|
120
|
-
const manifest = { ...base, warnings: buildWarnings(base) };
|
|
121
|
-
const output = renderSummary(manifest, 'runs/g/manifest.json');
|
|
122
|
-
assert.match(output, /Target\s+: s \(skill/);
|
|
123
|
-
assert.match(output, /review-r1\s+0\/3 \(0%\)\s+3\/3 \(100%\)\s+\+100pp\s+inconclusive/);
|
|
124
|
-
assert.match(output, /OVERALL/);
|
|
125
|
-
assert.match(output, /Significance \(overall\): 3 improved vs 0 regressed discordant pair\(s\), McNemar exact p=0\.2500/);
|
|
126
|
-
assert.match(output, /Δpass 95% CI \(paired bootstrap, 2000 resamples\): \[\+100\.0pp, \+100\.0pp\]/);
|
|
127
|
-
assert.match(output, /Observed Δpass CI half-width: ±0\.0pp/);
|
|
128
|
-
assert.match(output, /interval collapsed.*does not establish zero uncertainty/);
|
|
129
|
-
assert.ok(!output.includes('resolves effects'));
|
|
130
|
-
assert.match(output, /Scale: 1 task\(s\) × 3 trials per condition — below the conclusive bar/);
|
|
131
|
-
assert.match(output, /Manifest: runs\/g\/manifest\.json/);
|
|
132
|
-
});
|
|
133
|
-
test('renderSummary labels the observed CI half-width without claiming validated resolution', () => {
|
|
134
|
-
const base = manifestWith([taskSummary('a', 0, 3, 3), taskSummary('b', 1, 3, 3)]);
|
|
135
|
-
base.overall.stats.deltaCi = { point: 0.283, lo: -0.044, hi: 0.61, resamples: 2000 };
|
|
136
|
-
const manifest = { ...base, warnings: buildWarnings(base) };
|
|
137
|
-
const output = renderSummary(manifest, 'runs/g/manifest.json');
|
|
138
|
-
// Integer rounding printed [-4pp, +61pp], which hides both that the interval straddles zero and
|
|
139
|
-
// how wide it is — the two things a reader needs in order not to over-read the run.
|
|
140
|
-
assert.match(output, /Δpass 95% CI \(paired bootstrap, 2000 resamples\): \[-4\.4pp, \+61\.0pp\]/);
|
|
141
|
-
assert.match(output, /Observed Δpass CI half-width: ±32\.7pp/);
|
|
142
|
-
assert.match(output, /not a validated minimum detectable effect/);
|
|
143
|
-
assert.ok(!output.includes('resolves effects'));
|
|
144
|
-
});
|
|
145
|
-
test('renderSummary checks completed scale and avoids resolution claims after rounding', () => {
|
|
146
|
-
const base = manifestWith(Array.from({ length: 8 }, (_, i) => taskSummary(`task-${i}`, 0, 4, 4)));
|
|
147
|
-
base.trials = 5;
|
|
148
|
-
base.overall.stats.deltaCi = { point: 0, lo: -0.0001, hi: 0.0001, resamples: 2000 };
|
|
149
|
-
const output = renderSummary({ ...base, warnings: buildWarnings(base) }, 'runs/g/manifest.json');
|
|
150
|
-
assert.match(output, /Observed Δpass CI half-width: ±0\.0pp/);
|
|
151
|
-
assert.match(output, /Completed scale: 0 task\(s\) have at least 5 graded pairs/);
|
|
152
|
-
assert.match(output, /results are indicative/);
|
|
153
|
-
assert.ok(!output.includes('resolves effects'));
|
|
154
|
-
});
|
|
155
|
-
test('renderSummary warns when only the graded-score interval collapses', () => {
|
|
156
|
-
const tasks = [taskSummary('a', 0, 3, 3), taskSummary('b', 1, 3, 3)];
|
|
157
|
-
for (const task of tasks) {
|
|
158
|
-
task.conditions.baseline.meanScore = 0.5;
|
|
159
|
-
task.conditions.treatment.meanScore = 1;
|
|
160
|
-
task.scores = { baseline: [0.5, 0.5, 0.5], treatment: [1, 1, 1] };
|
|
161
|
-
task.scoreDelta = 0.5;
|
|
162
|
-
}
|
|
163
|
-
const base = manifestWith(tasks);
|
|
164
|
-
base.overall.conditions.baseline.meanScore = 0.5;
|
|
165
|
-
base.overall.conditions.treatment.meanScore = 1;
|
|
166
|
-
base.overall.scoreDelta = 0.5;
|
|
167
|
-
base.overall.stats.scoreDeltaCi = { point: 0.5, lo: 0.5, hi: 0.5, resamples: 2000 };
|
|
168
|
-
assert.notEqual(base.overall.stats.deltaCi?.lo, base.overall.stats.deltaCi?.hi);
|
|
169
|
-
const output = renderSummary({ ...base, warnings: buildWarnings(base) }, 'runs/g/manifest.json');
|
|
170
|
-
assert.match(output, /Δscore 95% CI.*\[\+0\.50, \+0\.50\]/);
|
|
171
|
-
assert.match(output, /interval collapsed.*does not establish zero uncertainty/);
|
|
172
|
-
});
|
|
173
|
-
test('cost-of-pass requires complete token coverage on both arms', () => {
|
|
174
|
-
const task = taskSummary('a', 1, 1, 2);
|
|
175
|
-
task.tokenDelta = { input: 10, output: 2 };
|
|
176
|
-
for (const condition of ['baseline', 'treatment']) {
|
|
177
|
-
task.conditions[condition].tokens = { input: 20, output: 4 };
|
|
178
|
-
task.conditions[condition].tokenCoverage = { input: 1, output: 2 };
|
|
179
|
-
}
|
|
180
|
-
const base = manifestWith([task]);
|
|
181
|
-
base.overall.tokenDelta = { input: 10, output: 2 };
|
|
182
|
-
base.overall.conditions.baseline.tokens = { input: 20, output: 4 };
|
|
183
|
-
base.overall.conditions.treatment.tokens = { input: 30, output: 6 };
|
|
184
|
-
base.overall.conditions.baseline.passRate = 0.5;
|
|
185
|
-
base.overall.conditions.treatment.passRate = 0.5;
|
|
186
|
-
base.overall.conditions.baseline.trials = 2;
|
|
187
|
-
base.overall.conditions.treatment.trials = 2;
|
|
188
|
-
base.overall.conditions.baseline.tokenCoverage = { input: 1, output: 2 };
|
|
189
|
-
base.overall.conditions.treatment.tokenCoverage = { input: 2, output: 2 };
|
|
190
|
-
const partial = renderSummary({ ...base, warnings: [] }, 'm.json');
|
|
191
|
-
assert.equal(partial.includes('cost-of-pass'), false);
|
|
192
|
-
base.overall.conditions.baseline.tokenCoverage = { input: 2, output: 2 };
|
|
193
|
-
const full = renderSummary({ ...base, warnings: [] }, 'm.json');
|
|
194
|
-
assert.match(full, /cost-of-pass ratio \(treatment \/ baseline\): 1\.50/);
|
|
195
|
-
});
|
|
196
|
-
test('renderSummary shows a significant overall verdict when discordance suffices', () => {
|
|
197
|
-
const base = manifestWith([
|
|
198
|
-
taskSummary('a', 0, 3, 3),
|
|
199
|
-
taskSummary('b', 0, 3, 3),
|
|
200
|
-
taskSummary('c', 0, 3, 3),
|
|
201
|
-
]);
|
|
202
|
-
const manifest = { ...base, warnings: buildWarnings(base) };
|
|
203
|
-
assert.equal(manifest.overall.verdict, 'effective');
|
|
204
|
-
const output = renderSummary(manifest, 'runs/g/manifest.json');
|
|
205
|
-
assert.match(output, /OVERALL\s+0\/9 \(0%\)\s+9\/9 \(100%\)\s+\+100pp\s+effective/);
|
|
206
|
-
assert.match(output, /9 improved vs 0 regressed discordant pair\(s\), McNemar exact p=0\.0039/);
|
|
207
|
-
});
|
|
208
|
-
test('format helpers', () => {
|
|
209
|
-
assert.equal(formatPassRate(1, 3), '1/3 (33%)');
|
|
210
|
-
assert.equal(formatPassRate(0, 0), '0/0 (n/a)');
|
|
211
|
-
assert.equal(formatDeltaPp(2 / 3), '+67pp');
|
|
212
|
-
assert.equal(formatDeltaPp(-1 / 3), '-33pp');
|
|
213
|
-
assert.equal(formatDeltaPp(0), '0pp');
|
|
214
|
-
// Interval bounds keep a decimal: the task table does not need it, a CI does.
|
|
215
|
-
assert.equal(formatPp1(-0.044), '-4.4pp');
|
|
216
|
-
assert.equal(formatPp1(0.61), '+61.0pp');
|
|
217
|
-
assert.equal(formatPp1(0), '0.0pp');
|
|
218
|
-
assert.equal(formatPp1(1), '+100.0pp');
|
|
219
|
-
});
|
|
220
|
-
test('buildWarnings flags a task the baseline never passes (floor)', () => {
|
|
221
|
-
const manifest = manifestWith([taskSummary('hard', 0, 3, 3)], 'api');
|
|
222
|
-
assert.ok(buildWarnings(manifest).some((w) => w.includes('"hard"') && w.includes('too hard or broken')));
|
|
223
|
-
});
|
|
224
|
-
test('buildWarnings flags a saturated facet', () => {
|
|
225
|
-
const manifest = manifestWith([
|
|
226
|
-
taskSummary('t', 2, 2, 4, {
|
|
227
|
-
facets: [
|
|
228
|
-
{
|
|
229
|
-
name: 'style',
|
|
230
|
-
baselinePassRate: 1,
|
|
231
|
-
treatmentPassRate: 1,
|
|
232
|
-
baselineTrials: 4,
|
|
233
|
-
treatmentTrials: 4,
|
|
234
|
-
},
|
|
235
|
-
{
|
|
236
|
-
name: 'correctness',
|
|
237
|
-
baselinePassRate: 0.5,
|
|
238
|
-
treatmentPassRate: 0.75,
|
|
239
|
-
baselineTrials: 4,
|
|
240
|
-
treatmentTrials: 4,
|
|
241
|
-
},
|
|
242
|
-
],
|
|
243
|
-
}),
|
|
244
|
-
], 'api');
|
|
245
|
-
const warnings = buildWarnings(manifest);
|
|
246
|
-
assert.ok(warnings.some((w) => w.includes('facet "style"') && w.includes('saturated')));
|
|
247
|
-
assert.ok(!warnings.some((w) => w.includes('facet "correctness"')));
|
|
248
|
-
});
|
|
249
|
-
test('buildWarnings surfaces verifier consistency notes', () => {
|
|
250
|
-
const manifest = manifestWith([taskSummary('t', 2, 2, 4, { verifierNotes: ['Task "t": exit code and checks disagree.'] })], 'api');
|
|
251
|
-
assert.ok(buildWarnings(manifest).some((w) => w.includes('exit code and checks disagree')));
|
|
252
|
-
});
|
|
253
|
-
test('renderSummary adds facet score lines only when scores exist', () => {
|
|
254
|
-
const withoutScores = manifestWith([taskSummary('plain', 1, 3, 3)]);
|
|
255
|
-
const plainOutput = renderSummary({ ...withoutScores, warnings: buildWarnings(withoutScores) }, 'runs/g/manifest.json');
|
|
256
|
-
assert.ok(!plainOutput.includes('Facet scores'));
|
|
257
|
-
assert.ok(!plainOutput.includes('Δscore 95% CI'));
|
|
258
|
-
const scored = taskSummary('scored', 1, 3, 3, {
|
|
259
|
-
conditions: {
|
|
260
|
-
baseline: stats(1, 3, 0.5),
|
|
261
|
-
treatment: stats(3, 3, 1),
|
|
262
|
-
},
|
|
263
|
-
scoreDelta: 0.5,
|
|
264
|
-
facets: [
|
|
265
|
-
{
|
|
266
|
-
name: 'finds-bug',
|
|
267
|
-
baselinePassRate: 0.5,
|
|
268
|
-
treatmentPassRate: 1,
|
|
269
|
-
baselineTrials: 3,
|
|
270
|
-
treatmentTrials: 3,
|
|
271
|
-
},
|
|
272
|
-
],
|
|
273
|
-
});
|
|
274
|
-
const withScores = manifestWith([scored]);
|
|
275
|
-
withScores.overall.stats.scoreDeltaCi = { point: 0.5, lo: 0.5, hi: 0.5, resamples: 2000 };
|
|
276
|
-
const output = renderSummary({ ...withScores, warnings: buildWarnings(withScores) }, 'runs/g/manifest.json');
|
|
277
|
-
assert.match(output, /Δscore 95% CI \(paired bootstrap, 2000 resamples\): \[\+0\.50, \+0\.50\]/);
|
|
278
|
-
assert.match(output, /Facet scores \(mean checks passed, baseline → treatment\):/);
|
|
279
|
-
assert.match(output, /- scored: score 0\.50 → 1\.00 \(Δ \+0\.50\)/);
|
|
280
|
-
assert.match(output, /- finds-bug: 50% → 100%/);
|
|
281
|
-
});
|
|
282
|
-
test('buildWarnings surfaces excluded executor errors per arm', () => {
|
|
283
|
-
const summary = taskSummary('flaky', 1, 2, 2);
|
|
284
|
-
const manifest = manifestWith([
|
|
285
|
-
{
|
|
286
|
-
...summary,
|
|
287
|
-
conditions: {
|
|
288
|
-
...summary.conditions,
|
|
289
|
-
baseline: { ...summary.conditions.baseline, errors: 1 },
|
|
290
|
-
},
|
|
291
|
-
},
|
|
292
|
-
], 'api');
|
|
293
|
-
const warnings = buildWarnings(manifest);
|
|
294
|
-
assert.ok(warnings.some((w) => w.includes('"flaky" (baseline)') && w.includes('1 trial(s) hit an executor, verifier, or engagement error')));
|
|
295
|
-
assert.ok(warnings.some((w) => w.includes('together with their paired treatment trial(s)')));
|
|
296
|
-
assert.ok(!warnings.some((w) => w.includes('"flaky" (treatment)')), 'an arm with no errors stays quiet');
|
|
297
|
-
});
|