skillfit 0.12.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 +60 -119
- package/README.zh-CN.md +60 -116
- package/dist/commands/bench-check-report.js +1 -34
- package/dist/commands/bench.js +6 -239
- 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/install.js +14 -98
- package/dist/harness/bench-check.js +277 -0
- package/dist/harness/bench-diagnostics.js +34 -0
- package/dist/harness/eval-acceptance.js +1 -1
- package/dist/harness/eval-audit.js +1 -1
- package/dist/harness/eval-manifest.js +456 -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/evaluation-reports.md +1 -1
- package/docs/growth-roadmap-2026-10.md +14 -18
- package/docs/package-contents.md +73 -0
- 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.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-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 +14 -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/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/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 -1166
- 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 -269
- package/dist/commands/eval-cli-usage.test.js +0 -75
- 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 -263
- 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/npm-first-run.test.js +0 -74
- 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 -175
- package/dist/harness/executors/cli.test.js +0 -541
- 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,243 +0,0 @@
|
|
|
1
|
-
import assert from 'node:assert/strict';
|
|
2
|
-
import { spawnSync } from 'node:child_process';
|
|
3
|
-
import { copyFileSync, existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
|
|
4
|
-
import { tmpdir } from 'node:os';
|
|
5
|
-
import { basename, dirname, join } from 'node:path';
|
|
6
|
-
import { fileURLToPath } from 'node:url';
|
|
7
|
-
import { test } from 'node:test';
|
|
8
|
-
import { runBenchCheck, runBenchInit } from './bench.js';
|
|
9
|
-
import { runEval } from './eval.js';
|
|
10
|
-
import { readEvaluationReport } from './evaluation-report.js';
|
|
11
|
-
import { runEvalReport } from './eval-report.js';
|
|
12
|
-
import { exportEvaluation } from './eval-export.js';
|
|
13
|
-
import { ExperimentSession } from '../harness/experiment-session.js';
|
|
14
|
-
import { collectEvaluationTarget } from '../harness/target.js';
|
|
15
|
-
import { loadBench } from '../harness/bench.js';
|
|
16
|
-
import { ExecutorFailure } from '../harness/types.js';
|
|
17
|
-
const CLI = fileURLToPath(new URL('../cli.js', import.meta.url));
|
|
18
|
-
async function fixture(t, ids) {
|
|
19
|
-
const root = mkdtempSync(join(tmpdir(), 'skillfit-report-modes-'));
|
|
20
|
-
t.after(() => rmSync(root, { recursive: true, force: true }));
|
|
21
|
-
const bench = join(root, 'bench'), skill = join(root, 'skill'), runsRoot = join(root, 'runs');
|
|
22
|
-
await runBenchInit({ dir: bench, yes: true, log: () => { } });
|
|
23
|
-
const path = join(bench, 'bench.json'), body = JSON.parse(readFileSync(path, 'utf8')), original = body.tasks[0];
|
|
24
|
-
body.tasks = ids.map(id => {
|
|
25
|
-
const prompt = `prompts/${id}.md`;
|
|
26
|
-
writeFileSync(join(bench, prompt), `CASE ${id}\nReply with skillfit-ok.\n`);
|
|
27
|
-
return { ...original, id, prompt, promptTrigger: prompt, shouldTrigger: !id.startsWith('neg'),
|
|
28
|
-
...(id === 'pos-fired' ? { triggerClass: 'explicit' } : id === 'pos-missed' ? { triggerClass: 'implicit' } : id === 'pos-unknown' ? { triggerClass: 'contextual' } : {}) };
|
|
29
|
-
});
|
|
30
|
-
writeFileSync(path, JSON.stringify(body));
|
|
31
|
-
mkdirSync(skill);
|
|
32
|
-
writeFileSync(join(skill, 'SKILL.md'), '# Synthetic mode-report test\n');
|
|
33
|
-
let calls = 0;
|
|
34
|
-
const perTask = new Map();
|
|
35
|
-
const executor = { describe: () => ({ kind: 'stub', model: 'offline-report-fixture' }), run: async (_prompt, workdir) => {
|
|
36
|
-
calls++;
|
|
37
|
-
const id = basename(dirname(dirname(workdir))), nth = (perTask.get(id) ?? 0) + 1;
|
|
38
|
-
perTask.set(id, nth);
|
|
39
|
-
if (id === 'neg-error')
|
|
40
|
-
throw new ExecutorFailure('synthetic executor error', { output: 'partial', tokens: { input: 4, output: 1 }, usageStatus: 'partial' });
|
|
41
|
-
return { output: id === 'hard' || (id === 'mixed' && nth === 2) ? 'wrong' : 'skillfit-ok',
|
|
42
|
-
tokens: { input: 10, cachedInput: 0, output: 1 },
|
|
43
|
-
...(id === 'pos-unknown' ? {} : { skillTriggered: id === 'pos-fired' || id === 'neg-fired' }) };
|
|
44
|
-
} };
|
|
45
|
-
const cli = (path, flags = []) => spawnSync(process.execPath, [CLI, 'report', 'eval', path, ...flags], { encoding: 'utf8', timeout: 30_000 });
|
|
46
|
-
return { root, bench, skill, runsRoot, executor, calls: () => calls, cli };
|
|
47
|
-
}
|
|
48
|
-
function observedFiles(run, final) {
|
|
49
|
-
return [final, '_plan.json', '_session.json', '_artifacts.json'].map(path => readFileSync(join(run, path), 'utf8'));
|
|
50
|
-
}
|
|
51
|
-
test('completed native calibration uses its own summary, state and difficulty metrics in both formats', async (t) => {
|
|
52
|
-
const f = await fixture(t, ['easy', 'hard', 'mixed']);
|
|
53
|
-
await runBenchCheck({ dir: f.bench, calibrate: { executor: f.executor, trials: 2, maxCalls: 6, runsRoot: f.runsRoot, runGroup: 'calibration' }, log: () => { } });
|
|
54
|
-
const run = join(f.runsRoot, 'calibration'), before = observedFiles(run, '_calibration.json');
|
|
55
|
-
const report = await readEvaluationReport(run);
|
|
56
|
-
assert.ok('evaluationType' in report && report.evaluationType === 'calibration');
|
|
57
|
-
assert.equal(report.status, 'completed');
|
|
58
|
-
assert.equal(report.kind, 'skillfit.calibration-report');
|
|
59
|
-
assert.deepEqual(report.summary?.tasks.map(t => t.difficulty), ['saturated', 'floor', 'discriminative']);
|
|
60
|
-
assert.deepEqual(report.summary?.metrics, { taskCount: 3, measuredTasks: 3, discriminativeTasks: 1, passes: 3, completed: 6, errors: 0, baselinePassRate: 0.5 });
|
|
61
|
-
assert.equal(report.usage?.metrics.input.knownTotal, 60);
|
|
62
|
-
assert.equal(report.usage?.metrics.cachedInput.knownTotal, 0);
|
|
63
|
-
assert.equal(report.usage?.metrics.cachedInput.coverage.final, 6);
|
|
64
|
-
assert.equal(report.acceptance.eligibleForUpgrade, false);
|
|
65
|
-
assert.equal(report.acceptance.automaticUpgrade, false);
|
|
66
|
-
assert.equal(report.evidence.verified, true);
|
|
67
|
-
assert.equal(report.evidence.scope, 'single-arm-native');
|
|
68
|
-
const human = f.cli(run), json = f.cli(run, ['--json']), file = f.cli(join(run, '_calibration.json'));
|
|
69
|
-
for (const output of [human, json, file])
|
|
70
|
-
assert.equal(output.status, 0, output.stderr);
|
|
71
|
-
assert.equal(JSON.parse(json.stdout).status, 'completed');
|
|
72
|
-
assert.equal(human.stdout, file.stdout);
|
|
73
|
-
assert.match(human.stdout, /Baseline pass rate: 3\/6 \(50.0%\)/);
|
|
74
|
-
assert.match(human.stdout, /discriminative tasks: 1\/3/);
|
|
75
|
-
assert.match(human.stdout, /saturated/);
|
|
76
|
-
assert.match(human.stdout, /floor/);
|
|
77
|
-
assert.doesNotMatch(human.stdout, /Overall verdict|State: stopped|McNemar/);
|
|
78
|
-
assert.equal((await exportEvaluation(run, join(f.root, 'export'), { log: () => { } })).status, 'planned');
|
|
79
|
-
assert.equal(existsSync(join(f.root, 'export')), false);
|
|
80
|
-
assert.deepEqual(observedFiles(run, '_calibration.json'), before);
|
|
81
|
-
assert.equal(f.calls(), 6);
|
|
82
|
-
rmSync(join(run, 'easy/baseline/trial-1/_result.json'));
|
|
83
|
-
const missing = await readEvaluationReport(run);
|
|
84
|
-
assert.ok('evaluationType' in missing);
|
|
85
|
-
assert.equal(missing.usage?.invocationsWithUnknownReceipts, 1);
|
|
86
|
-
assert.equal(missing.usage?.metrics.input.coverage.unknown, 1);
|
|
87
|
-
assert.equal(missing.acceptance.eligibleForUpgrade, false);
|
|
88
|
-
});
|
|
89
|
-
test('native trigger reports retain rates, Wilson intervals, classes, unknowns and errors without paired adoption', async (t) => {
|
|
90
|
-
const f = await fixture(t, ['pos-fired', 'pos-missed', 'pos-unknown', 'neg-fired', 'neg-quiet', 'neg-error']);
|
|
91
|
-
await runEval({ skillPath: f.skill, bench: f.bench, agent: 'codex', mode: 'trigger', executor: f.executor,
|
|
92
|
-
trials: 1, maxCalls: 6, runsRoot: f.runsRoot, runGroup: 'trigger', dryRun: false, yes: true, log: () => { } });
|
|
93
|
-
const run = join(f.runsRoot, 'trigger'), before = observedFiles(run, 'manifest.json');
|
|
94
|
-
const saved = JSON.parse(before[0]);
|
|
95
|
-
const report = await readEvaluationReport(run);
|
|
96
|
-
assert.ok('evaluationType' in report && report.evaluationType === 'trigger');
|
|
97
|
-
assert.equal(report.status, 'stopped');
|
|
98
|
-
assert.equal(report.kind, 'skillfit.trigger-report');
|
|
99
|
-
assert.deepEqual(report.summary?.metrics, saved.metrics);
|
|
100
|
-
assert.equal(report.summary?.metrics.recall, 0.5);
|
|
101
|
-
assert.equal(report.summary?.metrics.falseTriggerRate, 0.5);
|
|
102
|
-
assert.equal(report.summary?.metrics.precision, 0.5);
|
|
103
|
-
assert.equal(report.summary?.metrics.f1, 0.5);
|
|
104
|
-
assert.equal(report.summary?.tasks[2]?.unknown, 1);
|
|
105
|
-
assert.equal(report.summary?.tasks[5]?.errors, 1);
|
|
106
|
-
assert.equal(report.acceptance.eligibleForUpgrade, false);
|
|
107
|
-
assert.equal(report.acceptance.automaticUpgrade, false);
|
|
108
|
-
const human = f.cli(run), json = f.cli(join(run, 'manifest.json'), ['--json']);
|
|
109
|
-
assert.equal(human.status, 0, human.stderr);
|
|
110
|
-
assert.equal(json.status, 0, json.stderr);
|
|
111
|
-
assert.equal(JSON.parse(json.stdout).evaluationType, 'trigger');
|
|
112
|
-
assert.equal(JSON.parse(json.stdout).status, 'stopped');
|
|
113
|
-
for (const label of ['Recall: 50.0%', 'False-trigger rate: 50.0%', 'Precision: 50.0%', 'F1: 0.500', 'explicit recall:', 'implicit recall:', 'contextual recall: n/a', 'SKILL.md read', 'upper bound', 'Unknown | Errors'])
|
|
114
|
-
assert.ok(human.stdout.includes(label), label);
|
|
115
|
-
assert.doesNotMatch(human.stdout, /McNemar|Overall verdict|Installation decision/);
|
|
116
|
-
assert.deepEqual(observedFiles(run, 'manifest.json'), before);
|
|
117
|
-
assert.equal(f.calls(), 6);
|
|
118
|
-
});
|
|
119
|
-
test('completed trigger and standalone historical summaries preserve zero denominators and unknown provenance', async (t) => {
|
|
120
|
-
const f = await fixture(t, ['pos-missed', 'pos-unknown']);
|
|
121
|
-
await runEval({ skillPath: f.skill, bench: f.bench, mode: 'trigger', skillInstallDir: '.test-skills', executor: f.executor,
|
|
122
|
-
trials: 1, maxCalls: 2, runsRoot: f.runsRoot, runGroup: 'trigger', dryRun: false, yes: true, log: () => { } });
|
|
123
|
-
const run = join(f.runsRoot, 'trigger'), native = await readEvaluationReport(run);
|
|
124
|
-
assert.ok('evaluationType' in native && native.evaluationType === 'trigger');
|
|
125
|
-
assert.equal(native.status, 'completed');
|
|
126
|
-
assert.equal(native.summary?.metrics.recall, 0);
|
|
127
|
-
assert.equal(native.summary?.metrics.falseTriggerRate, null);
|
|
128
|
-
assert.equal(native.summary?.metrics.precision, null);
|
|
129
|
-
assert.equal(native.summary?.metrics.f1, null);
|
|
130
|
-
const value = JSON.parse(readFileSync(join(run, 'manifest.json'), 'utf8'));
|
|
131
|
-
delete value.experiment;
|
|
132
|
-
delete value.metrics.classRecall;
|
|
133
|
-
delete value.metrics.precisionCi95;
|
|
134
|
-
const standalone = join(f.root, 'historical.json');
|
|
135
|
-
writeFileSync(standalone, JSON.stringify(value));
|
|
136
|
-
const human = [];
|
|
137
|
-
await runEvalReport(standalone, line => human.push(line));
|
|
138
|
-
assert.match(human[0], /State: reported/);
|
|
139
|
-
assert.match(human[0], /False-trigger rate: n\/a/);
|
|
140
|
-
assert.match(human[0], /Precision: n\/a/);
|
|
141
|
-
assert.match(human[0], /F1: n\/a/);
|
|
142
|
-
assert.match(human[0], /Eligible for upgrade: no/);
|
|
143
|
-
assert.equal(f.calls(), 2);
|
|
144
|
-
});
|
|
145
|
-
test('standalone calibration excludes ungraded errors and leaves zero-completion difficulty unknown', async (t) => {
|
|
146
|
-
const root = mkdtempSync(join(tmpdir(), 'skillfit-calibration-summary-'));
|
|
147
|
-
t.after(() => rmSync(root, { recursive: true, force: true }));
|
|
148
|
-
const path = join(root, 'renamed.json');
|
|
149
|
-
writeFileSync(path, JSON.stringify({ schemaVersion: 1, runGroup: 'historical', inputMode: 'snapshot', trials: 2,
|
|
150
|
-
tasks: [{ id: 'one', passes: 1, completed: 1, errors: 1 }, { id: 'none', passes: 0, completed: 0, errors: 2 }] }));
|
|
151
|
-
const report = await readEvaluationReport(path);
|
|
152
|
-
assert.ok('evaluationType' in report && report.evaluationType === 'calibration');
|
|
153
|
-
assert.equal(report.status, 'reported');
|
|
154
|
-
assert.equal(report.summary?.metrics.baselinePassRate, 1);
|
|
155
|
-
assert.equal(report.summary?.metrics.errors, 3);
|
|
156
|
-
assert.equal(report.summary?.tasks[1]?.passRate, null);
|
|
157
|
-
assert.equal(report.summary?.tasks[1]?.difficulty, 'unmeasured');
|
|
158
|
-
});
|
|
159
|
-
test('stopped and unfinished single-arm sessions never fabricate final metrics or completion', async (t) => {
|
|
160
|
-
for (const mode of ['calibration', 'trigger'])
|
|
161
|
-
await t.test(mode, async (t) => {
|
|
162
|
-
const f = await fixture(t, ['easy']);
|
|
163
|
-
const run = join(f.runsRoot, mode);
|
|
164
|
-
const session = new ExperimentSession({ bench: loadBench(f.bench), target: collectEvaluationTarget(f.skill), groupDir: run,
|
|
165
|
-
workspaces: [join(run, 'easy/baseline/trial-1')], plannedCalls: 1, maxCalls: 1, injected: true, details: { mode } });
|
|
166
|
-
session.finish(new Error('synthetic cancellation'));
|
|
167
|
-
const stopped = await readEvaluationReport(run);
|
|
168
|
-
assert.ok('evaluationType' in stopped);
|
|
169
|
-
assert.equal(stopped.status, 'stopped');
|
|
170
|
-
assert.equal(stopped.summary, null);
|
|
171
|
-
assert.equal(stopped.acceptance.eligibleForUpgrade, false);
|
|
172
|
-
const human = f.cli(run);
|
|
173
|
-
assert.equal(human.status, 0, human.stderr);
|
|
174
|
-
assert.match(human.stdout, /Metrics are unavailable/);
|
|
175
|
-
rmSync(join(run, '_session.json'));
|
|
176
|
-
const unfinished = await readEvaluationReport(run);
|
|
177
|
-
assert.equal(unfinished.status, 'incomplete');
|
|
178
|
-
assert.equal(f.calls(), 0);
|
|
179
|
-
});
|
|
180
|
-
});
|
|
181
|
-
test('single-arm reports reject contradictory counts, metrics, schemas, session states and ignored options', async (t) => {
|
|
182
|
-
const f = await fixture(t, ['pos-fired', 'neg-quiet']);
|
|
183
|
-
await runEval({ skillPath: f.skill, bench: f.bench, mode: 'trigger', skillInstallDir: '.test-skills', executor: f.executor,
|
|
184
|
-
trials: 1, maxCalls: 2, runsRoot: f.runsRoot, runGroup: 'trigger', dryRun: false, yes: true, log: () => { } });
|
|
185
|
-
const run = join(f.runsRoot, 'trigger'), path = join(run, 'manifest.json'), original = readFileSync(path, 'utf8');
|
|
186
|
-
const scenarios = [
|
|
187
|
-
(v) => { v.tasks[0].fired = 2; },
|
|
188
|
-
(v) => { v.tasks[0].runs = -1; },
|
|
189
|
-
(v) => { v.tasks[0].unknown = 0.5; },
|
|
190
|
-
(v) => { v.tasks[1].id = v.tasks[0].id; },
|
|
191
|
-
(v) => { v.metrics.recall = 0; },
|
|
192
|
-
(v) => { v.metrics.recallCi95 = { lo: 0, hi: 0 }; },
|
|
193
|
-
(v) => { v.schemaVersion = 2; },
|
|
194
|
-
(v) => { v.experiment.status = 'incomplete'; },
|
|
195
|
-
];
|
|
196
|
-
for (const change of scenarios) {
|
|
197
|
-
const value = JSON.parse(original);
|
|
198
|
-
change(value);
|
|
199
|
-
writeFileSync(path, JSON.stringify(value));
|
|
200
|
-
await assert.rejects(() => readEvaluationReport(run));
|
|
201
|
-
}
|
|
202
|
-
writeFileSync(path, original);
|
|
203
|
-
for (const json of [false, true]) {
|
|
204
|
-
const replay = f.cli(run, ['--replay', ...(json ? ['--json'] : [])]);
|
|
205
|
-
assert.equal(replay.status, 0, replay.stderr);
|
|
206
|
-
if (json) {
|
|
207
|
-
const result = JSON.parse(replay.stdout);
|
|
208
|
-
assert.equal(result.evidence.verified, true);
|
|
209
|
-
assert.equal(result.evidence.replayedDeliveries, 2);
|
|
210
|
-
assert.equal(result.acceptance.eligibleForUpgrade, false);
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
for (const flags of [['--policy', 'missing.json'], ['--records', run], ['--bench', f.bench]]) {
|
|
214
|
-
for (const json of [false, true]) {
|
|
215
|
-
const result = f.cli(run, [...flags, ...(json ? ['--json'] : [])]);
|
|
216
|
-
assert.equal(result.status, json ? 2 : 1);
|
|
217
|
-
if (json) {
|
|
218
|
-
const failure = JSON.parse(result.stdout);
|
|
219
|
-
assert.equal(failure.status, 'error');
|
|
220
|
-
assert.equal(failure.acceptance.eligibleForUpgrade, false);
|
|
221
|
-
}
|
|
222
|
-
else
|
|
223
|
-
assert.match(result.stderr, /do not support paired|only used with --replay/);
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
copyFileSync(path, join(run, '_calibration.json'));
|
|
227
|
-
await assert.rejects(() => readEvaluationReport(run), /Ambiguous run/);
|
|
228
|
-
assert.equal(f.calls(), 2);
|
|
229
|
-
});
|
|
230
|
-
test('invalid calibration summaries fail rather than being mislabeled stopped or interpreted as trigger data', async (t) => {
|
|
231
|
-
const root = mkdtempSync(join(tmpdir(), 'skillfit-invalid-calibration-'));
|
|
232
|
-
t.after(() => rmSync(root, { recursive: true, force: true }));
|
|
233
|
-
const path = join(root, '_calibration.json'), value = { schemaVersion: 1, runGroup: 'calibration', inputMode: 'workspace', trials: 2,
|
|
234
|
-
tasks: [{ id: 'one', completed: 1, errors: 1, passes: 1 }] };
|
|
235
|
-
for (const change of [(v) => { v.tasks[0].passes = 2; }, (v) => { v.tasks[0].errors = 2; },
|
|
236
|
-
(v) => { v.tasks[0].completed = null; }, (v) => { v.inputMode = 'unknown'; }, (v) => { v.tasks = []; }]) {
|
|
237
|
-
const changed = structuredClone(value);
|
|
238
|
-
change(changed);
|
|
239
|
-
writeFileSync(path, JSON.stringify(changed));
|
|
240
|
-
await assert.rejects(() => readEvaluationReport(path));
|
|
241
|
-
}
|
|
242
|
-
assert.ok(!existsSync(join(root, 'manifest.json')));
|
|
243
|
-
});
|