@tangle-network/agent-bench 0.14.2 → 1.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 +48 -0
- package/README.md +2 -3
- package/dist/adapters.d.ts +2 -5
- package/dist/adapters.js +3 -4
- package/dist/benchmarks/_harness.d.ts +17 -20
- package/dist/benchmarks/_harness.js +4 -4
- package/dist/benchmarks/_harness.js.map +1 -1
- package/dist/benchmarks/aec-bench.d.ts +1 -4
- package/dist/benchmarks/aec-bench.js +1 -2
- package/dist/benchmarks/agentbench.d.ts +2 -5
- package/dist/benchmarks/agentbench.js +1 -2
- package/dist/benchmarks/appworld.d.ts +8 -10
- package/dist/benchmarks/appworld.js +23 -23
- package/dist/benchmarks/appworld.js.map +1 -1
- package/dist/benchmarks/bfcl.d.ts +2 -5
- package/dist/benchmarks/bfcl.js +1 -2
- package/dist/benchmarks/cad-design.d.ts +2 -5
- package/dist/benchmarks/cad-design.js +2 -3
- package/dist/benchmarks/cad-design.js.map +1 -1
- package/dist/benchmarks/cadbench.d.ts +1 -4
- package/dist/benchmarks/cadbench.js +1 -2
- package/dist/benchmarks/cadgenbench.d.ts +1 -4
- package/dist/benchmarks/cadgenbench.js +1 -2
- package/dist/benchmarks/commit0.d.ts +2 -5
- package/dist/benchmarks/commit0.js +1 -2
- package/dist/benchmarks/crag.d.ts +1 -4
- package/dist/benchmarks/crag.js +3 -3
- package/dist/benchmarks/crag.js.map +1 -1
- package/dist/benchmarks/dabstep.d.ts +2 -5
- package/dist/benchmarks/dabstep.js +2 -3
- package/dist/benchmarks/dabstep.js.map +1 -1
- package/dist/benchmarks/enterpriseops-gym.d.ts +2 -5
- package/dist/benchmarks/enterpriseops-gym.js +1 -2
- package/dist/benchmarks/finresearchbench.d.ts +2 -5
- package/dist/benchmarks/finresearchbench.js +2 -3
- package/dist/benchmarks/finsearchcomp.d.ts +2 -5
- package/dist/benchmarks/finsearchcomp.js +4 -4
- package/dist/benchmarks/finsearchcomp.js.map +1 -1
- package/dist/benchmarks/frames.d.ts +3 -19
- package/dist/benchmarks/frames.js +13 -39
- package/dist/benchmarks/frames.js.map +1 -1
- package/dist/benchmarks/hotpotqa.d.ts +4 -14
- package/dist/benchmarks/hotpotqa.js +12 -32
- package/dist/benchmarks/hotpotqa.js.map +1 -1
- package/dist/benchmarks/humaneval.d.ts +9 -12
- package/dist/benchmarks/humaneval.js +2 -3
- package/dist/benchmarks/humaneval.js.map +1 -1
- package/dist/benchmarks/mcad-bench.d.ts +13 -16
- package/dist/benchmarks/mcad-bench.js +2 -3
- package/dist/benchmarks/mcad-bench.js.map +1 -1
- package/dist/benchmarks/mcad-cq-bench.d.ts +17 -20
- package/dist/benchmarks/mcad-cq-bench.js +2 -3
- package/dist/benchmarks/mcad-cq-bench.js.map +1 -1
- package/dist/benchmarks/mcad-cq-golds.d.ts +2 -5
- package/dist/benchmarks/mcad-cq-golds.js +1 -2
- package/dist/benchmarks/mcad-golds.d.ts +1 -4
- package/dist/benchmarks/mcad-golds.js +0 -1
- package/dist/benchmarks/mcad-tasks.d.ts +5 -8
- package/dist/benchmarks/mcad-tasks.js +7 -8
- package/dist/benchmarks/mcad-tasks.js.map +1 -1
- package/dist/benchmarks/mind2web.d.ts +3 -5
- package/dist/benchmarks/mind2web.js +2 -3
- package/dist/benchmarks/mind2web.js.map +1 -1
- package/dist/benchmarks/nomiracl.d.ts +1 -4
- package/dist/benchmarks/nomiracl.js +1 -2
- package/dist/benchmarks/open-rag-bench.d.ts +1 -4
- package/dist/benchmarks/open-rag-bench.js +3 -3
- package/dist/benchmarks/open-rag-bench.js.map +1 -1
- package/dist/benchmarks/programbench.d.ts +2 -5
- package/dist/benchmarks/programbench.js +1 -2
- package/dist/benchmarks/rag-shared.d.ts +30 -22
- package/dist/benchmarks/rag-shared.js +8 -2
- package/dist/benchmarks/rag-shared.js.map +1 -1
- package/dist/benchmarks/ragbench.d.ts +1 -4
- package/dist/benchmarks/ragbench.js +3 -3
- package/dist/benchmarks/ragbench.js.map +1 -1
- package/dist/benchmarks/simpleqa.d.ts +2 -18
- package/dist/benchmarks/simpleqa.js +5 -31
- package/dist/benchmarks/simpleqa.js.map +1 -1
- package/dist/benchmarks/swe-bench.d.ts +7 -10
- package/dist/benchmarks/swe-bench.js +4 -4
- package/dist/benchmarks/swe-bench.js.map +1 -1
- package/dist/benchmarks/t2-ragbench.d.ts +1 -4
- package/dist/benchmarks/t2-ragbench.js +3 -3
- package/dist/benchmarks/t2-ragbench.js.map +1 -1
- package/dist/benchmarks/tau-bench-shared.d.ts +5 -8
- package/dist/benchmarks/tau-bench-shared.js +4 -4
- package/dist/benchmarks/tau-bench-shared.js.map +1 -1
- package/dist/benchmarks/tau2-bench.d.ts +2 -5
- package/dist/benchmarks/tau2-bench.js +1 -2
- package/dist/benchmarks/tau3-banking.d.ts +1 -4
- package/dist/benchmarks/tau3-banking.js +1 -2
- package/dist/benchmarks/terminal-bench.d.ts +1 -4
- package/dist/benchmarks/terminal-bench.js +4 -4
- package/dist/benchmarks/terminal-bench.js.map +1 -1
- package/dist/benchmarks/toollm.d.ts +2 -5
- package/dist/benchmarks/toollm.js +1 -2
- package/dist/benchmarks/trata-hedge.d.ts +1 -4
- package/dist/benchmarks/trata-hedge.js +2 -3
- package/dist/benchmarks/types.d.ts +6 -9
- package/dist/benchmarks/webarena-verified.d.ts +2 -5
- package/dist/benchmarks/webarena-verified.js +1 -2
- package/dist/{cadbench-BRF-59Mt.js → cadbench-DhAndllg.js} +4 -6
- package/dist/cadbench-DhAndllg.js.map +1 -0
- package/dist/{cadgenbench-DXtGkuW3.js → cadgenbench-Tvk16YKT.js} +15 -5
- package/dist/cadgenbench-Tvk16YKT.js.map +1 -0
- package/dist/index.d.ts +8 -18
- package/dist/index.js +16 -24
- package/dist/index.js.map +1 -1
- package/dist/{router-turn-uTYO6KQ1.js → router-turn-DNbQ_GjQ.js} +2 -3
- package/dist/router-turn-DNbQ_GjQ.js.map +1 -0
- package/fixtures/pier-agent/no-model-task/pre_artifacts.sh +0 -0
- package/fixtures/pier-agent/no-model-task/tests/test.sh +0 -0
- package/package.json +10 -10
- package/pier_agents/tangle_candidate.py +15 -23
- package/scripts/run-package-tests.mjs +8 -15
- package/scripts/verify-packed-consumer.mjs +0 -1
- package/src/atom-mcp-e2e.mts +16 -4
- package/src/benchmarks/frames.ts +10 -44
- package/src/benchmarks/hotpotqa.ts +9 -29
- package/src/benchmarks/rag-shared.ts +12 -0
- package/src/benchmarks/simpleqa.ts +2 -36
- package/src/commit0-prereqs.sh +0 -0
- package/src/corpus-replay.mts +8 -8
- package/src/corpus-report.mts +21 -21
- package/src/corpus.test.mts +5 -5
- package/src/corpus.ts +16 -16
- package/src/directives.ts +0 -38
- package/src/examples/lean-verify.ts +1 -1
- package/src/gate.ts +8 -8
- package/src/generate-eval/certify.ts +2 -2
- package/src/index.ts +1 -0
- package/src/refine-loop.ts +5 -5
- package/src/resolve-client.ts +1 -1
- package/src/router-turn.ts +3 -11
- package/src/run-benchmarks.test.mts +0 -4
- package/src/run-pool.ts +1 -1
- package/src/runtime-hook-recorder.ts +2 -2
- package/src/search-bench/tasks.ts +1 -1
- package/src/selector.test.mts +13 -13
- package/src/selector.ts +19 -19
- package/src/swe-bench-env.ts +4 -12
- package/src/swe-jail.ts +5 -156
- package/src/swe-structural-judge-policy.ts +3 -3
- package/src/swe-structural-policy.ts +3 -3
- package/src/swe-structural-provenance.ts +4 -4
- package/src/terminal-compare.ts +10 -10
- package/src/worker-blender.ts +2 -106
- package/src/worker-build123d.ts +2 -81
- package/tb_agents/opencode_router_agent.py +1 -1
- package/dist/cadbench-BRF-59Mt.js.map +0 -1
- package/dist/cadgenbench-DXtGkuW3.js.map +0 -1
- package/dist/router-turn-uTYO6KQ1.js.map +0 -1
- package/scripts/cadbench_prepare.py +0 -22
- package/scripts/cadgenbench_hard_parts.py +0 -48
- package/scripts/clbench_codebase_judge.py +0 -73
- package/scripts/render-gate-chart.mjs +0 -176
- package/scripts/trata-hedge/README.md +0 -57
- package/scripts/trata-hedge/run.sh +0 -64
- package/src/browser/adapters/bad-design-audit.ts +0 -153
- package/src/browser/adapters/bad-design-audit.verify.ts +0 -85
- package/src/browser/adapters/bad.ts +0 -165
- package/src/browser/agent-adapter.ts +0 -145
- package/src/browser/process-adapter.ts +0 -146
- package/src/browser/run-to-spans.ts +0 -105
- package/src/browser/run-to-spans.verify.ts +0 -89
- package/src/browser/ui-reviewer.ts +0 -200
- package/src/browser/ui-reviewer.verify.ts +0 -94
- package/src/browser/verify.ts +0 -96
- package/src/clbench-codebase-gate.mts +0 -314
- package/src/clbench-context-gate.mts +0 -341
- package/src/cloud-loop.mts +0 -156
- package/src/commit0-env-run.mts +0 -62
- package/src/commit0-env.ts +0 -172
- package/src/commit0-gate.mts +0 -558
- package/src/coordination-mcp-container-reach.mts +0 -182
- package/src/egress-probe.mts +0 -26
- package/src/fleet.mts +0 -143
- package/src/hev-structural.mts +0 -697
- package/src/humaneval-gate.mts +0 -220
- package/src/humaneval-repair-gate.mts +0 -182
- package/src/mbpp-structural.mts +0 -676
- package/src/mcp-mount-probe.mts +0 -139
- package/src/profile-coordinates.ts +0 -134
- package/src/profiles.ts +0 -128
- package/src/research-gate.mts +0 -132
- package/src/research-shot.ts +0 -144
- package/src/router-executor.ts +0 -51
- package/src/run-benchmarks-report.ts +0 -66
- package/src/sandbox-run.ts +0 -108
- package/src/search-bench/bridge.ts +0 -182
- package/src/search-bench/export.mts +0 -0
- package/src/search-bench/parametric-check.mts +0 -78
- package/src/search-bench/profiles.ts +0 -113
- package/src/search-bench/run.mts +0 -286
- package/src/search-bench/tasks-fresh.ts +0 -688
- package/src/skill-sandbox-smoke.mts +0 -101
- package/src/smoke-structural-rollout.mts +0 -415
- package/src/stats.mts +0 -90
- package/src/supervisor-arena.mts +0 -825
- package/src/swe-code-improve.mts +0 -306
- package/src/swe-emit-patch.mts +0 -125
- package/src/swe-improve.mts +0 -284
- package/src/swe-local-proof.mts +0 -265
- package/src/swe-repro-calibrate.mts +0 -451
- package/src/swe-stream.mts +0 -1561
- package/src/swe-structural.mts +0 -707
- package/src/tb-container-executor.mts +0 -266
- package/src/tb-container-executor.test.mts +0 -134
- package/src/tb-supervisor-sidecar.mts +0 -208
- package/src/trajectory-assemble.mjs +0 -130
- package/src/trata-gepa.mts +0 -381
- package/src/trata-hedge-solve.mts +0 -81
- package/src/worker-browser.ts +0 -115
- package/src/worker-cad.ts +0 -470
- package/src/workspace-loop.mts +0 -133
- package/tb_agents/opencode_refine_agent.py +0 -117
- package/tb_agents/opencode_supervisor_agent.py +0 -239
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Render the gate results as clean, dependency-free SVG bar charts.
|
|
3
|
-
*
|
|
4
|
-
* One honest chart per benchmark: bars for each arm (baseline greys + the
|
|
5
|
-
* verifier-grounded method in the accent), an optional dashed oracle-ceiling line,
|
|
6
|
-
* and a single annotated delta. No chartjunk — value labels, one accent, lots of
|
|
7
|
-
* whitespace. Data is passed in (no hidden numbers) so the charts regenerate from
|
|
8
|
-
* the real run outputs.
|
|
9
|
-
*
|
|
10
|
-
* node bench/scripts/render-gate-chart.mjs # writes docs/assets/*.svg
|
|
11
|
-
* (then: cairosvg docs/assets/<f>.svg -o /tmp/<f>.png to preview)
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
import { mkdirSync, writeFileSync } from 'node:fs'
|
|
15
|
-
import { dirname, join } from 'node:path'
|
|
16
|
-
import { fileURLToPath } from 'node:url'
|
|
17
|
-
|
|
18
|
-
const here = dirname(fileURLToPath(import.meta.url))
|
|
19
|
-
const assetsDir = join(here, '..', '..', 'docs', 'assets')
|
|
20
|
-
|
|
21
|
-
const palette = {
|
|
22
|
-
bg: '#ffffff',
|
|
23
|
-
ink: '#0f172a', // slate-900 — titles, values
|
|
24
|
-
muted: '#64748b', // slate-500 — subtitles, labels
|
|
25
|
-
faint: '#e2e8f0', // slate-200 — baseline / axis
|
|
26
|
-
baseline: '#cbd5e1', // slate-300 — "blind" / weaker baselines
|
|
27
|
-
baseline2: '#94a3b8', // slate-400 — the competing selector
|
|
28
|
-
method: '#4f46e5', // indigo-600 — the verifier-grounded method (the hero)
|
|
29
|
-
methodSoft: '#eef2ff', // indigo-50 — method bar wash
|
|
30
|
-
ceiling: '#475569', // slate-600 — oracle ceiling line
|
|
31
|
-
good: '#059669', // emerald-600 — positive delta
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const esc = (s) => String(s).replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>')
|
|
35
|
-
const f = 'system-ui, -apple-system, "Segoe UI", Inter, Roboto, sans-serif'
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* @param {{
|
|
39
|
-
* title: string, subtitle: string, footnote?: string,
|
|
40
|
-
* bars: {label: string, value: number, kind: 'blind'|'rival'|'method'}[],
|
|
41
|
-
* ceiling?: {value: number, label: string},
|
|
42
|
-
* delta?: {fromIdx: number, toIdx: number, label: string},
|
|
43
|
-
* yMax?: number, unit?: string,
|
|
44
|
-
* }} cfg
|
|
45
|
-
*/
|
|
46
|
-
function chart(cfg) {
|
|
47
|
-
const W = 820
|
|
48
|
-
const H = 524
|
|
49
|
-
const m = { top: 152, right: 136, bottom: 120, left: 66 }
|
|
50
|
-
const plotW = W - m.left - m.right
|
|
51
|
-
const plotH = H - m.top - m.bottom
|
|
52
|
-
const yMax = cfg.yMax ?? 100
|
|
53
|
-
const unit = cfg.unit ?? '%'
|
|
54
|
-
const y = (v) => m.top + plotH * (1 - v / yMax)
|
|
55
|
-
|
|
56
|
-
const n = cfg.bars.length
|
|
57
|
-
const bandW = plotW / n
|
|
58
|
-
const barW = Math.min(112, bandW * 0.56)
|
|
59
|
-
const cx = (i) => m.left + bandW * (i + 0.5)
|
|
60
|
-
const fill = { blind: palette.baseline, rival: palette.baseline2, method: palette.method }
|
|
61
|
-
|
|
62
|
-
const parts = []
|
|
63
|
-
parts.push(`<svg xmlns="http://www.w3.org/2000/svg" width="${W}" height="${H}" viewBox="0 0 ${W} ${H}" font-family='${f}'>`)
|
|
64
|
-
parts.push(`<rect width="${W}" height="${H}" fill="${palette.bg}"/>`)
|
|
65
|
-
|
|
66
|
-
// title + subtitle
|
|
67
|
-
parts.push(`<text x="${m.left}" y="46" font-size="22" font-weight="700" fill="${palette.ink}">${esc(cfg.title)}</text>`)
|
|
68
|
-
parts.push(`<text x="${m.left}" y="72" font-size="13.5" fill="${palette.muted}">${esc(cfg.subtitle)}</text>`)
|
|
69
|
-
|
|
70
|
-
// baseline axis
|
|
71
|
-
parts.push(`<line x1="${m.left}" y1="${y(0)}" x2="${m.left + plotW}" y2="${y(0)}" stroke="${palette.faint}" stroke-width="1.5"/>`)
|
|
72
|
-
// light gridlines at 25/50/75/100
|
|
73
|
-
for (const g of [25, 50, 75, 100]) {
|
|
74
|
-
if (g > yMax) continue
|
|
75
|
-
parts.push(`<line x1="${m.left}" y1="${y(g)}" x2="${m.left + plotW}" y2="${y(g)}" stroke="${palette.faint}" stroke-width="1" stroke-dasharray="2 5"/>`)
|
|
76
|
-
parts.push(`<text x="${m.left - 12}" y="${y(g) + 4}" font-size="11" text-anchor="end" fill="${palette.muted}">${g}${unit}</text>`)
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
// oracle ceiling line
|
|
80
|
-
if (cfg.ceiling) {
|
|
81
|
-
const yc = y(cfg.ceiling.value)
|
|
82
|
-
parts.push(`<line x1="${m.left}" y1="${yc}" x2="${m.left + plotW}" y2="${yc}" stroke="${palette.ceiling}" stroke-width="1.5" stroke-dasharray="6 4"/>`)
|
|
83
|
-
parts.push(`<text x="${m.left + plotW + 8}" y="${yc - 5}" font-size="12" font-weight="600" fill="${palette.ceiling}">${esc(cfg.ceiling.label)}</text>`)
|
|
84
|
-
parts.push(`<text x="${m.left + plotW + 8}" y="${yc + 12}" font-size="12" fill="${palette.ceiling}">${cfg.ceiling.value}${unit}</text>`)
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
// bars
|
|
88
|
-
cfg.bars.forEach((b, i) => {
|
|
89
|
-
const x = cx(i) - barW / 2
|
|
90
|
-
const top = y(b.value)
|
|
91
|
-
const h = y(0) - top
|
|
92
|
-
const isMethod = b.kind === 'method'
|
|
93
|
-
if (isMethod) parts.push(`<rect x="${x - 3}" y="${top - 3}" width="${barW + 6}" height="${h + 3}" rx="7" fill="${palette.methodSoft}"/>`)
|
|
94
|
-
parts.push(`<rect x="${x}" y="${top}" width="${barW}" height="${h}" rx="5" fill="${fill[b.kind]}"/>`)
|
|
95
|
-
// value label
|
|
96
|
-
parts.push(`<text x="${cx(i)}" y="${top - 12}" font-size="16" font-weight="700" text-anchor="middle" fill="${isMethod ? palette.method : palette.ink}">${b.value}${unit}</text>`)
|
|
97
|
-
// x label (two lines if it contains a newline)
|
|
98
|
-
const lines = b.label.split('\n')
|
|
99
|
-
lines.forEach((ln, li) => {
|
|
100
|
-
parts.push(`<text x="${cx(i)}" y="${y(0) + 24 + li * 16}" font-size="12.5" font-weight="${isMethod ? 600 : 400}" text-anchor="middle" fill="${isMethod ? palette.method : palette.muted}">${esc(ln)}</text>`)
|
|
101
|
-
})
|
|
102
|
-
})
|
|
103
|
-
|
|
104
|
-
// delta annotation: a bracket from one bar's top to another's, labelled
|
|
105
|
-
if (cfg.delta) {
|
|
106
|
-
const a = cfg.delta.fromIdx
|
|
107
|
-
const b = cfg.delta.toIdx
|
|
108
|
-
const xa = cx(a)
|
|
109
|
-
const xb = cx(b)
|
|
110
|
-
const ya = y(cfg.bars[a].value)
|
|
111
|
-
const yb = y(cfg.bars[b].value)
|
|
112
|
-
const yBar = Math.min(ya, yb) - 34
|
|
113
|
-
const midx = (xa + xb) / 2
|
|
114
|
-
parts.push(`<line x1="${xa}" y1="${ya - 26}" x2="${xa}" y2="${yBar}" stroke="${palette.good}" stroke-width="1.25"/>`)
|
|
115
|
-
parts.push(`<line x1="${xb}" y1="${yb - 26}" x2="${xb}" y2="${yBar}" stroke="${palette.good}" stroke-width="1.25"/>`)
|
|
116
|
-
parts.push(`<line x1="${xa}" y1="${yBar}" x2="${xb}" y2="${yBar}" stroke="${palette.good}" stroke-width="1.25"/>`)
|
|
117
|
-
const lw = cfg.delta.label.length * 7.2 + 16
|
|
118
|
-
parts.push(`<rect x="${midx - lw / 2}" y="${yBar - 22}" width="${lw}" height="20" rx="10" fill="${palette.good}"/>`)
|
|
119
|
-
parts.push(`<text x="${midx}" y="${yBar - 8}" font-size="12.5" font-weight="700" text-anchor="middle" fill="#ffffff">${esc(cfg.delta.label)}</text>`)
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
if (cfg.footnote) {
|
|
123
|
-
// wrap to the plot width (~92 chars at 11.5px over the full canvas)
|
|
124
|
-
const words = cfg.footnote.split(' ')
|
|
125
|
-
const lines = []
|
|
126
|
-
let cur = ''
|
|
127
|
-
for (const w of words) {
|
|
128
|
-
if ((cur + ' ' + w).trim().length > 104) {
|
|
129
|
-
lines.push(cur.trim())
|
|
130
|
-
cur = w
|
|
131
|
-
} else cur = `${cur} ${w}`
|
|
132
|
-
}
|
|
133
|
-
if (cur.trim()) lines.push(cur.trim())
|
|
134
|
-
const startY = H - 20 - (lines.length - 1) * 15
|
|
135
|
-
lines.forEach((ln, i) => {
|
|
136
|
-
parts.push(`<text x="${m.left}" y="${startY + i * 15}" font-size="11.5" fill="${palette.muted}">${esc(ln)}</text>`)
|
|
137
|
-
})
|
|
138
|
-
}
|
|
139
|
-
parts.push('</svg>')
|
|
140
|
-
return parts.join('\n')
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
// ---- the charts (numbers are the real, verified run outputs) -------------------
|
|
144
|
-
|
|
145
|
-
const humaneval = chart({
|
|
146
|
-
title: 'Verifier-grounded selection recovers the oracle ceiling',
|
|
147
|
-
subtitle: 'HumanEval · gpt-3.5-turbo · k=4 · n=50 · paired bootstrap (B=10000) + Benjamini–Hochberg',
|
|
148
|
-
bars: [
|
|
149
|
-
{ label: 'Blind\n(1 shot)', value: 80, kind: 'blind' },
|
|
150
|
-
{ label: 'Self-consistency\n(pick the consensus)', value: 82, kind: 'rival' },
|
|
151
|
-
{ label: 'Verifier-grounded\n(re-run the tests)', value: 92, kind: 'method' },
|
|
152
|
-
],
|
|
153
|
-
ceiling: { value: 92, label: 'oracle ceiling', },
|
|
154
|
-
delta: { fromIdx: 1, toIdx: 2, label: '+10.0pp CI[+2, +18]' },
|
|
155
|
-
footnote: 'Deployable, non-oracle selector: ranks k attempts by re-running the task’s own unit tests (gold never shown). It captures the FULL ceiling (gap 0); self-consistency leaves 10pp on the table. Reproduced across two independent n=50 runs (+10pp / +12pp, both BH-positive).',
|
|
156
|
-
})
|
|
157
|
-
|
|
158
|
-
// commit0 — single-task Layer-1 VALIDATION (wcwidth, k=3). Regenerate with the powered
|
|
159
|
-
// n=10 cross-task gate when it lands. Honestly labelled as a per-task validation.
|
|
160
|
-
const commit0Validation = chart({
|
|
161
|
-
title: 'The selector signal survives real stateful coding rollouts',
|
|
162
|
-
subtitle: 'commit0 · gpt-4.1 · k=3 · single-task validation (wcwidth) — official pytest harness, graded pass-rate',
|
|
163
|
-
bars: [
|
|
164
|
-
{ label: 'Random pick\n(blind, mean-of-k)', value: 67.5, kind: 'blind' },
|
|
165
|
-
{ label: 'Verifier-grounded\n(highest test-pass)', value: 78.9, kind: 'method' },
|
|
166
|
-
],
|
|
167
|
-
ceiling: { value: 78.9, label: 'best-of-k', },
|
|
168
|
-
delta: { fromIdx: 0, toIdx: 1, label: '+11.4pp' },
|
|
169
|
-
footnote: 'Layer-1: agent clones the repo, implements, runs pytest, iterates, emits a diff. Attempts score 60.5 / 78.9 / 63.2% — within-task variance the selector exploits. Powered n=10 cross-task gate in progress.',
|
|
170
|
-
})
|
|
171
|
-
|
|
172
|
-
mkdirSync(assetsDir, { recursive: true })
|
|
173
|
-
writeFileSync(join(assetsDir, 'gate-humaneval.svg'), humaneval)
|
|
174
|
-
writeFileSync(join(assetsDir, 'gate-commit0-validation.svg'), commit0Validation)
|
|
175
|
-
console.log(`wrote ${join(assetsDir, 'gate-humaneval.svg')}`)
|
|
176
|
-
console.log(`wrote ${join(assetsDir, 'gate-commit0-validation.svg')}`)
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
# trata-hedge-bench — evaluating our system against an LLM-judge benchmark
|
|
2
|
-
|
|
3
|
-
[trata-hedge-bench](https://github.com/Trata-Inc/trata-hedge-bench) is a 102-task
|
|
4
|
-
financial-analyst benchmark (Harbor format): the agent reads a company's data corpus
|
|
5
|
-
(earnings calls, 10-K/10-Q, financials, press releases) and writes an analysis; the
|
|
6
|
-
verifier is a **Gemini-3.1-pro 3-task cascade** (hallucination-check → per-move-hit →
|
|
7
|
-
synthesis) that grades *concept match* against the expert analyst's documented moves
|
|
8
|
-
(`ground_truth.txt`). Graded `score` is 0–4 (themes fully covered); `reward.txt` is
|
|
9
|
-
sparse (1 iff all themes). No deployable ground-truth checker — it's an **oracle judge**.
|
|
10
|
-
|
|
11
|
-
## What's admissible here (and what isn't)
|
|
12
|
-
|
|
13
|
-
- **NOT** the verifier-grounded selector gate (our HumanEval/commit0 headline). The only
|
|
14
|
-
checker is the judge itself, so selecting by it = selecting by the eval metric (an
|
|
15
|
-
oracle, a Goodhart trap). See `docs/results.md`.
|
|
16
|
-
- **IS** admissible: (1) more-compute headroom (pass@k), (2) prompt optimization
|
|
17
|
-
(`improve` with agent-eval's official GEPA method, using disjoint train, selection,
|
|
18
|
-
and final-test partitions), with the honest caveat that an
|
|
19
|
-
LLM-judge can be *gamed*, so a held-out lift means "higher judge score," which without
|
|
20
|
-
ground truth we can't independently certify as "better analysis."
|
|
21
|
-
|
|
22
|
-
## Status (2026-06-06): pipeline PROVEN end-to-end
|
|
23
|
-
|
|
24
|
-
Our Runtime-backed solver → their **real** Gemini-3.1-pro judge → a genuine graded result. Every link
|
|
25
|
-
works. The naive **single-shot** baseline (DeepSeek V4 Flash, ~3 of N corpus files in one context
|
|
26
|
-
window) scores **0/4** — a floor: it hit only 1/3 moves on a few themes with
|
|
27
|
-
hallucinations flagged, because it could not explore the full corpus. The bench is built
|
|
28
|
-
for **agentic** exploration; a fair baseline needs our sandbox runtime as the solver
|
|
29
|
-
(browse + cite selectively), like the commit0 gate — pending sandbox-gateway health.
|
|
30
|
-
|
|
31
|
-
## Run it
|
|
32
|
-
|
|
33
|
-
```bash
|
|
34
|
-
# clone the bench once (102 envs, ~580MB; or sparse-checkout one env)
|
|
35
|
-
git clone https://github.com/Trata-Inc/trata-hedge-bench /tmp/thb
|
|
36
|
-
|
|
37
|
-
dotenvx run -f ~/company/devops/secrets/.env.keys -f ~/company/devops/secrets/agent-state.env -- \
|
|
38
|
-
bash bench/scripts/trata-hedge/run.sh /tmp/thb/environments/<env-name> deepseek-v4-flash
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
## Gotchas (each cost a debugging cycle)
|
|
42
|
-
|
|
43
|
-
- **Use `GOOGLE_AI_KEY`, not `GEMINI_API_KEY`** — the latter in the secrets is
|
|
44
|
-
`API_KEY_INVALID`; `GOOGLE_AI_KEY` is the working Gemini key (`gemini-3.1-pro-preview`
|
|
45
|
-
returns 200). `run.sh` maps `GOOGLE_API_KEY=$GOOGLE_AI_KEY` for `grade.py`.
|
|
46
|
-
- The router is behind Cloudflare bot-fight: a default urllib User-Agent → 403 (CF 1010)
|
|
47
|
-
on large bodies; the solver sends a browser UA.
|
|
48
|
-
- `grade.py` hardcodes `/app/answer.txt` (only that path); `/app` is sudo-writable.
|
|
49
|
-
`DATA_DIR` / `GROUND_TRUTH_PATH` / `REWARD_PATH` / `DETAILS_PATH` are env-overridable, so
|
|
50
|
-
the grader runs **unmodified** (faithful).
|
|
51
|
-
|
|
52
|
-
## Next steps
|
|
53
|
-
|
|
54
|
-
1. Agentic solver: our sandbox runtime browses the corpus + cites (fair baseline).
|
|
55
|
-
2. Prompt optimization: run `bench/src/trata-gepa.mts` across all 102 tasks with
|
|
56
|
-
explicit train, selection, and final-test partitions, and state the judge-gaming
|
|
57
|
-
caveat with every result.
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
# Evaluate our system against trata-hedge-bench's OWN Gemini-3.1-pro judge.
|
|
3
|
-
#
|
|
4
|
-
# Pipeline: our solver writes a cited analysis -> their grade.py (unmodified, a
|
|
5
|
-
# 3-task Gemini cascade: hallucination-check -> per-move-hit -> synthesis) scores it
|
|
6
|
-
# against the expert analyst's documented moves (ground_truth.txt).
|
|
7
|
-
#
|
|
8
|
-
# Prereqs (all present in this environment):
|
|
9
|
-
# - GOOGLE_AI_KEY — a VALID Gemini key (NOTE: GEMINI_API_KEY in the secrets is
|
|
10
|
-
# API_KEY_INVALID; GOOGLE_AI_KEY is the working one).
|
|
11
|
-
# - TANGLE_API_KEY — our router (the solver).
|
|
12
|
-
# - uv + Docker. /app is sudo-writable (grade.py hardcodes /app/answer.txt).
|
|
13
|
-
#
|
|
14
|
-
# Usage (wrap in dotenvx so the keys resolve):
|
|
15
|
-
# dotenvx run -f ~/company/devops/secrets/.env.keys -f ~/company/devops/secrets/agent-state.env -- \
|
|
16
|
-
# bash bench/scripts/trata-hedge/run.sh <path-to-trata-env-dir> [WORKER_MODEL]
|
|
17
|
-
set -euo pipefail
|
|
18
|
-
|
|
19
|
-
ENV="${1:?usage: run.sh <trata-env-dir> [model]}"
|
|
20
|
-
MODEL="${2:-${WORKER_MODEL:-}}"
|
|
21
|
-
if [[ -z "$MODEL" ]]; then
|
|
22
|
-
echo "WORKER_MODEL is required (or pass it as argument 2)" >&2
|
|
23
|
-
exit 2
|
|
24
|
-
fi
|
|
25
|
-
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
26
|
-
ANS=/tmp/thb-answer.txt
|
|
27
|
-
REWARD=/tmp/thb-reward.txt
|
|
28
|
-
DETAILS=/tmp/thb-details.json
|
|
29
|
-
|
|
30
|
-
echo "[trata] solve: $ENV (model=$MODEL)"
|
|
31
|
-
WORKER_MODEL="$MODEL" pnpm --dir "$HERE/../../.." exec tsx "$HERE/../../src/trata-hedge-solve.mts" "$ENV" "$ANS"
|
|
32
|
-
|
|
33
|
-
sudo -n mkdir -p /app && sudo -n cp "$ANS" /app/answer.txt && sudo -n chmod 644 /app/answer.txt
|
|
34
|
-
|
|
35
|
-
echo "[trata] grade: their grade.py (gemini-3.1-pro)"
|
|
36
|
-
GRADE_LOG=/tmp/thb-grade.log
|
|
37
|
-
# Fail loud: capture the grader's output; if it errors (bad key, import, network) or
|
|
38
|
-
# writes no details, surface ITS error rather than crashing the reporter cryptically.
|
|
39
|
-
set +e
|
|
40
|
-
( cd "$ENV/tests" && \
|
|
41
|
-
GOOGLE_API_KEY="$GOOGLE_AI_KEY" \
|
|
42
|
-
DATA_DIR="$ENV/environment/data" \
|
|
43
|
-
GROUND_TRUTH_PATH="$ENV/tests/ground_truth.txt" \
|
|
44
|
-
REWARD_PATH="$REWARD" DETAILS_PATH="$DETAILS" \
|
|
45
|
-
uvx --with google-genai python3 grade.py ) >"$GRADE_LOG" 2>&1
|
|
46
|
-
grade_status=$?
|
|
47
|
-
set -e
|
|
48
|
-
if [ "$grade_status" -ne 0 ] || [ ! -f "$DETAILS" ]; then
|
|
49
|
-
echo "[trata] grade.py FAILED (exit $grade_status) — last output:" >&2
|
|
50
|
-
tail -n 15 "$GRADE_LOG" >&2
|
|
51
|
-
exit 1
|
|
52
|
-
fi
|
|
53
|
-
|
|
54
|
-
python3 - "$DETAILS" "$REWARD" <<'PY'
|
|
55
|
-
import json, sys
|
|
56
|
-
d = json.load(open(sys.argv[1]))
|
|
57
|
-
reward = open(sys.argv[2]).read().strip() if __import__("os").path.exists(sys.argv[2]) else "?"
|
|
58
|
-
print(f" sparse reward (1 iff all themes): {reward}")
|
|
59
|
-
print(f" graded score (0-4): {d.get('score')} | themes_covered: {d.get('themes_covered')}/{d.get('num_themes')} | hallucinations: {d.get('hallucinations_detected')}")
|
|
60
|
-
for t in d.get("themes_hit", []):
|
|
61
|
-
print(f" HIT : {t.get('label')}")
|
|
62
|
-
for t in d.get("themes_missed", []):
|
|
63
|
-
print(f" MISS: {t.get('label')} ({len(t.get('moves_hit',[]))}/{t.get('n_moves')} moves)")
|
|
64
|
-
PY
|
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* UiReviewerAdapter for browser-agent-driver's `bad design-audit --json` — the
|
|
3
|
-
* reviewer that carries the DETERMINISTIC floor (axe a11y + WCAG contrast) the
|
|
4
|
-
* panel verdict is derived from. One of N pluggable reviewers behind the neutral
|
|
5
|
-
* UiReviewerAdapter contract; its subjective LLM findings are surfaced, its
|
|
6
|
-
* MEASURED floor is what `judgeUiFloor` attests.
|
|
7
|
-
*
|
|
8
|
-
* `badDesignAuditToReviewRuns` is a pure, unit-testable mapper kept separate from
|
|
9
|
-
* the spawn so the report-shape mapping is exercised without a browser/LLM.
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
import { spawn } from 'node:child_process'
|
|
13
|
-
import { mkdtemp, readFile, rm } from 'node:fs/promises'
|
|
14
|
-
import { tmpdir } from 'node:os'
|
|
15
|
-
import { join } from 'node:path'
|
|
16
|
-
import type {
|
|
17
|
-
DesignMeasurements,
|
|
18
|
-
UiFinding,
|
|
19
|
-
UiReviewRun,
|
|
20
|
-
UiReviewTarget,
|
|
21
|
-
UiReviewerAdapter,
|
|
22
|
-
} from '../ui-reviewer'
|
|
23
|
-
|
|
24
|
-
export interface BadDesignAuditConfig {
|
|
25
|
-
/** Path to the bad CLI entry (default: $BAD_CLI or ~/code/browser-agent-driver/dist/cli.js). */
|
|
26
|
-
badCli?: string
|
|
27
|
-
/** Design-audit profile (saas/defi/…); forwarded as --profile when set. */
|
|
28
|
-
profile?: string
|
|
29
|
-
model?: string
|
|
30
|
-
/** OpenAI-compatible endpoint — point at our router. */
|
|
31
|
-
baseUrl?: string
|
|
32
|
-
apiKey?: string
|
|
33
|
-
/** Pages to crawl from the start URL (bad --pages). */
|
|
34
|
-
pages?: number
|
|
35
|
-
timeoutMs?: number
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
interface BadFinding {
|
|
39
|
-
category?: string
|
|
40
|
-
severity?: 'critical' | 'major' | 'minor'
|
|
41
|
-
title?: string
|
|
42
|
-
description?: string
|
|
43
|
-
recommendation?: string
|
|
44
|
-
selector?: string
|
|
45
|
-
}
|
|
46
|
-
interface BadMeasurements {
|
|
47
|
-
contrast?: { aaFailures?: unknown[]; totalChecked?: number; summary?: { aaPassRate?: number } }
|
|
48
|
-
a11y?: { violations?: Array<{ id?: string; impact?: string }> }
|
|
49
|
-
}
|
|
50
|
-
interface BadPage {
|
|
51
|
-
route?: string
|
|
52
|
-
url?: string
|
|
53
|
-
findings?: BadFinding[]
|
|
54
|
-
measurements?: BadMeasurements
|
|
55
|
-
score?: number
|
|
56
|
-
healthScore?: number
|
|
57
|
-
}
|
|
58
|
-
/** Wire shape of `bad design-audit --json` (the report.json the CLI writes). */
|
|
59
|
-
export interface BadDesignReport {
|
|
60
|
-
pages?: BadPage[]
|
|
61
|
-
summary?: { healthScore?: number; avgScore?: number }
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/** Pure mapper: `bad design-audit --json` report → neutral UiReviewRun[] (one per
|
|
65
|
-
* page). The measured floor (axe + contrast) becomes DesignMeasurements; the LLM
|
|
66
|
-
* findings become UiFinding[]; healthScore is recorded as selfReportedScore only. */
|
|
67
|
-
export function badDesignAuditToReviewRuns(report: BadDesignReport): UiReviewRun[] {
|
|
68
|
-
const pages = report.pages ?? []
|
|
69
|
-
return pages.map((p, i) => {
|
|
70
|
-
const route = p.route ?? p.url ?? `page-${i}`
|
|
71
|
-
const findings: UiFinding[] = (p.findings ?? []).map((f) => ({
|
|
72
|
-
reviewerId: 'bad-design-audit',
|
|
73
|
-
lens: f.category ?? 'design',
|
|
74
|
-
severity: f.severity ?? 'minor',
|
|
75
|
-
route,
|
|
76
|
-
title: f.title ?? '(finding)',
|
|
77
|
-
observation: f.description ?? f.title ?? '',
|
|
78
|
-
suggestedFix: f.recommendation,
|
|
79
|
-
selector: f.selector,
|
|
80
|
-
}))
|
|
81
|
-
const m = p.measurements
|
|
82
|
-
let measurements: DesignMeasurements | undefined
|
|
83
|
-
if (m?.contrast || m?.a11y) {
|
|
84
|
-
const failures = m.contrast?.aaFailures?.length ?? 0
|
|
85
|
-
const total = m.contrast?.totalChecked ?? 0
|
|
86
|
-
measurements = {
|
|
87
|
-
a11yViolations: (m.a11y?.violations ?? []).map((v) => ({ id: v.id ?? 'unknown', impact: v.impact })),
|
|
88
|
-
contrastAaPassRate: m.contrast?.summary?.aaPassRate ?? (total > 0 ? 1 - failures / total : 1),
|
|
89
|
-
contrastAaFailures: failures,
|
|
90
|
-
contrastTotalChecked: total,
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
return {
|
|
94
|
-
reviewerId: 'bad-design-audit',
|
|
95
|
-
route,
|
|
96
|
-
findings,
|
|
97
|
-
measurements,
|
|
98
|
-
selfReportedScore: p.healthScore ?? p.score,
|
|
99
|
-
}
|
|
100
|
-
})
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
function resolveCli(cfg: BadDesignAuditConfig): string {
|
|
104
|
-
return cfg.badCli ?? process.env.BAD_CLI ?? join(process.env.HOME ?? '', 'code/browser-agent-driver/dist/cli.js')
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
/** A UiReviewerAdapter backed by `bad design-audit`. Drives a real browser audit
|
|
108
|
-
* (LLM findings + measured axe/contrast floor); the panel judge attests the floor. */
|
|
109
|
-
export function badDesignAuditReviewer(cfg: BadDesignAuditConfig = {}): UiReviewerAdapter {
|
|
110
|
-
const cli = resolveCli(cfg)
|
|
111
|
-
const timeoutMs = cfg.timeoutMs ?? 600_000
|
|
112
|
-
return {
|
|
113
|
-
id: 'bad-design-audit',
|
|
114
|
-
async review(target: UiReviewTarget): Promise<UiReviewRun[]> {
|
|
115
|
-
const dir = await mkdtemp(join(tmpdir(), 'bad-design-'))
|
|
116
|
-
const args = [cli, 'design-audit', '--url', target.url, '--json', '--output', dir]
|
|
117
|
-
if (cfg.profile) args.push('--profile', cfg.profile)
|
|
118
|
-
if (cfg.pages) args.push('--pages', String(cfg.pages))
|
|
119
|
-
if (cfg.model) args.push('--model', cfg.model)
|
|
120
|
-
if (cfg.baseUrl) args.push('--base-url', cfg.baseUrl)
|
|
121
|
-
if (cfg.apiKey) args.push('--api-key', cfg.apiKey)
|
|
122
|
-
if (target.storageState) args.push('--storage-state', target.storageState)
|
|
123
|
-
try {
|
|
124
|
-
await runChild('node', args, dir, timeoutMs)
|
|
125
|
-
const report = JSON.parse(await readFile(join(dir, 'report.json'), 'utf8')) as BadDesignReport
|
|
126
|
-
return badDesignAuditToReviewRuns(report)
|
|
127
|
-
} finally {
|
|
128
|
-
await rm(dir, { recursive: true, force: true }).catch(() => {})
|
|
129
|
-
}
|
|
130
|
-
},
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
function runChild(cmd: string, args: string[], cwd: string, timeoutMs: number): Promise<void> {
|
|
135
|
-
return new Promise((resolve, reject) => {
|
|
136
|
-
const child = spawn(cmd, args, { cwd, stdio: ['ignore', 'pipe', 'pipe'] })
|
|
137
|
-
let err = ''
|
|
138
|
-
const timer = setTimeout(() => {
|
|
139
|
-
child.kill('SIGKILL')
|
|
140
|
-
reject(new Error(`bad design-audit timed out after ${timeoutMs}ms`))
|
|
141
|
-
}, timeoutMs)
|
|
142
|
-
child.stderr.on('data', (d) => (err += d.toString()))
|
|
143
|
-
child.on('error', (e) => {
|
|
144
|
-
clearTimeout(timer)
|
|
145
|
-
reject(new Error(`bad design-audit failed to spawn: ${e.message}`))
|
|
146
|
-
})
|
|
147
|
-
child.on('close', (code) => {
|
|
148
|
-
clearTimeout(timer)
|
|
149
|
-
if (code !== 0) reject(new Error(`bad design-audit exited ${code}: ${err.slice(-300)}`))
|
|
150
|
-
else resolve()
|
|
151
|
-
})
|
|
152
|
-
})
|
|
153
|
-
}
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Deterministic self-check for the bad-design-audit reviewer mapper —
|
|
3
|
-
* `tsx src/browser/adapters/bad-design-audit.verify.ts`.
|
|
4
|
-
*
|
|
5
|
-
* Proves the `bad design-audit --json` report maps to the neutral UiReviewRun with
|
|
6
|
-
* the DETERMINISTIC floor intact, and that the panel verdict is then driven by that
|
|
7
|
-
* measured floor — not the audit's self-reported healthScore.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import { judgeUiFloor } from '../ui-reviewer'
|
|
11
|
-
import { badDesignAuditToReviewRuns, type BadDesignReport } from './bad-design-audit'
|
|
12
|
-
|
|
13
|
-
let failures = 0
|
|
14
|
-
function check(name: string, cond: boolean, detail = '') {
|
|
15
|
-
if (cond) console.log(` ✓ ${name}`)
|
|
16
|
-
else {
|
|
17
|
-
failures += 1
|
|
18
|
-
console.log(` ✗ ${name} ${detail}`)
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
// A bad design-audit --json report shaped exactly like the CLI writes: one clean
|
|
23
|
-
// page + one page whose MEASURED floor is blocking, while it self-reports a high
|
|
24
|
-
// healthScore (the dishonesty the floor verdict must override).
|
|
25
|
-
const report: BadDesignReport = {
|
|
26
|
-
summary: { avgScore: 7, healthScore: 80 },
|
|
27
|
-
pages: [
|
|
28
|
-
{
|
|
29
|
-
route: 'home',
|
|
30
|
-
url: 'https://shop.test/',
|
|
31
|
-
score: 8,
|
|
32
|
-
healthScore: 88,
|
|
33
|
-
findings: [
|
|
34
|
-
{ category: 'hierarchy', severity: 'major', title: 'Weak CTA hierarchy', description: 'primary + secondary look identical', recommendation: 'differentiate weight', selector: 'button.cta' },
|
|
35
|
-
],
|
|
36
|
-
measurements: {
|
|
37
|
-
contrast: { aaFailures: [{}, {}], totalChecked: 100, summary: { aaPassRate: 0.98 } },
|
|
38
|
-
a11y: { violations: [{ id: 'image-alt', impact: 'moderate' }] },
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
route: 'checkout',
|
|
43
|
-
url: 'https://shop.test/checkout',
|
|
44
|
-
score: 4,
|
|
45
|
-
healthScore: 95, // self-reports GREAT — but the measured floor is blocking
|
|
46
|
-
findings: [],
|
|
47
|
-
measurements: {
|
|
48
|
-
contrast: { aaFailures: new Array(40).fill({}), totalChecked: 100, summary: { aaPassRate: 0.6 } },
|
|
49
|
-
a11y: {
|
|
50
|
-
violations: [
|
|
51
|
-
{ id: 'label', impact: 'critical' },
|
|
52
|
-
{ id: 'button-name', impact: 'critical' },
|
|
53
|
-
{ id: 'aria-required', impact: 'critical' },
|
|
54
|
-
{ id: 'link-name', impact: 'serious' },
|
|
55
|
-
{ id: 'color-contrast', impact: 'serious' },
|
|
56
|
-
],
|
|
57
|
-
},
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
],
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
console.log('bad-design-audit reviewer mapper verify:')
|
|
64
|
-
|
|
65
|
-
const runs = badDesignAuditToReviewRuns(report)
|
|
66
|
-
check('maps one UiReviewRun per page', runs.length === 2, `got ${runs.length}`)
|
|
67
|
-
check('carries the deterministic floor (axe + contrast) on each page', runs.every((r) => r.measurements != null))
|
|
68
|
-
const home = runs.find((r) => r.route === 'home')!
|
|
69
|
-
check('home contrast pass rate mapped', home.measurements?.contrastAaPassRate === 0.98)
|
|
70
|
-
check('home finding mapped to a UiFinding (lens=category, severity preserved, selector kept)', home.findings.length === 1 && home.findings[0]?.lens === 'hierarchy' && home.findings[0]?.severity === 'major' && home.findings[0]?.selector === 'button.cta')
|
|
71
|
-
check('self-reported healthScore recorded but NOT the verdict', home.selfReportedScore === 88)
|
|
72
|
-
|
|
73
|
-
const verdict = judgeUiFloor(runs)
|
|
74
|
-
check('panel verdict is BLOCKING — the measured checkout floor (3 critical a11y + 40% contrast fail) overrides the 95 self-report', verdict.resolved === false, verdict.detail)
|
|
75
|
-
check('blocking score is low', verdict.score < 0.6, verdict.detail)
|
|
76
|
-
|
|
77
|
-
// A reviewer with NO measurements (e.g. a findings-only audit) contributes no floor.
|
|
78
|
-
const noFloor = badDesignAuditToReviewRuns({ pages: [{ route: 'x', findings: [], score: 5 }] } satisfies BadDesignReport)
|
|
79
|
-
check('a page without measurements yields no floor (subjective-only run)', noFloor[0]?.measurements === undefined)
|
|
80
|
-
|
|
81
|
-
if (failures > 0) {
|
|
82
|
-
console.log(`\n❌ ${failures} check(s) failed`)
|
|
83
|
-
process.exit(1)
|
|
84
|
-
}
|
|
85
|
-
console.log('\n✅ bad-design-audit reviewer verified — floor mapped from --json, verdict driven by the measured floor not the self-report')
|