@outerlayer/cli 0.37.0-next.20261104233800 → 0.37.0-next.20261105001951
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/dist/build-info.json +1 -1
- package/dist/{check-VOJWXIRZ.js → check-WG7ONVYM.js} +6 -6
- package/dist/{chunk-3Z5GISKU.js → chunk-4E3ALN2D.js} +111 -12
- package/dist/{chunk-W6GP4CNN.js → chunk-7UG2MMFU.js} +1 -1
- package/dist/{chunk-LLZG5A2J.js → chunk-ICLXEZEB.js} +1 -1
- package/dist/{chunk-VNMTA2JE.js → chunk-MIJGB43I.js} +1 -1
- package/dist/{chunk-SQWYFCEU.js → chunk-NQPQH6Y5.js} +1 -1
- package/dist/{chunk-TSYTPW6Y.js → chunk-RTNUZPAC.js} +2 -3
- package/dist/{chunk-ERGU3OZP.js → chunk-WLALSXAN.js} +5 -5
- package/dist/{chunk-FX4ZG4E5.js → chunk-WRFUGRUX.js} +1 -1
- package/dist/{cli-FFPFIMPZ.js → cli-42G6B7EO.js} +28 -25
- package/dist/{command-MYYGFCW3.js → command-5GGBCD4S.js} +3 -3
- package/dist/{container-start-ICNSSPBS.js → container-start-45TQNJQE.js} +4 -4
- package/dist/{doctor-LEGPWSQ3.js → doctor-GFROWFS3.js} +4 -4
- package/dist/{host-checks-VGJVO23Y.js → host-checks-KDJZIFBQ.js} +2 -2
- package/dist/index.js +1 -1
- package/dist/{init-F3L4CTBJ.js → init-QBWRPNZP.js} +2 -2
- package/dist/{init-Z6ZVLUJ5.js → init-V45VLEQO.js} +2 -2
- package/dist/{init-agent-DO233UTF.js → init-agent-2XMCGKPV.js} +2 -2
- package/dist/{init-cmd-AKIPYTNP.js → init-cmd-JY2UXAYR.js} +1 -1
- package/dist/{loop-MUPQOIW6.js → loop-V5ZC753N.js} +6 -6
- package/dist/{machine-WFZ5KM76.js → machine-4M4RUHG2.js} +2 -2
- package/dist/{runner-key-2SKLS37E.js → runner-key-OS7EKYZS.js} +2 -2
- package/dist/{status-WZCEHCL2.js → status-ODVVTDA2.js} +2 -2
- package/dist/{update-steps-5BGDQTVG.js → update-steps-ZW2EDSYC.js} +3 -3
- package/dist/{work-proofs-cmd-P33QGSIQ.js → work-proofs-cmd-DDVTBWPI.js} +2 -2
- package/dist/{work-proofs-record-FN6M7BIZ.js → work-proofs-record-W45UBFHM.js} +66 -8
- package/package.json +1 -1
- package/skill-pack/maintained/outerlayer-build/references/agent-briefs.md +18 -7
- package/skill-pack/maintained/outerlayer-build/references/evidence.md +8 -5
- package/dist/{chunk-6SC66WGJ.js → chunk-BNYBHWYH.js} +172 -172
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
export { RunnerStartError, fleetKeepalive, leaseTimeLeftFor, listJobFiles, logUnusableHelper, prepareSession, probeBuild, probeCredentials, requestStop, runnerProcessState, runtimeOf, sampleUsage, start, tick, watchTick } from './chunk-
|
|
3
|
+
export { RunnerStartError, fleetKeepalive, leaseTimeLeftFor, listJobFiles, logUnusableHelper, prepareSession, probeBuild, probeCredentials, requestStop, runnerProcessState, runtimeOf, sampleUsage, start, tick, watchTick } from './chunk-WLALSXAN.js';
|
|
4
4
|
import './chunk-PNZN656P.js';
|
|
5
5
|
import './chunk-2QFRAMJX.js';
|
|
6
6
|
import './chunk-LVZ3UV7T.js';
|
|
7
7
|
import './chunk-3JVYMD4G.js';
|
|
8
8
|
import './chunk-E7R2GIAW.js';
|
|
9
|
-
import './chunk-
|
|
10
|
-
import './chunk-
|
|
9
|
+
import './chunk-7UG2MMFU.js';
|
|
10
|
+
import './chunk-NQPQH6Y5.js';
|
|
11
11
|
import './chunk-IDYLPN4X.js';
|
|
12
|
-
import './chunk-
|
|
12
|
+
import './chunk-ICLXEZEB.js';
|
|
13
13
|
import './chunk-IJU6DMQA.js';
|
|
14
|
-
import './chunk-
|
|
15
|
-
import './chunk-
|
|
14
|
+
import './chunk-RTNUZPAC.js';
|
|
15
|
+
import './chunk-BNYBHWYH.js';
|
|
16
16
|
import './chunk-2PGI6RDE.js';
|
|
17
17
|
import './chunk-I3LTIAOR.js';
|
|
18
18
|
import './chunk-ZHOPDD7U.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
export { describeMachineDocker, detectMachine, microVmArchSupported, microVmAssetsPinned, reachDockerStep, supportsContainerBuilds, supportsMicroVmBuilds } from './chunk-
|
|
4
|
-
import './chunk-
|
|
3
|
+
export { describeMachineDocker, detectMachine, microVmArchSupported, microVmAssetsPinned, reachDockerStep, supportsContainerBuilds, supportsMicroVmBuilds } from './chunk-RTNUZPAC.js';
|
|
4
|
+
import './chunk-BNYBHWYH.js';
|
|
5
5
|
import './chunk-2PGI6RDE.js';
|
|
6
6
|
import './chunk-I3LTIAOR.js';
|
|
7
7
|
import './chunk-ZHOPDD7U.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
import { readConfigObject, RunnerInitError } from './chunk-
|
|
4
|
-
import './chunk-
|
|
3
|
+
import { readConfigObject, RunnerInitError } from './chunk-RTNUZPAC.js';
|
|
4
|
+
import './chunk-BNYBHWYH.js';
|
|
5
5
|
import './chunk-2PGI6RDE.js';
|
|
6
6
|
import './chunk-I3LTIAOR.js';
|
|
7
7
|
import './chunk-ZHOPDD7U.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
import { isReadable, LEASE_SECONDS, ALREADY_RELEASED, RENEW_INTERVAL_SECONDS } from './chunk-
|
|
4
|
-
import './chunk-
|
|
3
|
+
import { isReadable, LEASE_SECONDS, ALREADY_RELEASED, RENEW_INTERVAL_SECONDS } from './chunk-RTNUZPAC.js';
|
|
4
|
+
import './chunk-BNYBHWYH.js';
|
|
5
5
|
import './chunk-2PGI6RDE.js';
|
|
6
6
|
import './chunk-I3LTIAOR.js';
|
|
7
7
|
import './chunk-ZHOPDD7U.js';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
export { readOwnContainer, renderUpdateSteps, runUpdateSteps } from './chunk-
|
|
4
|
-
import './chunk-
|
|
5
|
-
import './chunk-
|
|
3
|
+
export { readOwnContainer, renderUpdateSteps, runUpdateSteps } from './chunk-NQPQH6Y5.js';
|
|
4
|
+
import './chunk-RTNUZPAC.js';
|
|
5
|
+
import './chunk-BNYBHWYH.js';
|
|
6
6
|
import './chunk-2PGI6RDE.js';
|
|
7
7
|
import './chunk-I3LTIAOR.js';
|
|
8
8
|
import './chunk-ZHOPDD7U.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
export { classifyProofs, classifyProofsAt, otherPullRequestHeads, resolveProofsItem, runWorkProofs, runWorkProofsCommand } from './chunk-
|
|
4
|
-
import './chunk-
|
|
3
|
+
export { classifyProofs, classifyProofsAt, otherPullRequestHeads, resolveProofsItem, runWorkProofs, runWorkProofsCommand } from './chunk-4E3ALN2D.js';
|
|
4
|
+
import './chunk-BNYBHWYH.js';
|
|
5
5
|
import './chunk-6BS4DDCY.js';
|
|
6
6
|
import './chunk-6MWBZHBW.js';
|
|
7
7
|
import './chunk-GBCQ3KHH.js';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
import { resolveProofsItem, ownPullRequest, otherPullRequestHeads, classifyProofsAt, runWorkProofs, proofsCommentId, kindProblem, proofsCommentBody } from './chunk-
|
|
3
|
+
import { resolveProofsItem, ownPullRequest, otherPullRequestHeads, testProofMode, classifyProofsAt, runWorkProofs, proofsCommentId, testFilesOf, freshXmlFiles, joinResults, testSelectors, kindProblem, proofsCommentBody } from './chunk-4E3ALN2D.js';
|
|
4
4
|
import { runEmitDemo } from './chunk-RFCAK6OI.js';
|
|
5
5
|
import { readNewestDemo } from './chunk-ER6KQCVJ.js';
|
|
6
6
|
import { runWorkComment } from './chunk-2LXO2YIW.js';
|
|
7
7
|
import { runEmitArtifact } from './chunk-HN76DIHX.js';
|
|
8
|
-
import { runnerMatcher } from './chunk-
|
|
8
|
+
import { runnerMatcher } from './chunk-BNYBHWYH.js';
|
|
9
9
|
import './chunk-2PGI6RDE.js';
|
|
10
10
|
import { runSync } from './chunk-KCNL7KX2.js';
|
|
11
11
|
import './chunk-ZRITZJ36.js';
|
|
@@ -49,7 +49,7 @@ import { resolveRepoIdentity } from './chunk-ZQNYV4OZ.js';
|
|
|
49
49
|
import { ARTIFACT_MAX_CAPTION_LENGTH } from './chunk-2JIGPSVF.js';
|
|
50
50
|
import './chunk-Z5GEFMRW.js';
|
|
51
51
|
import { spawnSync, spawn } from 'child_process';
|
|
52
|
-
import { mkdtempSync, rmSync, openSync, closeSync, readdirSync, readFileSync } from 'fs';
|
|
52
|
+
import { mkdtempSync, writeFileSync, rmSync, openSync, closeSync, readdirSync, readFileSync } from 'fs';
|
|
53
53
|
import { tmpdir } from 'os';
|
|
54
54
|
import { join } from 'path';
|
|
55
55
|
|
|
@@ -245,7 +245,8 @@ async function runWorkProofsRecord(opts) {
|
|
|
245
245
|
}
|
|
246
246
|
};
|
|
247
247
|
const heads = /* @__PURE__ */ new Set([head.toLowerCase(), ...otherPullRequestHeads(body.pullRequests ?? [], ownPr, identity.gitRepo)]);
|
|
248
|
-
const
|
|
248
|
+
const recordsTests = body.criteria?.testProofsReported === true && await testProofMode(cwd) === "any";
|
|
249
|
+
const states = classifyProofsAt(body, heads, { tests: recordsTests });
|
|
249
250
|
const todo = states.filter((state) => state.state !== "current").map((state) => state.id);
|
|
250
251
|
if (todo.length === 0) {
|
|
251
252
|
const closing2 = await runWorkProofs({ ...opts, item, env, quiet: true, checkoutHead: head, fetchImpl });
|
|
@@ -267,9 +268,31 @@ async function runWorkProofsRecord(opts) {
|
|
|
267
268
|
const proofOf = (id) => declared.get(id).proof;
|
|
268
269
|
const reasons = /* @__PURE__ */ new Map();
|
|
269
270
|
const emitted = /* @__PURE__ */ new Map();
|
|
270
|
-
const
|
|
271
|
+
const testIds = todo.filter((id) => proofOf(id) === "test");
|
|
272
|
+
const testsOf = /* @__PURE__ */ new Map();
|
|
273
|
+
const matchesRunner = runnerMatcher(config.runners);
|
|
274
|
+
const found = discoverTestFiles(root, todo.filter((id) => proofOf(id) !== "test"), config.runners);
|
|
275
|
+
for (const id of testIds) {
|
|
276
|
+
const tests = declared.get(id).newestProof?.tests;
|
|
277
|
+
if (tests === void 0) {
|
|
278
|
+
reasons.set(id, "no earlier results were recorded for it, so there is no test to run again. Run its tests and emit the results with --for, naming each test with --test <name>=<path>:<line>");
|
|
279
|
+
continue;
|
|
280
|
+
}
|
|
281
|
+
const files = testFilesOf(tests);
|
|
282
|
+
if (files.length === 0) {
|
|
283
|
+
reasons.set(id, "its earlier results name no test file, so there is no test to run again. Emit the results again naming each test with --test <name>=<path>:<line>");
|
|
284
|
+
continue;
|
|
285
|
+
}
|
|
286
|
+
const unmatched = files.filter((file) => matchesRunner(file) === void 0);
|
|
287
|
+
if (unmatched.length > 0) {
|
|
288
|
+
reasons.set(id, `no runner in ${CONFIG_FILE} matches ${unmatched.join(", ")}`);
|
|
289
|
+
continue;
|
|
290
|
+
}
|
|
291
|
+
testsOf.set(id, tests);
|
|
292
|
+
found.set(id, files);
|
|
293
|
+
}
|
|
271
294
|
for (const id of todo) {
|
|
272
|
-
if (!found.has(id)) reasons.set(id, NO_TEST);
|
|
295
|
+
if (!found.has(id) && !reasons.has(id)) reasons.set(id, NO_TEST);
|
|
273
296
|
}
|
|
274
297
|
const plan = planRuns([...new Set([...found.values()].flat())], config.runners);
|
|
275
298
|
const logDir = mkdtempSync(join(tmpdir(), "outerlayer-proofs-"));
|
|
@@ -333,13 +356,15 @@ async function runWorkProofsRecord(opts) {
|
|
|
333
356
|
}
|
|
334
357
|
const proofOut = mkdtempSync(join(tmpdir(), "outerlayer-proof-out-"));
|
|
335
358
|
proofOuts.push(proofOut);
|
|
359
|
+
const startedMs = Date.now() - 1e3;
|
|
336
360
|
const result = await runCommand(fillFiles(runner.command, files), { cwd: root, env: { ...baseEnv, OUTERLAYER_PROOF_OUT: proofOut }, timeoutMs, logDir, groups });
|
|
361
|
+
const results = freshXmlFiles([proofOut, root], startedMs);
|
|
337
362
|
const failure = result.timedOut ? `the runner for ${runner.files} timed out after ${Math.round(timeoutMs / 1e3)} s` : result.status === 0 ? void 0 : `the runner for ${runner.files} exited with status ${result.status}`;
|
|
338
363
|
if (failure !== void 0) {
|
|
339
364
|
say(failure);
|
|
340
365
|
if (result.tail !== "") say(result.tail);
|
|
341
366
|
}
|
|
342
|
-
runs.push({ glob: runner.files, proofOut, criteria, failure, tail: result.tail });
|
|
367
|
+
runs.push({ glob: runner.files, proofOut, criteria, failure, tail: result.tail, results });
|
|
343
368
|
}
|
|
344
369
|
} finally {
|
|
345
370
|
if (setupStarted) {
|
|
@@ -376,10 +401,43 @@ async function runWorkProofsRecord(opts) {
|
|
|
376
401
|
for (const id of chapterCriteria(manifests[0])) chapters.add(id);
|
|
377
402
|
await recordDemo(manifests[0], chapters);
|
|
378
403
|
}
|
|
404
|
+
for (const [id, tests] of testsOf) {
|
|
405
|
+
const ran = runs.filter((run) => run.criteria.includes(id));
|
|
406
|
+
if (ran.length === 0) continue;
|
|
407
|
+
const fail = (reason) => {
|
|
408
|
+
reasons.set(id, reason);
|
|
409
|
+
say(`Not recorded, ${id}: ${reason}`);
|
|
410
|
+
};
|
|
411
|
+
const joined = joinResults([...new Set(ran.flatMap((run) => run.results))], new Set(tests.items.map((test) => test.name)), root);
|
|
412
|
+
if (!joined.ok) {
|
|
413
|
+
const failed = ran.find((run) => run.failure !== void 0)?.failure;
|
|
414
|
+
fail(failed === void 0 ? joined.reason : `${failed}, and ${joined.reason}`);
|
|
415
|
+
continue;
|
|
416
|
+
}
|
|
417
|
+
const resultsFile = join(logDir, `${id}.xml`);
|
|
418
|
+
writeFileSync(resultsFile, joined.xml);
|
|
419
|
+
try {
|
|
420
|
+
const caption = (declared.get(id).text ?? `Test results for ${id}`).slice(0, ARTIFACT_MAX_CAPTION_LENGTH);
|
|
421
|
+
const before = spooledCount;
|
|
422
|
+
const selectors = testSelectors(tests);
|
|
423
|
+
const result = await emitArtifact({ ...common, file: resultsFile, caption, criterionId: id, ...selectors.length > 0 ? { tests: selectors } : {}, ...ownPr === void 0 ? {} : { pr: ownPr } });
|
|
424
|
+
const artifactId = result.record?.artifactId ?? result.data?.clientArtifactId;
|
|
425
|
+
if (artifactId === void 0) {
|
|
426
|
+
fail("the upload returned no artifact id");
|
|
427
|
+
continue;
|
|
428
|
+
}
|
|
429
|
+
emitted.set(id, artifactId);
|
|
430
|
+
if (spooledCount > before) spooledCriteria.add(id);
|
|
431
|
+
say(`Ran again for ${id}: ${joined.files.join(", ")}`);
|
|
432
|
+
} catch (err) {
|
|
433
|
+
fail(`the upload failed: ${oneLine(String(err instanceof Error ? err.message : err))}`);
|
|
434
|
+
}
|
|
435
|
+
}
|
|
379
436
|
for (const run of runs) {
|
|
380
437
|
const names = topLevelFiles(run.proofOut);
|
|
381
438
|
for (const name of names) {
|
|
382
439
|
const id = proofFileCriterion(name, new Set(declared.keys()));
|
|
440
|
+
if (id === void 0 && name.endsWith(".xml") && testIds.length > 0) continue;
|
|
383
441
|
if (id === void 0) {
|
|
384
442
|
say(`Ignored ${name}: its name is not the id of a declared criterion.`);
|
|
385
443
|
continue;
|
|
@@ -491,7 +549,7 @@ async function runWorkProofsRecord(opts) {
|
|
|
491
549
|
let finalStates = states;
|
|
492
550
|
try {
|
|
493
551
|
const { data: fresh } = await getJson(creds.url, `/v1/work-items/${item}`, creds.apiKey, creds.appId, fetchImpl);
|
|
494
|
-
finalStates = classifyProofsAt(fresh, heads);
|
|
552
|
+
finalStates = classifyProofsAt(fresh, heads, { tests: recordsTests });
|
|
495
553
|
} catch (err) {
|
|
496
554
|
say(`The item could not be read again, so the list below may be out of date: ${oneLine(String(err instanceof Error ? err.message : err))}`);
|
|
497
555
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@outerlayer/cli",
|
|
3
|
-
"version": "0.37.0-next.
|
|
3
|
+
"version": "0.37.0-next.20261105001951",
|
|
4
4
|
"description": "OuterLayer CLI — commands: init, claude, connect, doctor, login, logout, sync, daemon (alias: watch), emit, demo, findings, work, spec, runner, hooks, mcp, context. Capture and sync coding-agent sessions, and record proof of factory work.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Magu Studios, Inc.",
|
|
@@ -313,16 +313,27 @@ each proof that is not current, and runs them.
|
|
|
313
313
|
kind the criterion declares. The test writes outside the repository, so there is
|
|
314
314
|
nothing to ignore or commit.
|
|
315
315
|
- A `test` proof is a JUnit XML file of test results, bound to the criterion.
|
|
316
|
-
|
|
317
|
-
|
|
316
|
+
Record it yourself the first time, unless the policy file sets
|
|
317
|
+
`criteria.test_proof: ci`. CI then records it. Run the repository's test
|
|
318
318
|
command with its JUnit reporter, such as
|
|
319
319
|
`vitest run --reporter=junit --outputFile=<file>`, `pytest --junitxml=<file>`
|
|
320
320
|
or `node --test --test-reporter=junit --test-reporter-destination=<file>`.
|
|
321
|
-
|
|
321
|
+
Maven and Gradle write it themselves. Then run
|
|
322
322
|
`outerlayer emit artifact <file> --caption "<one sentence>" --for <criterion id>`.
|
|
323
|
-
Add `--test "<test name>"` for each test that proves the
|
|
324
|
-
criterion is
|
|
325
|
-
|
|
323
|
+
Add `--test "<test name>=<path>:<line>"` for each test that proves the
|
|
324
|
+
criterion. The path is the test file from the repository root, and the line
|
|
325
|
+
is where the test starts. Results from several test classes go in one file
|
|
326
|
+
under one `<testsuites>` element.
|
|
327
|
+
- From then on, `--record` and the host run those tests again at each new head,
|
|
328
|
+
through the runner whose `files` glob matches the test file. So make sure
|
|
329
|
+
such a runner exists, passes `{files}` to the test command, and that the test
|
|
330
|
+
tool writes JUnit XML: into `$OUTERLAYER_PROOF_OUT`, or where it writes by
|
|
331
|
+
default. A Maven runner, for example:
|
|
332
|
+
|
|
333
|
+
```yaml
|
|
334
|
+
- files: "apps/api/src/test/java/**/*Test.java"
|
|
335
|
+
command: 'cd apps/api && ./mvnw -q test -Dtest="$(for f in {files}; do basename "$f" .java; done | paste -sd, -)"'
|
|
336
|
+
```
|
|
326
337
|
- A proof that no test can make stays without a test. Give the reason in
|
|
327
338
|
`build-reports/evidence.md`.
|
|
328
339
|
|
|
@@ -330,7 +341,7 @@ Commit the setup file and every test. Then run
|
|
|
330
341
|
`outerlayer work proofs --record` from the committed checkout. It stops when a
|
|
331
342
|
tracked file differs from HEAD. It runs only what is committed at HEAD, and
|
|
332
343
|
emits each proof at HEAD. It skips a proof that is current. Never emit by hand
|
|
333
|
-
a proof that a test can make, except a `test` proof, as above. Always pass `--pr <number>` when the item links
|
|
344
|
+
a proof that a test can make, except a `test` proof the first time, as above. Always pass `--pr <number>` when the item links
|
|
334
345
|
more than one pull request in the repository.
|
|
335
346
|
|
|
336
347
|
The output names each proof that is still not current, with the reason. Fix
|
|
@@ -51,11 +51,14 @@ recorded. In a runner build, the host runs `outerlayer work proofs --record
|
|
|
51
51
|
that the tests record each proof. A proof that is out of date only because a
|
|
52
52
|
later commit moved the head needs no reason: the host records it again.
|
|
53
53
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
54
|
+
A criterion that declares `proof: test` is recorded the first time as the
|
|
55
|
+
Evidence brief in [agent-briefs.md](agent-briefs.md) says, unless the policy
|
|
56
|
+
file sets `criteria.test_proof: ci`. After that, `--record` runs the same tests
|
|
57
|
+
again and records their results, as the host does at the final commit. It can
|
|
58
|
+
do so only when each test was named with its file and line, and a runner in
|
|
59
|
+
`.outerlayer-proofs.yaml` matches that file. The list command names a proof
|
|
60
|
+
the host cannot record again, and why. Fix the proofs file before the run
|
|
61
|
+
ends. The final report names each test proof with its artifact.
|
|
59
62
|
|
|
60
63
|
Run the list command once more before the run ends. A criterion still listed
|
|
61
64
|
as out of date or missing goes in `build-reports/evidence.md` with the reason.
|
|
@@ -8,178 +8,6 @@ import { join } from 'path';
|
|
|
8
8
|
import { pathToFileURL } from 'url';
|
|
9
9
|
|
|
10
10
|
createRequire(import.meta.url);
|
|
11
|
-
var ARTIFACT_PROOF_REASON = "Its declared artifact proves it; the judge does not judge artifacts.";
|
|
12
|
-
var NO_NAMED_TEST_REASON = "The judge named no test file that proves this criterion.";
|
|
13
|
-
var NO_VERDICT_REASON = "The judge gave no result for this criterion.";
|
|
14
|
-
var JUDGE_GROUP_SIZE = 12;
|
|
15
|
-
function notReadAsTestReason(paths) {
|
|
16
|
-
const named = paths.slice(0, 3).map((path2) => `\`${path2}\``);
|
|
17
|
-
const list = named.length === 1 ? named[0] : `${named.slice(0, -1).join(", ")} and ${named.at(-1)}`;
|
|
18
|
-
const more = paths.length > 3 ? " and other files" : "";
|
|
19
|
-
const one = paths.length === 1;
|
|
20
|
-
return `The judge named ${list}${more}, which ${one ? "is" : "are"} not read as ${one ? "a test" : "tests"}. If ${one ? "that file holds" : "one of them holds"} the test, name it with a runner glob in \`.outerlayer-proofs.yaml\`.`;
|
|
21
|
-
}
|
|
22
|
-
function treePath(raw, treeRoot) {
|
|
23
|
-
let path2 = raw.trim().replace(/\\/g, "/");
|
|
24
|
-
const root = `${treeRoot.replace(/\/+$/, "")}/`;
|
|
25
|
-
if (path2.startsWith(root)) path2 = path2.slice(root.length);
|
|
26
|
-
while (path2.startsWith("./")) path2 = path2.slice(2);
|
|
27
|
-
if (path2 === "" || path2.length > CHECK_ITEM_REF_PATH_MAX_LENGTH || path2.startsWith("/") || /[\u0000-\u001f\u007f]/.test(path2)) return void 0;
|
|
28
|
-
if (path2.split("/").some((segment) => segment === ".." || segment === "")) return void 0;
|
|
29
|
-
return path2;
|
|
30
|
-
}
|
|
31
|
-
function criterionInputs(input) {
|
|
32
|
-
const hash = createHash("sha256");
|
|
33
|
-
const part = (text) => {
|
|
34
|
-
hash.update(`${Buffer.byteLength(text)}:`);
|
|
35
|
-
hash.update(text);
|
|
36
|
-
};
|
|
37
|
-
part("judge-criterion-v2");
|
|
38
|
-
part(input.brief);
|
|
39
|
-
part(input.criterion.id);
|
|
40
|
-
part(input.criterion.text);
|
|
41
|
-
part(input.criterion.proof ?? "");
|
|
42
|
-
for (const path2 of [...input.files.keys()].sort()) {
|
|
43
|
-
const text = input.files.get(path2);
|
|
44
|
-
part(path2);
|
|
45
|
-
part(text === void 0 ? "missing" : `text:${text}`);
|
|
46
|
-
}
|
|
47
|
-
return hash.digest("hex");
|
|
48
|
-
}
|
|
49
|
-
function refPaths(refs) {
|
|
50
|
-
return [...new Set((refs ?? []).map((ref) => ref.path))].sort();
|
|
51
|
-
}
|
|
52
|
-
function planCriteria(input) {
|
|
53
|
-
const previousById = new Map(input.previous.map((item) => [item.id, item]));
|
|
54
|
-
const settled = [];
|
|
55
|
-
const toJudge = [];
|
|
56
|
-
for (const criterion of input.criteria) {
|
|
57
|
-
const base = { id: criterion.id, criterion: criterion.id };
|
|
58
|
-
if (criterion.proof !== null) {
|
|
59
|
-
settled.push({ ...base, result: "skipped", reason: ARTIFACT_PROOF_REASON });
|
|
60
|
-
continue;
|
|
61
|
-
}
|
|
62
|
-
const kept = previousById.get(criterion.id);
|
|
63
|
-
const paths = refPaths(kept?.refs);
|
|
64
|
-
if (kept !== void 0 && kept.result === "pass" && kept.inputs !== void 0 && paths.length > 0) {
|
|
65
|
-
const inputs = input.inputsFor(criterion, paths);
|
|
66
|
-
if (inputs === kept.inputs) {
|
|
67
|
-
settled.push({ ...base, ...kept.commit === void 0 ? {} : { commit: kept.commit }, result: "pass", ...kept.reason === void 0 ? {} : { reason: kept.reason }, refs: kept.refs, inputs });
|
|
68
|
-
continue;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
toJudge.push(criterion);
|
|
72
|
-
}
|
|
73
|
-
return { settled, toJudge };
|
|
74
|
-
}
|
|
75
|
-
function judgeGroups(criteria, size = JUDGE_GROUP_SIZE) {
|
|
76
|
-
const groups = [];
|
|
77
|
-
for (let start = 0; start < criteria.length; start += size) groups.push(criteria.slice(start, start + size));
|
|
78
|
-
return groups;
|
|
79
|
-
}
|
|
80
|
-
var MAX_ANSWER_ENTRIES = 500;
|
|
81
|
-
var MAX_NAMED_TESTS = 50;
|
|
82
|
-
function readTests(raw) {
|
|
83
|
-
if (!Array.isArray(raw)) return void 0;
|
|
84
|
-
const tests = [];
|
|
85
|
-
for (const entry of raw.slice(0, MAX_NAMED_TESTS)) {
|
|
86
|
-
const { path: path2, line } = typeof entry === "object" && entry !== null ? entry : {};
|
|
87
|
-
if (typeof path2 !== "string" || path2 === "" || path2.length > 1024) continue;
|
|
88
|
-
tests.push({ path: path2, ...typeof line === "number" && Number.isInteger(line) && line > 0 ? { line } : {} });
|
|
89
|
-
}
|
|
90
|
-
return tests;
|
|
91
|
-
}
|
|
92
|
-
function readAnswer(raw) {
|
|
93
|
-
if (typeof raw !== "object" || raw === null || Array.isArray(raw)) return { ok: false, problem: "expected an object" };
|
|
94
|
-
const { result, items } = raw;
|
|
95
|
-
if (result !== void 0 && result !== "pass" && result !== "fail") return { ok: false, problem: 'result: must be "pass" or "fail"' };
|
|
96
|
-
if (items !== void 0 && !Array.isArray(items)) return { ok: false, problem: "items: must be an array" };
|
|
97
|
-
const entries = items ?? [];
|
|
98
|
-
if (entries.length > MAX_ANSWER_ENTRIES) return { ok: false, problem: `items: at most ${MAX_ANSWER_ENTRIES} entries` };
|
|
99
|
-
const read = [];
|
|
100
|
-
for (const [index, entry] of entries.entries()) {
|
|
101
|
-
const { id, result: itemResult, reason, tests } = typeof entry === "object" && entry !== null ? entry : {};
|
|
102
|
-
if (typeof id !== "string" || id === "" || id.length > 200) return { ok: false, problem: `items.${index}.id: must be text of 1 to 200 characters` };
|
|
103
|
-
if (itemResult !== "pass" && itemResult !== "fail") return { ok: false, problem: `items.${index}.result: must be "pass" or "fail"` };
|
|
104
|
-
if (reason !== void 0 && typeof reason !== "string") return { ok: false, problem: `items.${index}.reason: must be text` };
|
|
105
|
-
const named = readTests(tests);
|
|
106
|
-
read.push({ id, result: itemResult, ...reason === void 0 ? {} : { reason }, ...named === void 0 ? {} : { tests: named } });
|
|
107
|
-
}
|
|
108
|
-
return { ok: true, answer: { ...result === void 0 ? {} : { result }, items: read } };
|
|
109
|
-
}
|
|
110
|
-
function parseJudgeAnswer(text) {
|
|
111
|
-
if (text === void 0 || text.trim() === "") return void 0;
|
|
112
|
-
let raw;
|
|
113
|
-
try {
|
|
114
|
-
raw = JSON.parse(text);
|
|
115
|
-
} catch {
|
|
116
|
-
return { ok: false, reason: "the judge's items.json is not JSON" };
|
|
117
|
-
}
|
|
118
|
-
const read = readAnswer(raw);
|
|
119
|
-
return read.ok ? read : { ok: false, reason: `the judge's items.json does not match its shape: ${read.problem}` };
|
|
120
|
-
}
|
|
121
|
-
function oneLineReason(text) {
|
|
122
|
-
if (text === void 0) return void 0;
|
|
123
|
-
const line = text.replace(/\s+/g, " ").trim();
|
|
124
|
-
if (line === "") return void 0;
|
|
125
|
-
return line.length <= CHECK_ITEM_REASON_MAX_LENGTH ? line : `${line.slice(0, CHECK_ITEM_REASON_MAX_LENGTH - 1)}\u2026`;
|
|
126
|
-
}
|
|
127
|
-
function namedTests(tests, input) {
|
|
128
|
-
const refs = [];
|
|
129
|
-
const notTests = [];
|
|
130
|
-
const seen = /* @__PURE__ */ new Set();
|
|
131
|
-
for (const test of tests ?? []) {
|
|
132
|
-
const written = treePath(test.path, input.treeRoot);
|
|
133
|
-
if (written === void 0) continue;
|
|
134
|
-
const path2 = written.startsWith("tree/") && input.ownTree !== true ? written.slice("tree/".length) : written;
|
|
135
|
-
if (path2 === "") continue;
|
|
136
|
-
const known = input.check(path2, test.line);
|
|
137
|
-
if (known === void 0) continue;
|
|
138
|
-
const key = `${path2}:${test.line ?? ""}`;
|
|
139
|
-
if (seen.has(key)) continue;
|
|
140
|
-
if (known === "not-a-test") {
|
|
141
|
-
if (!notTests.includes(path2)) notTests.push(path2);
|
|
142
|
-
continue;
|
|
143
|
-
}
|
|
144
|
-
seen.add(key);
|
|
145
|
-
refs.push({ path: path2, ...test.line === void 0 ? {} : { line: test.line }, ...known.href === void 0 ? {} : { href: known.href } });
|
|
146
|
-
if (refs.length >= CHECK_ITEM_REFS_MAX) break;
|
|
147
|
-
}
|
|
148
|
-
return { refs, notTests };
|
|
149
|
-
}
|
|
150
|
-
function judgedItems(input) {
|
|
151
|
-
return input.toJudge.map((criterion) => {
|
|
152
|
-
const said = input.results.get(criterion.id);
|
|
153
|
-
const base = { id: criterion.id, criterion: criterion.id, commit: input.commit };
|
|
154
|
-
if (said === void 0) return { ...base, result: "fail", reason: NO_VERDICT_REASON };
|
|
155
|
-
const { refs, notTests } = namedTests(said.tests, { treeRoot: input.treeRoot, check: input.check, ownTree: input.ownTree });
|
|
156
|
-
const withRefs = refs.length === 0 ? {} : { refs };
|
|
157
|
-
if (said.result === "pass" && refs.length === 0) return { ...base, result: "fail", reason: notTests.length > 0 ? oneLineReason(notReadAsTestReason(notTests)) : NO_NAMED_TEST_REASON };
|
|
158
|
-
const reason = oneLineReason(said.reason);
|
|
159
|
-
const kept = said.result === "pass" ? { inputs: input.inputsFor(criterion, refPaths(refs)) } : {};
|
|
160
|
-
return { ...base, result: said.result, ...reason === void 0 ? {} : { reason }, ...withRefs, ...kept };
|
|
161
|
-
});
|
|
162
|
-
}
|
|
163
|
-
function failedItems(criteria, reason) {
|
|
164
|
-
const said = oneLineReason(reason) ?? NO_VERDICT_REASON;
|
|
165
|
-
return criteria.map((criterion) => ({ id: criterion.id, criterion: criterion.id, result: "fail", reason: said }));
|
|
166
|
-
}
|
|
167
|
-
function testsByCriterion(items) {
|
|
168
|
-
const tests = {};
|
|
169
|
-
for (const item of items) {
|
|
170
|
-
tests[item.id] = (item.refs ?? []).flatMap((ref) => ref.line === void 0 ? [] : [{ path: ref.path, line: ref.line, href: ref.href ?? null }]);
|
|
171
|
-
}
|
|
172
|
-
return tests;
|
|
173
|
-
}
|
|
174
|
-
function inCriteriaOrder(items, criteria) {
|
|
175
|
-
const order = new Map(criteria.map((criterion, index) => [criterion.id, index]));
|
|
176
|
-
return [...items].sort((a, b) => (order.get(a.id) ?? Number.MAX_SAFE_INTEGER) - (order.get(b.id) ?? Number.MAX_SAFE_INTEGER));
|
|
177
|
-
}
|
|
178
|
-
function itemsSentence(items, noun) {
|
|
179
|
-
const failing = items.filter((item) => item.result === "fail").map((item) => item.id);
|
|
180
|
-
if (failing.length === 0) return void 0;
|
|
181
|
-
return `${failing.length} of ${items.length} ${items.length === 1 ? noun.one : noun.many} not satisfied: ${failing.join(", ")}`;
|
|
182
|
-
}
|
|
183
11
|
|
|
184
12
|
// ../../node_modules/balanced-match/dist/esm/index.js
|
|
185
13
|
var balanced = (a, b, str) => {
|
|
@@ -2080,6 +1908,178 @@ function runnerMatcher(runners) {
|
|
|
2080
1908
|
return index === -1 ? void 0 : index;
|
|
2081
1909
|
};
|
|
2082
1910
|
}
|
|
1911
|
+
var ARTIFACT_PROOF_REASON = "Its declared artifact proves it; the judge does not judge artifacts.";
|
|
1912
|
+
var NO_NAMED_TEST_REASON = "The judge named no test file that proves this criterion.";
|
|
1913
|
+
var NO_VERDICT_REASON = "The judge gave no result for this criterion.";
|
|
1914
|
+
var JUDGE_GROUP_SIZE = 12;
|
|
1915
|
+
function notReadAsTestReason(paths) {
|
|
1916
|
+
const named = paths.slice(0, 3).map((path2) => `\`${path2}\``);
|
|
1917
|
+
const list = named.length === 1 ? named[0] : `${named.slice(0, -1).join(", ")} and ${named.at(-1)}`;
|
|
1918
|
+
const more = paths.length > 3 ? " and other files" : "";
|
|
1919
|
+
const one = paths.length === 1;
|
|
1920
|
+
return `The judge named ${list}${more}, which ${one ? "is" : "are"} not read as ${one ? "a test" : "tests"}. If ${one ? "that file holds" : "one of them holds"} the test, name it with a runner glob in \`.outerlayer-proofs.yaml\`.`;
|
|
1921
|
+
}
|
|
1922
|
+
function treePath(raw, treeRoot) {
|
|
1923
|
+
let path2 = raw.trim().replace(/\\/g, "/");
|
|
1924
|
+
const root = `${treeRoot.replace(/\/+$/, "")}/`;
|
|
1925
|
+
if (path2.startsWith(root)) path2 = path2.slice(root.length);
|
|
1926
|
+
while (path2.startsWith("./")) path2 = path2.slice(2);
|
|
1927
|
+
if (path2 === "" || path2.length > CHECK_ITEM_REF_PATH_MAX_LENGTH || path2.startsWith("/") || /[\u0000-\u001f\u007f]/.test(path2)) return void 0;
|
|
1928
|
+
if (path2.split("/").some((segment) => segment === ".." || segment === "")) return void 0;
|
|
1929
|
+
return path2;
|
|
1930
|
+
}
|
|
1931
|
+
function criterionInputs(input) {
|
|
1932
|
+
const hash = createHash("sha256");
|
|
1933
|
+
const part = (text) => {
|
|
1934
|
+
hash.update(`${Buffer.byteLength(text)}:`);
|
|
1935
|
+
hash.update(text);
|
|
1936
|
+
};
|
|
1937
|
+
part("judge-criterion-v2");
|
|
1938
|
+
part(input.brief);
|
|
1939
|
+
part(input.criterion.id);
|
|
1940
|
+
part(input.criterion.text);
|
|
1941
|
+
part(input.criterion.proof ?? "");
|
|
1942
|
+
for (const path2 of [...input.files.keys()].sort()) {
|
|
1943
|
+
const text = input.files.get(path2);
|
|
1944
|
+
part(path2);
|
|
1945
|
+
part(text === void 0 ? "missing" : `text:${text}`);
|
|
1946
|
+
}
|
|
1947
|
+
return hash.digest("hex");
|
|
1948
|
+
}
|
|
1949
|
+
function refPaths(refs) {
|
|
1950
|
+
return [...new Set((refs ?? []).map((ref) => ref.path))].sort();
|
|
1951
|
+
}
|
|
1952
|
+
function planCriteria(input) {
|
|
1953
|
+
const previousById = new Map(input.previous.map((item) => [item.id, item]));
|
|
1954
|
+
const settled = [];
|
|
1955
|
+
const toJudge = [];
|
|
1956
|
+
for (const criterion of input.criteria) {
|
|
1957
|
+
const base = { id: criterion.id, criterion: criterion.id };
|
|
1958
|
+
if (criterion.proof !== null) {
|
|
1959
|
+
settled.push({ ...base, result: "skipped", reason: ARTIFACT_PROOF_REASON });
|
|
1960
|
+
continue;
|
|
1961
|
+
}
|
|
1962
|
+
const kept = previousById.get(criterion.id);
|
|
1963
|
+
const paths = refPaths(kept?.refs);
|
|
1964
|
+
if (kept !== void 0 && kept.result === "pass" && kept.inputs !== void 0 && paths.length > 0) {
|
|
1965
|
+
const inputs = input.inputsFor(criterion, paths);
|
|
1966
|
+
if (inputs === kept.inputs) {
|
|
1967
|
+
settled.push({ ...base, ...kept.commit === void 0 ? {} : { commit: kept.commit }, result: "pass", ...kept.reason === void 0 ? {} : { reason: kept.reason }, refs: kept.refs, inputs });
|
|
1968
|
+
continue;
|
|
1969
|
+
}
|
|
1970
|
+
}
|
|
1971
|
+
toJudge.push(criterion);
|
|
1972
|
+
}
|
|
1973
|
+
return { settled, toJudge };
|
|
1974
|
+
}
|
|
1975
|
+
function judgeGroups(criteria, size = JUDGE_GROUP_SIZE) {
|
|
1976
|
+
const groups = [];
|
|
1977
|
+
for (let start = 0; start < criteria.length; start += size) groups.push(criteria.slice(start, start + size));
|
|
1978
|
+
return groups;
|
|
1979
|
+
}
|
|
1980
|
+
var MAX_ANSWER_ENTRIES = 500;
|
|
1981
|
+
var MAX_NAMED_TESTS = 50;
|
|
1982
|
+
function readTests(raw) {
|
|
1983
|
+
if (!Array.isArray(raw)) return void 0;
|
|
1984
|
+
const tests = [];
|
|
1985
|
+
for (const entry of raw.slice(0, MAX_NAMED_TESTS)) {
|
|
1986
|
+
const { path: path2, line } = typeof entry === "object" && entry !== null ? entry : {};
|
|
1987
|
+
if (typeof path2 !== "string" || path2 === "" || path2.length > 1024) continue;
|
|
1988
|
+
tests.push({ path: path2, ...typeof line === "number" && Number.isInteger(line) && line > 0 ? { line } : {} });
|
|
1989
|
+
}
|
|
1990
|
+
return tests;
|
|
1991
|
+
}
|
|
1992
|
+
function readAnswer(raw) {
|
|
1993
|
+
if (typeof raw !== "object" || raw === null || Array.isArray(raw)) return { ok: false, problem: "expected an object" };
|
|
1994
|
+
const { result, items } = raw;
|
|
1995
|
+
if (result !== void 0 && result !== "pass" && result !== "fail") return { ok: false, problem: 'result: must be "pass" or "fail"' };
|
|
1996
|
+
if (items !== void 0 && !Array.isArray(items)) return { ok: false, problem: "items: must be an array" };
|
|
1997
|
+
const entries = items ?? [];
|
|
1998
|
+
if (entries.length > MAX_ANSWER_ENTRIES) return { ok: false, problem: `items: at most ${MAX_ANSWER_ENTRIES} entries` };
|
|
1999
|
+
const read = [];
|
|
2000
|
+
for (const [index, entry] of entries.entries()) {
|
|
2001
|
+
const { id, result: itemResult, reason, tests } = typeof entry === "object" && entry !== null ? entry : {};
|
|
2002
|
+
if (typeof id !== "string" || id === "" || id.length > 200) return { ok: false, problem: `items.${index}.id: must be text of 1 to 200 characters` };
|
|
2003
|
+
if (itemResult !== "pass" && itemResult !== "fail") return { ok: false, problem: `items.${index}.result: must be "pass" or "fail"` };
|
|
2004
|
+
if (reason !== void 0 && typeof reason !== "string") return { ok: false, problem: `items.${index}.reason: must be text` };
|
|
2005
|
+
const named = readTests(tests);
|
|
2006
|
+
read.push({ id, result: itemResult, ...reason === void 0 ? {} : { reason }, ...named === void 0 ? {} : { tests: named } });
|
|
2007
|
+
}
|
|
2008
|
+
return { ok: true, answer: { ...result === void 0 ? {} : { result }, items: read } };
|
|
2009
|
+
}
|
|
2010
|
+
function parseJudgeAnswer(text) {
|
|
2011
|
+
if (text === void 0 || text.trim() === "") return void 0;
|
|
2012
|
+
let raw;
|
|
2013
|
+
try {
|
|
2014
|
+
raw = JSON.parse(text);
|
|
2015
|
+
} catch {
|
|
2016
|
+
return { ok: false, reason: "the judge's items.json is not JSON" };
|
|
2017
|
+
}
|
|
2018
|
+
const read = readAnswer(raw);
|
|
2019
|
+
return read.ok ? read : { ok: false, reason: `the judge's items.json does not match its shape: ${read.problem}` };
|
|
2020
|
+
}
|
|
2021
|
+
function oneLineReason(text) {
|
|
2022
|
+
if (text === void 0) return void 0;
|
|
2023
|
+
const line = text.replace(/\s+/g, " ").trim();
|
|
2024
|
+
if (line === "") return void 0;
|
|
2025
|
+
return line.length <= CHECK_ITEM_REASON_MAX_LENGTH ? line : `${line.slice(0, CHECK_ITEM_REASON_MAX_LENGTH - 1)}\u2026`;
|
|
2026
|
+
}
|
|
2027
|
+
function namedTests(tests, input) {
|
|
2028
|
+
const refs = [];
|
|
2029
|
+
const notTests = [];
|
|
2030
|
+
const seen = /* @__PURE__ */ new Set();
|
|
2031
|
+
for (const test of tests ?? []) {
|
|
2032
|
+
const written = treePath(test.path, input.treeRoot);
|
|
2033
|
+
if (written === void 0) continue;
|
|
2034
|
+
const path2 = written.startsWith("tree/") && input.ownTree !== true ? written.slice("tree/".length) : written;
|
|
2035
|
+
if (path2 === "") continue;
|
|
2036
|
+
const known = input.check(path2, test.line);
|
|
2037
|
+
if (known === void 0) continue;
|
|
2038
|
+
const key = `${path2}:${test.line ?? ""}`;
|
|
2039
|
+
if (seen.has(key)) continue;
|
|
2040
|
+
if (known === "not-a-test") {
|
|
2041
|
+
if (!notTests.includes(path2)) notTests.push(path2);
|
|
2042
|
+
continue;
|
|
2043
|
+
}
|
|
2044
|
+
seen.add(key);
|
|
2045
|
+
refs.push({ path: path2, ...test.line === void 0 ? {} : { line: test.line }, ...known.href === void 0 ? {} : { href: known.href } });
|
|
2046
|
+
if (refs.length >= CHECK_ITEM_REFS_MAX) break;
|
|
2047
|
+
}
|
|
2048
|
+
return { refs, notTests };
|
|
2049
|
+
}
|
|
2050
|
+
function judgedItems(input) {
|
|
2051
|
+
return input.toJudge.map((criterion) => {
|
|
2052
|
+
const said = input.results.get(criterion.id);
|
|
2053
|
+
const base = { id: criterion.id, criterion: criterion.id, commit: input.commit };
|
|
2054
|
+
if (said === void 0) return { ...base, result: "fail", reason: NO_VERDICT_REASON };
|
|
2055
|
+
const { refs, notTests } = namedTests(said.tests, { treeRoot: input.treeRoot, check: input.check, ownTree: input.ownTree });
|
|
2056
|
+
const withRefs = refs.length === 0 ? {} : { refs };
|
|
2057
|
+
if (said.result === "pass" && refs.length === 0) return { ...base, result: "fail", reason: notTests.length > 0 ? oneLineReason(notReadAsTestReason(notTests)) : NO_NAMED_TEST_REASON };
|
|
2058
|
+
const reason = oneLineReason(said.reason);
|
|
2059
|
+
const kept = said.result === "pass" ? { inputs: input.inputsFor(criterion, refPaths(refs)) } : {};
|
|
2060
|
+
return { ...base, result: said.result, ...reason === void 0 ? {} : { reason }, ...withRefs, ...kept };
|
|
2061
|
+
});
|
|
2062
|
+
}
|
|
2063
|
+
function failedItems(criteria, reason) {
|
|
2064
|
+
const said = oneLineReason(reason) ?? NO_VERDICT_REASON;
|
|
2065
|
+
return criteria.map((criterion) => ({ id: criterion.id, criterion: criterion.id, result: "fail", reason: said }));
|
|
2066
|
+
}
|
|
2067
|
+
function testsByCriterion(items) {
|
|
2068
|
+
const tests = {};
|
|
2069
|
+
for (const item of items) {
|
|
2070
|
+
tests[item.id] = (item.refs ?? []).flatMap((ref) => ref.line === void 0 ? [] : [{ path: ref.path, line: ref.line, href: ref.href ?? null }]);
|
|
2071
|
+
}
|
|
2072
|
+
return tests;
|
|
2073
|
+
}
|
|
2074
|
+
function inCriteriaOrder(items, criteria) {
|
|
2075
|
+
const order = new Map(criteria.map((criterion, index) => [criterion.id, index]));
|
|
2076
|
+
return [...items].sort((a, b) => (order.get(a.id) ?? Number.MAX_SAFE_INTEGER) - (order.get(b.id) ?? Number.MAX_SAFE_INTEGER));
|
|
2077
|
+
}
|
|
2078
|
+
function itemsSentence(items, noun) {
|
|
2079
|
+
const failing = items.filter((item) => item.result === "fail").map((item) => item.id);
|
|
2080
|
+
if (failing.length === 0) return void 0;
|
|
2081
|
+
return `${failing.length} of ${items.length} ${items.length === 1 ? noun.one : noun.many} not satisfied: ${failing.join(", ")}`;
|
|
2082
|
+
}
|
|
2083
2083
|
var MAX_TEST_FILE_BYTES = 1024 * 1024;
|
|
2084
2084
|
async function loadCitationFinder() {
|
|
2085
2085
|
return await import(pathToFileURL(join(resolvePackRoot(), "maintained", "outerlayer-build", "scripts", "criterion-citations.mjs")).href);
|