@tangle-network/agent-bench 2.0.0 → 4.0.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/CHANGELOG.md +27 -0
- package/README.md +32 -2
- package/dist/adapters.d.ts +3 -3
- package/dist/adapters.js +3 -5
- package/dist/adapters.js.map +1 -1
- package/dist/benchmarks/_harness.d.ts +4 -4
- package/dist/benchmarks/_harness.js +5 -2
- package/dist/benchmarks/_harness.js.map +1 -1
- package/dist/benchmarks/aec-bench.d.ts +2 -2
- package/dist/benchmarks/aec-bench.js +49 -42
- package/dist/benchmarks/aec-bench.js.map +1 -1
- package/dist/benchmarks/agentbench.d.ts +2 -2
- package/dist/benchmarks/agentbench.js +41 -34
- package/dist/benchmarks/agentbench.js.map +1 -1
- package/dist/benchmarks/appworld.d.ts +4 -4
- package/dist/benchmarks/appworld.js +67 -53
- package/dist/benchmarks/appworld.js.map +1 -1
- package/dist/benchmarks/bfcl.d.ts +2 -2
- package/dist/benchmarks/bfcl.js +52 -44
- package/dist/benchmarks/bfcl.js.map +1 -1
- package/dist/benchmarks/cad-design.d.ts +2 -2
- package/dist/benchmarks/cad-design.js +53 -44
- package/dist/benchmarks/cad-design.js.map +1 -1
- package/dist/benchmarks/cadbench.d.ts +2 -2
- package/dist/benchmarks/cadbench.js +1 -1
- package/dist/benchmarks/cadgenbench.d.ts +2 -2
- package/dist/benchmarks/cadgenbench.js +1 -1
- package/dist/benchmarks/commit0.d.ts +2 -2
- package/dist/benchmarks/commit0.js +38 -31
- package/dist/benchmarks/commit0.js.map +1 -1
- package/dist/benchmarks/crag.d.ts +2 -2
- package/dist/benchmarks/crag.js +37 -32
- package/dist/benchmarks/crag.js.map +1 -1
- package/dist/benchmarks/dabstep.d.ts +2 -2
- package/dist/benchmarks/dabstep.js +41 -34
- package/dist/benchmarks/dabstep.js.map +1 -1
- package/dist/benchmarks/finresearchbench.d.ts +4 -4
- package/dist/benchmarks/finresearchbench.js +61 -48
- package/dist/benchmarks/finresearchbench.js.map +1 -1
- package/dist/benchmarks/finsearchcomp.d.ts +3 -3
- package/dist/benchmarks/finsearchcomp.js +54 -43
- package/dist/benchmarks/finsearchcomp.js.map +1 -1
- package/dist/benchmarks/frames.d.ts +2 -2
- package/dist/benchmarks/frames.js +66 -51
- package/dist/benchmarks/frames.js.map +1 -1
- package/dist/benchmarks/hotpotqa.d.ts +2 -2
- package/dist/benchmarks/hotpotqa.js +59 -47
- package/dist/benchmarks/hotpotqa.js.map +1 -1
- package/dist/benchmarks/humaneval.d.ts +3 -3
- package/dist/benchmarks/humaneval.js +39 -35
- package/dist/benchmarks/humaneval.js.map +1 -1
- package/dist/benchmarks/mcad-bench.d.ts +2 -2
- package/dist/benchmarks/mcad-bench.js +68 -56
- package/dist/benchmarks/mcad-bench.js.map +1 -1
- package/dist/benchmarks/mcad-cq-bench.d.ts +2 -2
- package/dist/benchmarks/mcad-cq-bench.js +69 -57
- package/dist/benchmarks/mcad-cq-bench.js.map +1 -1
- package/dist/benchmarks/mcad-cq-golds.d.ts +1 -1
- package/dist/benchmarks/mcad-cq-golds.js +1 -1
- package/dist/benchmarks/mcad-cq-golds.js.map +1 -1
- package/dist/benchmarks/mcad-golds.d.ts +1 -1
- package/dist/benchmarks/mcad-golds.js.map +1 -1
- package/dist/benchmarks/mind2web.d.ts +3 -3
- package/dist/benchmarks/mind2web.js +62 -49
- package/dist/benchmarks/mind2web.js.map +1 -1
- package/dist/benchmarks/nomiracl.d.ts +2 -2
- package/dist/benchmarks/nomiracl.js +43 -36
- package/dist/benchmarks/nomiracl.js.map +1 -1
- package/dist/benchmarks/open-rag-bench.d.ts +2 -2
- package/dist/benchmarks/open-rag-bench.js +37 -32
- package/dist/benchmarks/open-rag-bench.js.map +1 -1
- package/dist/benchmarks/programbench.d.ts +2 -2
- package/dist/benchmarks/programbench.js +28 -23
- package/dist/benchmarks/programbench.js.map +1 -1
- package/dist/benchmarks/rag-shared.d.ts +2 -2
- package/dist/benchmarks/rag-shared.js +15 -13
- package/dist/benchmarks/rag-shared.js.map +1 -1
- package/dist/benchmarks/ragbench.d.ts +2 -2
- package/dist/benchmarks/ragbench.js +34 -29
- package/dist/benchmarks/ragbench.js.map +1 -1
- package/dist/benchmarks/simpleqa.d.ts +2 -2
- package/dist/benchmarks/simpleqa.js +62 -51
- package/dist/benchmarks/simpleqa.js.map +1 -1
- package/dist/benchmarks/swe-bench.d.ts +4 -4
- package/dist/benchmarks/swe-bench.js +47 -41
- package/dist/benchmarks/swe-bench.js.map +1 -1
- package/dist/benchmarks/t2-ragbench.d.ts +2 -2
- package/dist/benchmarks/t2-ragbench.js +37 -32
- package/dist/benchmarks/t2-ragbench.js.map +1 -1
- package/dist/benchmarks/tau-bench-shared.d.ts +2 -2
- package/dist/benchmarks/tau-bench-shared.js +43 -36
- package/dist/benchmarks/tau-bench-shared.js.map +1 -1
- package/dist/benchmarks/tau2-bench.d.ts +2 -2
- package/dist/benchmarks/tau2-bench.js.map +1 -1
- package/dist/benchmarks/tau3-banking.d.ts +2 -2
- package/dist/benchmarks/tau3-banking.js.map +1 -1
- package/dist/benchmarks/terminal-bench.d.ts +2 -2
- package/dist/benchmarks/terminal-bench.js +29 -23
- package/dist/benchmarks/terminal-bench.js.map +1 -1
- package/dist/benchmarks/toollm.d.ts +2 -2
- package/dist/benchmarks/toollm.js +40 -34
- package/dist/benchmarks/toollm.js.map +1 -1
- package/dist/benchmarks/trata-hedge.d.ts +2 -2
- package/dist/benchmarks/trata-hedge.js +46 -38
- package/dist/benchmarks/trata-hedge.js.map +1 -1
- package/dist/benchmarks/types.d.ts +33 -63
- package/dist/benchmarks/types.js +36 -1
- package/dist/benchmarks/types.js.map +1 -0
- package/dist/benchmarks/webarena-verified.d.ts +2 -2
- package/dist/benchmarks/webarena-verified.js +29 -24
- package/dist/benchmarks/webarena-verified.js.map +1 -1
- package/dist/{cadbench-Byr5gO1M.js → cadbench-htzAmMaI.js} +39 -32
- package/dist/cadbench-htzAmMaI.js.map +1 -0
- package/dist/{cadgenbench-Tvk16YKT.js → cadgenbench-BLvEtnxU.js} +28 -22
- package/dist/cadgenbench-BLvEtnxU.js.map +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +667 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +43 -22
- package/dist/index.js +297 -144
- package/dist/index.js.map +1 -1
- package/package.json +7 -4
- package/pier_agents/candidate_contract.py +226 -74
- package/pier_agents/tangle_candidate.py +79 -1
- package/pier_agents/workspace_boundary.py +29 -1
- package/scripts/enterpriseops-gym-run.sh +82 -0
- package/scripts/grade-recorded-evidence.mjs +6 -6
- package/scripts/harvey-lab-judge.py +50 -0
- package/scripts/harvey-lab-run.sh +53 -0
- package/scripts/harvey-lab-sandbox.sh +21 -0
- package/scripts/healthbench-professional-run.sh +30 -0
- package/scripts/healthbench_professional_run.py +112 -0
- package/scripts/mlcr-run.sh +17 -0
- package/scripts/mlcr_run.py +133 -0
- package/scripts/prbench-run.sh +39 -0
- package/scripts/prbench_run.py +53 -0
- package/scripts/verify-packed-consumer.mjs +32 -27
- package/scripts/verify-pier-agent.mts +142 -25
- package/src/adapters.ts +5 -7
- package/src/benchmarks/_harness.test.mts +18 -1
- package/src/benchmarks/_harness.ts +12 -7
- package/src/benchmarks/aec-bench.test.mts +14 -14
- package/src/benchmarks/aec-bench.ts +62 -56
- package/src/benchmarks/agent-eval-contract.test.mts +38 -0
- package/src/benchmarks/agentbench.ts +44 -37
- package/src/benchmarks/appworld.test.mts +7 -7
- package/src/benchmarks/appworld.ts +88 -75
- package/src/benchmarks/bfcl.ts +60 -53
- package/src/benchmarks/cad-design.ts +34 -32
- package/src/benchmarks/cadbench.ts +34 -32
- package/src/benchmarks/cadgenbench.ts +30 -28
- package/src/benchmarks/commit0.test.mts +9 -9
- package/src/benchmarks/commit0.ts +50 -43
- package/src/benchmarks/crag.ts +45 -40
- package/src/benchmarks/dabstep-official.test.mts +8 -8
- package/src/benchmarks/dabstep.test.mts +11 -11
- package/src/benchmarks/dabstep.ts +47 -40
- package/src/benchmarks/external-adapters.test.mts +43 -44
- package/src/benchmarks/finresearchbench.ts +57 -47
- package/src/benchmarks/finsearchcomp.ts +72 -67
- package/src/benchmarks/frames.ts +76 -69
- package/src/benchmarks/hotpotqa.ts +69 -64
- package/src/benchmarks/humaneval.ts +37 -35
- package/src/benchmarks/mcad-bench.test.mts +30 -30
- package/src/benchmarks/mcad-bench.ts +66 -60
- package/src/benchmarks/mcad-cq-bench.ts +69 -63
- package/src/benchmarks/mcad-cq-golds.ts +1 -1
- package/src/benchmarks/mcad-cq.test.mts +40 -40
- package/src/benchmarks/mcad-golds.ts +1 -1
- package/src/benchmarks/mind2web.ts +66 -58
- package/src/benchmarks/nomiracl.ts +53 -46
- package/src/benchmarks/open-rag-bench.ts +47 -42
- package/src/benchmarks/programbench.test.mts +10 -10
- package/src/benchmarks/programbench.ts +38 -33
- package/src/benchmarks/rag-benchmarks.test.mts +31 -31
- package/src/benchmarks/rag-shared.ts +13 -16
- package/src/benchmarks/ragbench.ts +44 -39
- package/src/benchmarks/simpleqa.ts +78 -73
- package/src/benchmarks/swe-bench.test.mts +3 -3
- package/src/benchmarks/swe-bench.ts +66 -61
- package/src/benchmarks/t2-ragbench.ts +47 -42
- package/src/benchmarks/tau-bench-shared.ts +51 -44
- package/src/benchmarks/tau-pin.test.mts +1 -1
- package/src/benchmarks/tau2-bench.ts +2 -2
- package/src/benchmarks/tau3-banking.ts +2 -2
- package/src/benchmarks/terminal-bench.test.mts +3 -3
- package/src/benchmarks/terminal-bench.ts +41 -36
- package/src/benchmarks/toollm.ts +54 -47
- package/src/benchmarks/trata-hedge.ts +57 -52
- package/src/benchmarks/types.ts +70 -59
- package/src/benchmarks/webarena-verified.ts +49 -42
- package/src/cli.ts +74 -0
- package/src/corpus-replay.mts +9 -9
- package/src/examples/benchmark-matrix.mts +13 -10
- package/src/gate-cli.mts +5 -5
- package/src/gate.test.mts +14 -12
- package/src/gate.ts +23 -22
- package/src/index.ts +20 -11
- package/src/pier-agent.ts +108 -38
- package/src/pier-trial-controller.test.mts +48 -1
- package/src/pier-trial-controller.ts +121 -8
- package/src/published.test.mts +534 -0
- package/src/published.ts +524 -0
- package/src/run-benchmarks-cli.mts +2 -2
- package/src/run-benchmarks.test.mts +58 -48
- package/src/run-benchmarks.ts +64 -57
- package/src/swe-bench-env.ts +6 -6
- package/src/worker.ts +1 -1
- package/dist/benchmarks/enterpriseops-gym.d.ts +0 -6
- package/dist/benchmarks/enterpriseops-gym.js +0 -236
- package/dist/benchmarks/enterpriseops-gym.js.map +0 -1
- package/dist/cadbench-Byr5gO1M.js.map +0 -1
- package/dist/cadgenbench-Tvk16YKT.js.map +0 -1
- package/fixtures/enterpriseops-gym.json +0 -103
- package/scripts/enterpriseops_gym_judge.py +0 -281
- package/src/benchmarks/enterpriseops-gym.test.mts +0 -77
- package/src/benchmarks/enterpriseops-gym.ts +0 -343
- package/src/eops-skills/address-every-subtask.md +0 -5
- package/src/eops-skills/exact-tools-and-args.md +0 -5
- package/src/eops-skills/full-sequence-to-goal.md +0 -5
- package/src/eops-skills/ground-every-value.md +0 -5
- package/src/eops-skills/honor-the-policies.md +0 -5
package/src/benchmarks/frames.ts
CHANGED
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
* temperature 0), fired ONLY when Tier 1 misses, to absorb the
|
|
12
12
|
* paraphrase/alias equivalence FRAMES intends to allow.
|
|
13
13
|
*
|
|
14
|
-
* score is binary (
|
|
14
|
+
* score is binary (passed ? 1 : 0) — FRAMES has no partial credit. The judge
|
|
15
15
|
* resolves strictly on the Answer value; wiki_links are a SOFT signal surfaced
|
|
16
|
-
* in `
|
|
16
|
+
* in `notes` for the critic, never a hard pass criterion.
|
|
17
17
|
*
|
|
18
18
|
* Requires for a live run: the bench `.venv` with `datasets` installed and a
|
|
19
19
|
* JUDGE_MODEL router key. For offline/CI verification set FRAMES_FIXTURES=1 to
|
|
@@ -27,7 +27,7 @@ import { fileURLToPath } from 'node:url'
|
|
|
27
27
|
import { promisify } from 'node:util'
|
|
28
28
|
import { runBenchRouterTurn } from '../router-turn'
|
|
29
29
|
import { FINAL_ANSWER_SENTINEL, parseCitations, parseFinalAnswer } from './rag-shared'
|
|
30
|
-
import
|
|
30
|
+
import { type BenchEvaluation, type BenchTask, type LoadOptions, type RuntimeBenchmark, runtimeBenchmark } from './types'
|
|
31
31
|
|
|
32
32
|
const execFileAsync = promisify(execFile)
|
|
33
33
|
const BENCH_ROOT = fileURLToPath(new URL('../..', import.meta.url))
|
|
@@ -338,8 +338,7 @@ function rowToTask(row: FramesRow, index: number): BenchTask {
|
|
|
338
338
|
}
|
|
339
339
|
return {
|
|
340
340
|
id: `frames-${index}`,
|
|
341
|
-
|
|
342
|
-
prompt: row.Prompt + WORKER_CONTRACT,
|
|
341
|
+
payload: { prompt: row.Prompt + WORKER_CONTRACT, subset: 'test' },
|
|
343
342
|
metadata: meta as unknown as Record<string, unknown>,
|
|
344
343
|
}
|
|
345
344
|
}
|
|
@@ -347,7 +346,7 @@ function rowToTask(row: FramesRow, index: number): BenchTask {
|
|
|
347
346
|
function readMeta(task: BenchTask): FramesMeta {
|
|
348
347
|
const md = task.metadata
|
|
349
348
|
if (!md || typeof md.gold !== 'string') {
|
|
350
|
-
throw new Error(`FRAMES task ${task.id} missing metadata.gold —
|
|
349
|
+
throw new Error(`FRAMES task ${task.id} missing metadata.gold — loadAll did not populate it`)
|
|
351
350
|
}
|
|
352
351
|
return md as unknown as FramesMeta
|
|
353
352
|
}
|
|
@@ -365,40 +364,13 @@ async function loadFixtures(opts: LoadOptions): Promise<BenchTask[]> {
|
|
|
365
364
|
return tasks
|
|
366
365
|
}
|
|
367
366
|
|
|
368
|
-
export function createFramesAdapter():
|
|
367
|
+
export function createFramesAdapter(): RuntimeBenchmark {
|
|
369
368
|
const fixturesMode = process.env.FRAMES_FIXTURES === '1'
|
|
370
369
|
|
|
371
|
-
return {
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
async preflight() {
|
|
375
|
-
// Tier-2 judge router config must be present in both modes — the loop's
|
|
376
|
-
// citation-coverage stop gate is meaningless without the equivalence judge.
|
|
377
|
-
judgeRouter()
|
|
378
|
-
if (fixturesMode) {
|
|
379
|
-
await readFile(FIXTURES, 'utf8').catch((err) => {
|
|
380
|
-
throw new Error(`FRAMES_FIXTURES=1 but ${FIXTURES} unreadable: ${err instanceof Error ? err.message : err}`)
|
|
381
|
-
})
|
|
382
|
-
return
|
|
383
|
-
}
|
|
384
|
-
try {
|
|
385
|
-
await py(
|
|
386
|
-
`from datasets import load_dataset
|
|
387
|
-
load_dataset(${JSON.stringify(DATASET)}, split='test', revision=${JSON.stringify(DATASET_REVISION)})
|
|
388
|
-
print('ok')`,
|
|
389
|
-
)
|
|
390
|
-
} catch (err) {
|
|
391
|
-
const msg = err instanceof Error ? err.message : String(err)
|
|
392
|
-
throw new Error(
|
|
393
|
-
`frames preflight failed: ${msg}\n` +
|
|
394
|
-
`Fix: (1) python3 -m venv bench/.venv && bench/.venv/bin/pip install datasets ; ` +
|
|
395
|
-
`(2) ensure network access to Hugging Face for ${DATASET} ; ` +
|
|
396
|
-
`or set FRAMES_FIXTURES=1 to run against the committed fixtures offline.`,
|
|
397
|
-
)
|
|
398
|
-
}
|
|
399
|
-
},
|
|
370
|
+
return runtimeBenchmark({
|
|
371
|
+
id: 'frames',
|
|
400
372
|
|
|
401
|
-
async
|
|
373
|
+
async loadAll(opts: LoadOptions = {}) {
|
|
402
374
|
if (fixturesMode) return loadFixtures(opts)
|
|
403
375
|
const limit = opts.limit ?? 10
|
|
404
376
|
const script = `
|
|
@@ -427,15 +399,7 @@ print(json.dumps(out))
|
|
|
427
399
|
return rows.map((r) => rowToTask(r, r._index))
|
|
428
400
|
},
|
|
429
401
|
|
|
430
|
-
async
|
|
431
|
-
// Gold artifact = the worker-contract serialization of the gold Answer, so
|
|
432
|
-
// verify-judge proves gold→resolved through the SAME parse path the real
|
|
433
|
-
// artifact takes (Tier-1 short-circuits with no model tokens).
|
|
434
|
-
const meta = readMeta(task)
|
|
435
|
-
return `${FINAL_ANSWER_SENTINEL} ${meta.gold}`
|
|
436
|
-
},
|
|
437
|
-
|
|
438
|
-
async judge(task: BenchTask, artifact: string): Promise<BenchScore> {
|
|
402
|
+
async evaluate(task: BenchTask, artifact: string): Promise<BenchEvaluation> {
|
|
439
403
|
const meta = readMeta(task)
|
|
440
404
|
const finalAnswer = parseFinalAnswer(artifact)
|
|
441
405
|
const citations = parseCitations(artifact)
|
|
@@ -443,45 +407,88 @@ print(json.dumps(out))
|
|
|
443
407
|
|
|
444
408
|
if (finalAnswer.length === 0) {
|
|
445
409
|
// Fail-closed: distinguish prompt-adherence failure from a wrong answer.
|
|
410
|
+
const raw = {
|
|
411
|
+
tier: 'none',
|
|
412
|
+
reason: 'no parseable answer',
|
|
413
|
+
normalizedGold: normalizeFramesAnswer(meta.gold),
|
|
414
|
+
citationCoverage: coverage,
|
|
415
|
+
}
|
|
446
416
|
return {
|
|
447
|
-
|
|
417
|
+
passed: false,
|
|
448
418
|
score: 0,
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
reason: 'no parseable answer',
|
|
452
|
-
normalizedGold: normalizeFramesAnswer(meta.gold),
|
|
453
|
-
citationCoverage: coverage,
|
|
454
|
-
}),
|
|
419
|
+
notes: JSON.stringify(raw),
|
|
420
|
+
raw,
|
|
455
421
|
}
|
|
456
422
|
}
|
|
457
423
|
|
|
458
424
|
// Tier 1 — free, deterministic.
|
|
459
425
|
if (tier1Match(finalAnswer, meta.gold)) {
|
|
426
|
+
const raw = {
|
|
427
|
+
tier: 1,
|
|
428
|
+
normalizedAnswer: normalizeFramesAnswer(finalAnswer),
|
|
429
|
+
normalizedGold: normalizeFramesAnswer(meta.gold),
|
|
430
|
+
citationCoverage: coverage,
|
|
431
|
+
}
|
|
460
432
|
return {
|
|
461
|
-
|
|
433
|
+
passed: true,
|
|
462
434
|
score: 1,
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
normalizedAnswer: normalizeFramesAnswer(finalAnswer),
|
|
466
|
-
normalizedGold: normalizeFramesAnswer(meta.gold),
|
|
467
|
-
citationCoverage: coverage,
|
|
468
|
-
}),
|
|
435
|
+
notes: JSON.stringify(raw),
|
|
436
|
+
raw,
|
|
469
437
|
}
|
|
470
438
|
}
|
|
471
439
|
|
|
472
440
|
// Tier 2 — constrained LLM equivalence gate (fail loud on unparseable output).
|
|
473
441
|
const verdict = await tier2Judge(meta.rawPrompt, meta.gold, finalAnswer, judgeRouter())
|
|
442
|
+
const raw = {
|
|
443
|
+
tier: 2,
|
|
444
|
+
normalizedAnswer: normalizeFramesAnswer(finalAnswer),
|
|
445
|
+
normalizedGold: normalizeFramesAnswer(meta.gold),
|
|
446
|
+
judgeVerdict: verdict ? 'correct' : 'incorrect',
|
|
447
|
+
citationCoverage: coverage,
|
|
448
|
+
}
|
|
474
449
|
return {
|
|
475
|
-
|
|
450
|
+
passed: verdict,
|
|
476
451
|
score: verdict ? 1 : 0,
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
normalizedAnswer: normalizeFramesAnswer(finalAnswer),
|
|
480
|
-
normalizedGold: normalizeFramesAnswer(meta.gold),
|
|
481
|
-
judgeVerdict: verdict ? 'correct' : 'incorrect',
|
|
482
|
-
citationCoverage: coverage,
|
|
483
|
-
}),
|
|
452
|
+
notes: JSON.stringify(raw),
|
|
453
|
+
raw,
|
|
484
454
|
}
|
|
485
455
|
},
|
|
486
|
-
|
|
456
|
+
|
|
457
|
+
runtime: {
|
|
458
|
+
async preflight() {
|
|
459
|
+
// Tier-2 judge router config must be present in both modes — the loop's
|
|
460
|
+
// citation-coverage stop gate is meaningless without the equivalence judge.
|
|
461
|
+
judgeRouter()
|
|
462
|
+
if (fixturesMode) {
|
|
463
|
+
await readFile(FIXTURES, 'utf8').catch((err) => {
|
|
464
|
+
throw new Error(`FRAMES_FIXTURES=1 but ${FIXTURES} unreadable: ${err instanceof Error ? err.message : err}`)
|
|
465
|
+
})
|
|
466
|
+
return
|
|
467
|
+
}
|
|
468
|
+
try {
|
|
469
|
+
await py(
|
|
470
|
+
`from datasets import load_dataset
|
|
471
|
+
load_dataset(${JSON.stringify(DATASET)}, split='test', revision=${JSON.stringify(DATASET_REVISION)})
|
|
472
|
+
print('ok')`,
|
|
473
|
+
)
|
|
474
|
+
} catch (err) {
|
|
475
|
+
const msg = err instanceof Error ? err.message : String(err)
|
|
476
|
+
throw new Error(
|
|
477
|
+
`frames preflight failed: ${msg}\n` +
|
|
478
|
+
`Fix: (1) python3 -m venv bench/.venv && bench/.venv/bin/pip install datasets ; ` +
|
|
479
|
+
`(2) ensure network access to Hugging Face for ${DATASET} ; ` +
|
|
480
|
+
`or set FRAMES_FIXTURES=1 to run against the committed fixtures offline.`,
|
|
481
|
+
)
|
|
482
|
+
}
|
|
483
|
+
},
|
|
484
|
+
|
|
485
|
+
async goldArtifact(task: BenchTask) {
|
|
486
|
+
// Gold artifact = the worker-contract serialization of the gold Answer, so
|
|
487
|
+
// verify-judge proves gold→passed through the SAME parse path the real
|
|
488
|
+
// artifact takes (Tier-1 short-circuits with no model tokens).
|
|
489
|
+
const meta = readMeta(task)
|
|
490
|
+
return `${FINAL_ANSWER_SENTINEL} ${meta.gold}`
|
|
491
|
+
},
|
|
492
|
+
},
|
|
493
|
+
})
|
|
487
494
|
}
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
* Judge is the official HotpotQA / SQuAD-style metric, FULLY DETERMINISTIC — no
|
|
6
6
|
* LLM. Both the predicted final answer and the gold are normalized (lowercase,
|
|
7
7
|
* strip articles a/an/the, strip punctuation, collapse whitespace), then scored
|
|
8
|
-
* by exact-match (EM) and token-level F1.
|
|
9
|
-
* (default 0.6); score = the F1 (0..1).
|
|
8
|
+
* by exact-match (EM) and token-level F1. passed = EM OR F1 >= HOTPOTQA_F1_PASS
|
|
9
|
+
* (default 0.6); score = the F1 (0..1). notes carries em + f1. This gives the
|
|
10
10
|
* suite a judge that needs no model tokens at all.
|
|
11
11
|
*
|
|
12
12
|
* metadata carries the gold answer + supporting_facts (the title/sent_id pairs of
|
|
@@ -24,7 +24,7 @@ import { join } from 'node:path'
|
|
|
24
24
|
import { fileURLToPath } from 'node:url'
|
|
25
25
|
import { promisify } from 'node:util'
|
|
26
26
|
import { FINAL_ANSWER_SENTINEL, parseFinalAnswer } from './rag-shared'
|
|
27
|
-
import
|
|
27
|
+
import { type BenchEvaluation, type BenchTask, type LoadOptions, type RuntimeBenchmark, runtimeBenchmark } from './types'
|
|
28
28
|
|
|
29
29
|
const execFileAsync = promisify(execFile)
|
|
30
30
|
const BENCH_ROOT = fileURLToPath(new URL('../..', import.meta.url))
|
|
@@ -154,8 +154,7 @@ function rowToTask(row: HotpotRow): BenchTask {
|
|
|
154
154
|
}
|
|
155
155
|
return {
|
|
156
156
|
id: `hotpotqa-${row.id}`,
|
|
157
|
-
|
|
158
|
-
prompt: row.question + WORKER_CONTRACT,
|
|
157
|
+
payload: { prompt: row.question + WORKER_CONTRACT, subset: DATASET_SPLIT },
|
|
159
158
|
metadata: meta as unknown as Record<string, unknown>,
|
|
160
159
|
}
|
|
161
160
|
}
|
|
@@ -163,7 +162,7 @@ function rowToTask(row: HotpotRow): BenchTask {
|
|
|
163
162
|
function readMeta(task: BenchTask): HotpotMeta {
|
|
164
163
|
const md = task.metadata
|
|
165
164
|
if (!md || typeof md.gold !== 'string') {
|
|
166
|
-
throw new Error(`HotpotQA task ${task.id} missing metadata.gold —
|
|
165
|
+
throw new Error(`HotpotQA task ${task.id} missing metadata.gold — loadAll did not populate it`)
|
|
167
166
|
}
|
|
168
167
|
return md as unknown as HotpotMeta
|
|
169
168
|
}
|
|
@@ -183,41 +182,15 @@ async function loadFixtures(opts: LoadOptions): Promise<BenchTask[]> {
|
|
|
183
182
|
return tasks
|
|
184
183
|
}
|
|
185
184
|
|
|
186
|
-
export function createHotpotqaAdapter():
|
|
185
|
+
export function createHotpotqaAdapter(): RuntimeBenchmark {
|
|
187
186
|
const fixturesMode = process.env.HOTPOTQA_FIXTURES === '1'
|
|
188
187
|
// Validate the threshold at construction so a malformed env fails before any run.
|
|
189
188
|
f1PassThreshold()
|
|
190
189
|
|
|
191
|
-
return {
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
async preflight() {
|
|
195
|
-
if (fixturesMode) {
|
|
196
|
-
await readFile(FIXTURES, 'utf8').catch((err) => {
|
|
197
|
-
throw new Error(
|
|
198
|
-
`HOTPOTQA_FIXTURES=1 but ${FIXTURES} unreadable: ${err instanceof Error ? err.message : err}`,
|
|
199
|
-
)
|
|
200
|
-
})
|
|
201
|
-
return
|
|
202
|
-
}
|
|
203
|
-
try {
|
|
204
|
-
await py(
|
|
205
|
-
`from datasets import load_dataset
|
|
206
|
-
load_dataset(${JSON.stringify(DATASET)}, ${JSON.stringify(DATASET_CONFIG)}, split=${JSON.stringify(DATASET_SPLIT)})
|
|
207
|
-
print('ok')`,
|
|
208
|
-
)
|
|
209
|
-
} catch (err) {
|
|
210
|
-
const msg = err instanceof Error ? err.message : String(err)
|
|
211
|
-
throw new Error(
|
|
212
|
-
`hotpotqa preflight failed: ${msg}\n` +
|
|
213
|
-
`Fix: (1) python3 -m venv bench/.venv && bench/.venv/bin/pip install datasets ; ` +
|
|
214
|
-
`(2) ensure network access to Hugging Face for ${DATASET} (${DATASET_CONFIG}) ; ` +
|
|
215
|
-
`or set HOTPOTQA_FIXTURES=1 to run against the committed fixtures offline.`,
|
|
216
|
-
)
|
|
217
|
-
}
|
|
218
|
-
},
|
|
190
|
+
return runtimeBenchmark({
|
|
191
|
+
id: 'hotpotqa',
|
|
219
192
|
|
|
220
|
-
async
|
|
193
|
+
async loadAll(opts: LoadOptions = {}) {
|
|
221
194
|
if (fixturesMode) return loadFixtures(opts)
|
|
222
195
|
const limit = opts.limit ?? 10
|
|
223
196
|
const script = `
|
|
@@ -251,29 +224,23 @@ print(json.dumps(out))
|
|
|
251
224
|
return rows.map(rowToTask)
|
|
252
225
|
},
|
|
253
226
|
|
|
254
|
-
async
|
|
255
|
-
// Gold artifact = the worker-contract serialization of the gold answer, so
|
|
256
|
-
// verify-judge proves gold→resolved through the SAME parse path the real
|
|
257
|
-
// artifact takes.
|
|
258
|
-
const meta = readMeta(task)
|
|
259
|
-
return `${FINAL_ANSWER_SENTINEL} ${meta.gold}`
|
|
260
|
-
},
|
|
261
|
-
|
|
262
|
-
async judge(task: BenchTask, artifact: string): Promise<BenchScore> {
|
|
227
|
+
async evaluate(task: BenchTask, artifact: string): Promise<BenchEvaluation> {
|
|
263
228
|
const meta = readMeta(task)
|
|
264
229
|
const finalAnswer = parseFinalAnswer(artifact)
|
|
265
230
|
|
|
266
231
|
if (finalAnswer.length === 0) {
|
|
267
232
|
// Fail-closed: distinguish prompt-adherence failure from a wrong answer.
|
|
233
|
+
const raw = {
|
|
234
|
+
reason: 'no parseable answer',
|
|
235
|
+
em: false,
|
|
236
|
+
f1: 0,
|
|
237
|
+
normalizedGold: normalizeHotpotAnswer(meta.gold),
|
|
238
|
+
}
|
|
268
239
|
return {
|
|
269
|
-
|
|
240
|
+
passed: false,
|
|
270
241
|
score: 0,
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
em: false,
|
|
274
|
-
f1: 0,
|
|
275
|
-
normalizedGold: normalizeHotpotAnswer(meta.gold),
|
|
276
|
-
}),
|
|
242
|
+
notes: JSON.stringify(raw),
|
|
243
|
+
raw,
|
|
277
244
|
}
|
|
278
245
|
}
|
|
279
246
|
|
|
@@ -281,20 +248,58 @@ print(json.dumps(out))
|
|
|
281
248
|
const f1 = hotpotTokenF1(finalAnswer, meta.gold)
|
|
282
249
|
const threshold = f1PassThreshold()
|
|
283
250
|
const resolved = em || f1 >= threshold
|
|
251
|
+
const raw = {
|
|
252
|
+
em,
|
|
253
|
+
f1,
|
|
254
|
+
threshold,
|
|
255
|
+
normalizedAnswer: normalizeHotpotAnswer(finalAnswer),
|
|
256
|
+
normalizedGold: normalizeHotpotAnswer(meta.gold),
|
|
257
|
+
type: meta.type,
|
|
258
|
+
level: meta.level,
|
|
259
|
+
supportingFacts: meta.supportingFacts,
|
|
260
|
+
}
|
|
284
261
|
return {
|
|
285
|
-
resolved,
|
|
262
|
+
passed: resolved,
|
|
286
263
|
score: f1,
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
f1,
|
|
290
|
-
threshold,
|
|
291
|
-
normalizedAnswer: normalizeHotpotAnswer(finalAnswer),
|
|
292
|
-
normalizedGold: normalizeHotpotAnswer(meta.gold),
|
|
293
|
-
type: meta.type,
|
|
294
|
-
level: meta.level,
|
|
295
|
-
supportingFacts: meta.supportingFacts,
|
|
296
|
-
}),
|
|
264
|
+
notes: JSON.stringify(raw),
|
|
265
|
+
raw,
|
|
297
266
|
}
|
|
298
267
|
},
|
|
299
|
-
|
|
268
|
+
|
|
269
|
+
runtime: {
|
|
270
|
+
async preflight() {
|
|
271
|
+
if (fixturesMode) {
|
|
272
|
+
await readFile(FIXTURES, 'utf8').catch((err) => {
|
|
273
|
+
throw new Error(
|
|
274
|
+
`HOTPOTQA_FIXTURES=1 but ${FIXTURES} unreadable: ${err instanceof Error ? err.message : err}`,
|
|
275
|
+
)
|
|
276
|
+
})
|
|
277
|
+
return
|
|
278
|
+
}
|
|
279
|
+
try {
|
|
280
|
+
await py(
|
|
281
|
+
`from datasets import load_dataset
|
|
282
|
+
load_dataset(${JSON.stringify(DATASET)}, ${JSON.stringify(DATASET_CONFIG)}, split=${JSON.stringify(DATASET_SPLIT)})
|
|
283
|
+
print('ok')`,
|
|
284
|
+
)
|
|
285
|
+
} catch (err) {
|
|
286
|
+
const msg = err instanceof Error ? err.message : String(err)
|
|
287
|
+
throw new Error(
|
|
288
|
+
`hotpotqa preflight failed: ${msg}\n` +
|
|
289
|
+
`Fix: (1) python3 -m venv bench/.venv && bench/.venv/bin/pip install datasets ; ` +
|
|
290
|
+
`(2) ensure network access to Hugging Face for ${DATASET} (${DATASET_CONFIG}) ; ` +
|
|
291
|
+
`or set HOTPOTQA_FIXTURES=1 to run against the committed fixtures offline.`,
|
|
292
|
+
)
|
|
293
|
+
}
|
|
294
|
+
},
|
|
295
|
+
|
|
296
|
+
async goldArtifact(task: BenchTask) {
|
|
297
|
+
// Gold artifact = the worker-contract serialization of the gold answer, so
|
|
298
|
+
// verify-judge proves gold→passed through the SAME parse path the real
|
|
299
|
+
// artifact takes.
|
|
300
|
+
const meta = readMeta(task)
|
|
301
|
+
return `${FINAL_ANSWER_SENTINEL} ${meta.gold}`
|
|
302
|
+
},
|
|
303
|
+
},
|
|
304
|
+
})
|
|
300
305
|
}
|
|
@@ -21,7 +21,7 @@ import { chmodSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'nod
|
|
|
21
21
|
import { tmpdir } from 'node:os'
|
|
22
22
|
import { join } from 'node:path'
|
|
23
23
|
import { gunzipSync } from 'node:zlib'
|
|
24
|
-
import
|
|
24
|
+
import { type BenchEvaluation, type BenchTask, type LoadOptions, type RuntimeBenchmark, runtimeBenchmark } from './types'
|
|
25
25
|
|
|
26
26
|
const humanevalUrl = 'https://github.com/openai/human-eval/raw/master/data/HumanEval.jsonl.gz'
|
|
27
27
|
const dockerImage = 'python:3.12-slim'
|
|
@@ -279,7 +279,7 @@ function toBenchTask(t: HumanEvalTask): BenchTask {
|
|
|
279
279
|
entryPoint: t.entryPoint,
|
|
280
280
|
...(t.canonicalSolution ? { canonicalSolution: t.canonicalSolution } : {}),
|
|
281
281
|
}
|
|
282
|
-
return { id: t.taskId, prompt: basePrompt(t), metadata }
|
|
282
|
+
return { id: t.taskId, payload: { prompt: basePrompt(t) }, metadata }
|
|
283
283
|
}
|
|
284
284
|
|
|
285
285
|
function taskFromMeta(task: BenchTask): HumanEvalTask {
|
|
@@ -291,46 +291,48 @@ function taskFromMeta(task: BenchTask): HumanEvalTask {
|
|
|
291
291
|
}
|
|
292
292
|
|
|
293
293
|
/** The HumanEval `BenchmarkAdapter`. OFFSET (env) selects the correctable middle
|
|
294
|
-
* band;
|
|
295
|
-
export function createHumanEvalAdapter():
|
|
296
|
-
return {
|
|
297
|
-
|
|
298
|
-
async
|
|
299
|
-
// Prove the daemon and exact local image before any model call. Scoring uses
|
|
300
|
-
// --pull=never so a registry or cold pull cannot become a candidate outcome.
|
|
301
|
-
await new Promise<void>((resolve, reject) => {
|
|
302
|
-
execFile('docker', ['version', '--format', '{{.Server.Version}}'], (err) => {
|
|
303
|
-
if (err) reject(new Error('HumanEval judge needs a running Docker daemon (python:3.12-slim, --network=none)'))
|
|
304
|
-
else resolve()
|
|
305
|
-
})
|
|
306
|
-
})
|
|
307
|
-
await new Promise<void>((resolve, reject) => {
|
|
308
|
-
execFile('docker', ['image', 'inspect', dockerImage], (err) => {
|
|
309
|
-
if (err) reject(new Error(`HumanEval judge needs the cached Docker image ${dockerImage}`))
|
|
310
|
-
else resolve()
|
|
311
|
-
})
|
|
312
|
-
})
|
|
313
|
-
},
|
|
314
|
-
async loadTasks(opts?: LoadOptions) {
|
|
294
|
+
* band; loadAll honors `limit`/`ids`. The judge is the Docker deployable checker. */
|
|
295
|
+
export function createHumanEvalAdapter(): RuntimeBenchmark {
|
|
296
|
+
return runtimeBenchmark({
|
|
297
|
+
id: 'humaneval',
|
|
298
|
+
async loadAll(opts?: LoadOptions) {
|
|
315
299
|
const offset = Number(process.env.OFFSET ?? 0)
|
|
316
300
|
// Pull a generous window when filtering by id, else exactly `limit` from offset.
|
|
317
301
|
const all = await loadHumanEval(opts?.ids ? 164 : (opts?.limit ?? 8), offset)
|
|
318
302
|
const picked = opts?.ids ? all.filter((t) => opts.ids?.includes(t.taskId)) : all
|
|
319
303
|
return picked.map(toBenchTask)
|
|
320
304
|
},
|
|
321
|
-
async
|
|
305
|
+
async evaluate(task: BenchTask, artifact: string): Promise<BenchEvaluation> {
|
|
322
306
|
const { pass } = await runChecker(taskFromMeta(task), extractCode(artifact))
|
|
323
|
-
return {
|
|
307
|
+
return { passed: pass === 1, score: pass, notes: pass === 1 ? 'tests passed' : 'tests failed', raw: {} }
|
|
324
308
|
},
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
309
|
+
runtime: {
|
|
310
|
+
async preflight() {
|
|
311
|
+
// Prove the daemon and exact local image before any model call. Scoring uses
|
|
312
|
+
// --pull=never so a registry or cold pull cannot become a candidate outcome.
|
|
313
|
+
await new Promise<void>((resolve, reject) => {
|
|
314
|
+
execFile('docker', ['version', '--format', '{{.Server.Version}}'], (err) => {
|
|
315
|
+
if (err) reject(new Error('HumanEval judge needs a running Docker daemon (python:3.12-slim, --network=none)'))
|
|
316
|
+
else resolve()
|
|
317
|
+
})
|
|
318
|
+
})
|
|
319
|
+
await new Promise<void>((resolve, reject) => {
|
|
320
|
+
execFile('docker', ['image', 'inspect', dockerImage], (err) => {
|
|
321
|
+
if (err) reject(new Error(`HumanEval judge needs the cached Docker image ${dockerImage}`))
|
|
322
|
+
else resolve()
|
|
323
|
+
})
|
|
324
|
+
})
|
|
325
|
+
},
|
|
326
|
+
async goldArtifact(task: BenchTask) {
|
|
327
|
+
const m = task.metadata as HumanEvalMeta | undefined
|
|
328
|
+
const sol = m?.canonicalSolution
|
|
329
|
+
// Return the COMPLETE function (signature header + canonical body), i.e. what a
|
|
330
|
+
// real worker emits — NOT the body alone. The judge runs `extractCode`, whose
|
|
331
|
+
// unfenced fallback is `reply.trim()`; trimming a body-only string strips its
|
|
332
|
+
// leading indent and breaks it, so a body-only gold fails its own judge. A full
|
|
333
|
+
// def starts at column 0, trims safely, and self-verifies.
|
|
334
|
+
return sol ? `${m!.promptHeader}${sol}` : undefined
|
|
335
|
+
},
|
|
334
336
|
},
|
|
335
|
-
}
|
|
337
|
+
})
|
|
336
338
|
}
|
|
@@ -287,21 +287,21 @@ describe('artifact handling', () => {
|
|
|
287
287
|
|
|
288
288
|
it('loads tasks with spec/source/calibrated metadata and no openscad', async () => {
|
|
289
289
|
const a = createMcadBenchAdapter()
|
|
290
|
-
const tasks = await a.
|
|
290
|
+
const tasks = await a.loadAll()
|
|
291
291
|
expect(tasks).toHaveLength(MCAD_TASKS.length)
|
|
292
292
|
for (const t of tasks) {
|
|
293
293
|
const md = t.metadata as { spec: unknown; source: string; calibrated: boolean }
|
|
294
294
|
expect(md.spec).toBeTruthy()
|
|
295
295
|
expect(typeof md.source).toBe('string')
|
|
296
296
|
expect(typeof md.calibrated).toBe('boolean')
|
|
297
|
-
expect(typeof (await a.goldArtifact(t))).toBe('string')
|
|
297
|
+
expect(typeof (await a.runtime.goldArtifact?.(t))).toBe('string')
|
|
298
298
|
}
|
|
299
299
|
})
|
|
300
300
|
|
|
301
301
|
it('honours ids and limit', async () => {
|
|
302
302
|
const a = createMcadBenchAdapter()
|
|
303
|
-
expect((await a.
|
|
304
|
-
expect(await a.
|
|
303
|
+
expect((await a.loadAll({ ids: ['l-bracket'] })).map((t) => t.id)).toEqual(['l-bracket'])
|
|
304
|
+
expect(await a.loadAll({ limit: 3 })).toHaveLength(3)
|
|
305
305
|
})
|
|
306
306
|
|
|
307
307
|
it('task 10 asks for separate bodies, never "one fused solid"', () => {
|
|
@@ -317,11 +317,11 @@ describe('artifact handling', () => {
|
|
|
317
317
|
|
|
318
318
|
it('scores an empty artifact 0 without touching openscad', async () => {
|
|
319
319
|
const a = createMcadBenchAdapter()
|
|
320
|
-
const [t] = await a.
|
|
321
|
-
const s = await a.
|
|
322
|
-
expect(s.
|
|
320
|
+
const [t] = await a.loadAll({ ids: ['calibration-block'] })
|
|
321
|
+
const s = await a.evaluate(t!, ' ')
|
|
322
|
+
expect(s.passed).toBe(false)
|
|
323
323
|
expect(s.score).toBe(0)
|
|
324
|
-
expect(s.
|
|
324
|
+
expect(s.notes).toBe('empty artifact')
|
|
325
325
|
})
|
|
326
326
|
})
|
|
327
327
|
|
|
@@ -361,7 +361,7 @@ const BLOCK_SCALED_90 = `module gold() {\n${MCAD_GOLDS['calibration-block']}\n}\
|
|
|
361
361
|
|
|
362
362
|
describe.skipIf(!OPENSCAD)('mcad judge, live openscad', () => {
|
|
363
363
|
it('preflight passes when the toolchain is present', async () => {
|
|
364
|
-
await expect(createMcadBenchAdapter().preflight()).resolves.toBeUndefined()
|
|
364
|
+
await expect(createMcadBenchAdapter().runtime.preflight!()).resolves.toBeUndefined()
|
|
365
365
|
})
|
|
366
366
|
|
|
367
367
|
for (const task of MCAD_TASKS.filter((t) => t.calibrated)) {
|
|
@@ -369,14 +369,14 @@ describe.skipIf(!OPENSCAD)('mcad judge, live openscad', () => {
|
|
|
369
369
|
`gold for ${task.id} resolves at score 1.0`,
|
|
370
370
|
async () => {
|
|
371
371
|
const a = createMcadBenchAdapter()
|
|
372
|
-
const [t] = await a.
|
|
373
|
-
const gold = await a.goldArtifact(t!)
|
|
372
|
+
const [t] = await a.loadAll({ ids: [task.id] })
|
|
373
|
+
const gold = await a.runtime.goldArtifact?.(t!)
|
|
374
374
|
expect(typeof gold).toBe('string')
|
|
375
|
-
const s = await a.
|
|
376
|
-
const failed = JSON.parse(s.
|
|
375
|
+
const s = await a.evaluate(t!, gold as string)
|
|
376
|
+
const failed = JSON.parse(s.notes ?? '{}').failed ?? []
|
|
377
377
|
expect(failed, `failed checks: ${JSON.stringify(failed)}`).toEqual([])
|
|
378
378
|
expect(s.score).toBe(1)
|
|
379
|
-
expect(s.
|
|
379
|
+
expect(s.passed).toBe(true)
|
|
380
380
|
},
|
|
381
381
|
JUDGE_TIMEOUT,
|
|
382
382
|
)
|
|
@@ -386,11 +386,11 @@ describe.skipIf(!OPENSCAD)('mcad judge, live openscad', () => {
|
|
|
386
386
|
'MUST REJECT: the calibration block with its four holes removed fails the bore probes',
|
|
387
387
|
async () => {
|
|
388
388
|
const a = createMcadBenchAdapter()
|
|
389
|
-
const [t] = await a.
|
|
390
|
-
const s = await a.
|
|
391
|
-
expect(s.
|
|
389
|
+
const [t] = await a.loadAll({ ids: ['calibration-block'] })
|
|
390
|
+
const s = await a.evaluate(t!, BLOCK_WITHOUT_HOLES)
|
|
391
|
+
expect(s.passed).toBe(false)
|
|
392
392
|
expect(s.score).toBeLessThan(1)
|
|
393
|
-
const failed = (JSON.parse(s.
|
|
393
|
+
const failed = (JSON.parse(s.notes as string).failed as Array<{ name: string; measured: string }>).map(
|
|
394
394
|
(f) => f.name,
|
|
395
395
|
)
|
|
396
396
|
// all five "must be outside" probes now sit in solid material
|
|
@@ -408,10 +408,10 @@ describe.skipIf(!OPENSCAD)('mcad judge, live openscad', () => {
|
|
|
408
408
|
'MUST REJECT: the calibration block scaled to 90 x 54 x 18 fails every bbox axis',
|
|
409
409
|
async () => {
|
|
410
410
|
const a = createMcadBenchAdapter()
|
|
411
|
-
const [t] = await a.
|
|
412
|
-
const s = await a.
|
|
413
|
-
expect(s.
|
|
414
|
-
const detail = JSON.parse(s.
|
|
411
|
+
const [t] = await a.loadAll({ ids: ['calibration-block'] })
|
|
412
|
+
const s = await a.evaluate(t!, BLOCK_SCALED_90)
|
|
413
|
+
expect(s.passed).toBe(false)
|
|
414
|
+
const detail = JSON.parse(s.notes as string) as {
|
|
415
415
|
failed: Array<{ name: string; measured: string; expected: string }>
|
|
416
416
|
geo: { bbox: { x: number; y: number; z: number } }
|
|
417
417
|
}
|
|
@@ -431,11 +431,11 @@ describe.skipIf(!OPENSCAD)('mcad judge, live openscad', () => {
|
|
|
431
431
|
'MUST REJECT: a non-watertight surface is scored 0 by the hard gate',
|
|
432
432
|
async () => {
|
|
433
433
|
const a = createMcadBenchAdapter()
|
|
434
|
-
const [t] = await a.
|
|
435
|
-
const s = await a.
|
|
436
|
-
expect(s.
|
|
434
|
+
const [t] = await a.loadAll({ ids: ['calibration-block'] })
|
|
435
|
+
const s = await a.evaluate(t!, 'polyhedron(points=[[0,0,0],[10,0,0],[0,10,0]], faces=[[0,1,2]]);')
|
|
436
|
+
expect(s.passed).toBe(false)
|
|
437
437
|
expect(s.score).toBe(0)
|
|
438
|
-
expect(JSON.parse(s.
|
|
438
|
+
expect(JSON.parse(s.notes as string).gate).toBe('watertight')
|
|
439
439
|
},
|
|
440
440
|
JUDGE_TIMEOUT,
|
|
441
441
|
)
|
|
@@ -444,11 +444,11 @@ describe.skipIf(!OPENSCAD)('mcad judge, live openscad', () => {
|
|
|
444
444
|
'MUST REJECT: source that does not compile is scored 0',
|
|
445
445
|
async () => {
|
|
446
446
|
const a = createMcadBenchAdapter()
|
|
447
|
-
const [t] = await a.
|
|
448
|
-
const s = await a.
|
|
449
|
-
expect(s.
|
|
447
|
+
const [t] = await a.loadAll({ ids: ['calibration-block'] })
|
|
448
|
+
const s = await a.evaluate(t!, 'this is not openscad {{{')
|
|
449
|
+
expect(s.passed).toBe(false)
|
|
450
450
|
expect(s.score).toBe(0)
|
|
451
|
-
expect(s.
|
|
451
|
+
expect(s.notes).toMatch(/compile failed/)
|
|
452
452
|
},
|
|
453
453
|
JUDGE_TIMEOUT,
|
|
454
454
|
)
|