From 04492c5bd55fd8a0c5faaa6b4d7e2c5751b4e48a Mon Sep 17 00:00:00 2001 From: Harenome Ranaivoarivony-Razanajato Date: Mon, 23 Nov 2026 15:16:50 +0100 Subject: [PATCH] fix(builder): show each check's proof on every chosen dataset The Agent step's Checks cards read the first chosen dataset's proofs only. With several datasets chosen, each card now carries one chip per dataset, one row each, named by its dataset. One dataset reads as before. Proofs are not summed: each is its own dataset's, and datasets can share tasks. --- app/static/builder/command-builder.css | 1 + app/static/builder/command-builder.js | 15 ++++--- app/ui_tests/test_builder_check_chips.py | 57 ++++++++++++++++++++++++ 3 files changed, 67 insertions(+), 6 deletions(-) create mode 100644 app/ui_tests/test_builder_check_chips.py diff --git a/app/static/builder/command-builder.css b/app/static/builder/command-builder.css index 09ba884f..20402b70 100644 --- a/app/static/builder/command-builder.css +++ b/app/static/builder/command-builder.css @@ -210,6 +210,7 @@ #nullius-builder [data-std-dataset] .nb-tile-foot { display: grid; grid-template-columns: max-content max-content; align-items: start; gap: 8px; } #nullius-builder [data-std-dataset] .nb-tile-foot > span:first-child:not([class]) { grid-column: 1 / -1; margin: 0 0 2px; } #nullius-builder [data-std-dataset] .std-ctl { justify-self: start; flex-wrap: nowrap; white-space: nowrap; } +#nullius-builder .std-ctls { display: grid; justify-items: start; gap: 5px; min-width: 0; } /* A card group shares one row height, including cards with compatibility notes. */ #nullius-builder .nb-pick-grid { grid-auto-rows: 1fr; } diff --git a/app/static/builder/command-builder.js b/app/static/builder/command-builder.js index 8a69b81f..274718ea 100644 --- a/app/static/builder/command-builder.js +++ b/app/static/builder/command-builder.js @@ -437,8 +437,14 @@ } const proofSpan = p => `${esc(p.text)}`; // A control or a check as a plain chip: its name and its proof; where the control comes from is in its title. - const controlChip = (c, proof = true) => `${esc(c.key)}` + const controlChip = (c, proof = true, of = '') => `${esc(c.key)}${of ? `${esc(of)}` : ''}` + (proof ? proofSpan(proofOf(c.proven, c.failed, c.expect, c.short)) : '') + ''; + // A check's chips on the Agent step: its proof on each chosen dataset (the first when none is), never a sum, + // since a proof is a dataset's own and datasets can share tasks (GSM8K-Platinum is GSM8K test, cleaned). + // Several: one row each, named by its dataset. + const controlChips = (o, b, ids) => { const chosen = b.datasets.filter(x => ids.includes(x.id)), ds = chosen.length ? chosen : b.datasets.slice(0, 1); + const chip = x => controlChip(((x || {}).controls || []).find(c => c.key === o.key) || {...o, from: o.summary}, true, ds.length > 1 ? x.label : ''); + return ds.length > 1 ? `${ds.map(chip).join('')}` : chip(ds[0]); }; const checkChip = (name, proven, failed, says) => { const p = proofOf(proven, failed); if (p.state === 'ok') { p.title = [says, proven.passed, p.title].filter(Boolean).join(' · '); p.text = '✓'; } return `${esc(name)}${proofSpan(p)}`; }; // The yes to an agent running as you: asked only for the local backend, where it is no sandbox. @@ -710,7 +716,6 @@ if (step === S.agent) { const agent = b.family === 'agent', all = C.standardOthers(rec), others = all.filter(o => !o.control && (!o.setup || o.own)); const setups = all.filter(o => o.setup && !o.own), controls = all.filter(o => o.control); - const ds = b.datasets.find(x => C.datasetsOf(rec).includes(x.id)) || b.datasets[0]; // each chosen agent's options, at its vendor's default unless changed: {ref: {name: word}} const chosen = others.filter(o => C.chosenOf(rec).includes(o.key) && !o.why.length), mine = chosen.filter(o => !o.own); const optionsOf = o => { const mine = (rec.options || {})[o.key] || {}, opts = Object.entries(o.options || {}); @@ -722,10 +727,8 @@ }).join('') + ''; }; // the chosen ones' settings, one tab each: the benchmark's own way, the benchmark's settings every agent takes, each one's own const yoursWord = agent ? 'agent' : (b.kind || 'capability'); - const ds2 = ds; - const controlTile = o => { const c = ((ds2 || {}).controls || []).find(x => x.key === o.key) || {...o, from: o.summary}; - return tile({attr: 'std-other', key: o.key, on: C.chosenOf(rec).includes(o.key), mark: o.key === 'nop' ? '∅' : '≡', title: o.label, - tip: o.summary + (b.judged ? ' The judge still runs.' : ''), foot: controlChip(c)}); }; + const controlTile = o => tile({attr: 'std-other', key: o.key, on: C.chosenOf(rec).includes(o.key), mark: o.key === 'nop' ? '∅' : '≡', title: o.label, + tip: o.summary + (b.judged ? ' The judge still runs.' : ''), foot: controlChips(o, b, C.datasetsOf(rec))}); const setupsNamed = ls => ls.filter(l => !ls.some(m => m !== l && l.startsWith(m))).join(' and '); const onSetups = setups.filter(o => C.chosenOf(rec).includes(o.key)).concat(chosen.some(o => o.own) ? [{label: 'Original'}] : []); return `

Who runs it?

` diff --git a/app/ui_tests/test_builder_check_chips.py b/app/ui_tests/test_builder_check_chips.py new file mode 100644 index 00000000..463c77df --- /dev/null +++ b/app/ui_tests/test_builder_check_chips.py @@ -0,0 +1,57 @@ +"""The Agent step's Checks cards as the page draws them: each control's proof on every chosen dataset.""" +import json +import re +import subprocess +import unittest + +from ui_tests.builder_support import APP, CompilerCase + + +class CheckChips(CompilerCase): + def chips(self, pick): + """{benchmark: {control: [chip title, chip text, visible dataset name], $rows: stacked}} for every standard benchmark with several datasets; + ``pick``, JavaScript choosing the dataset ids from ``b``.""" + page = (APP / "static/builder/command-builder.js").read_text(encoding="utf-8") + cut = lambda start, end: page[page.index(start):page.index(end, page.index(start))] + line = lambda name: re.search(r"^ const %s = .*$" % name, page, re.M).group(0) + "\n" + program = ("const C=require(" + json.dumps(str(APP / "static/builder/command-builder-core.js")) + ")(" + json.dumps(self.schema) + ");\n" + + line("esc") + cut(" const SOURCE_SAYS = ", " const checkChip = ") + + "const out={};for(const b of C.standard().benchmarks.filter(b=>b.datasets.length>1)){out[b.key]={};" + + "for(const o of b.controls||[])out[b.key][o.key]=[...controlChips(o,b," + pick + ").matchAll(/title=\"([^\"]*)\">[^<]*<\\/b>(?:([^<]*)<\\/em>)?]*>([^<]*)[m[1],m[3],m[2]||null]);" + + "out[b.key].$rows=controlChips((b.controls||[])[0]||{key:'nop'},b," + pick + ").startsWith('');}" + + "process.stdout.write(JSON.stringify({out,data:Object.fromEntries(C.standard().benchmarks.map(b=>[b.key,b.datasets]))}));") + return json.loads(subprocess.run([self.node, "-"], input=program, check=True, capture_output=True, text=True).stdout) + + def test_every_chosen_dataset_shows_its_own_proof(self): + got = self.chips("b.datasets.map(x=>x.id)") + self.assertIn("gsm8k", got["out"]) + self.assertEqual(got["out"]["gsm8k"]["nop"][1][1:], ["✓ 0/1209", "GSM8K-Platinum"]) # after GSM8K test's + self.assertEqual(got["out"]["gsm8k"]["oracle"][0][1], "✓ 1319/1319") + for key, controls in got["out"].items(): + datasets = got["data"][key] + self.assertTrue(controls.pop("$rows"), key) # one row per dataset + for control, chips in controls.items(): + with self.subTest(key, control=control): + self.assertEqual(len(chips), len(datasets)) + for (title, _, name), d in zip(chips, datasets): + self.assertTrue(title.startswith(d["label"] + " · "), title) + self.assertEqual(name, d["label"]) + + def test_one_chosen_dataset_shows_only_its_proof_unlabelled(self): + for pick, i in (("[b.datasets[0].id]", 0), ("[b.datasets[1].id]", 1), ("[]", 0)): + got = self.chips(pick) + for key, controls in got["out"].items(): + d = got["data"][key][i] + self.assertFalse(controls.pop("$rows"), key) + for control, chips in controls.items(): + with self.subTest(key, control=control, pick=pick): + self.assertEqual(len(chips), 1) + self.assertFalse(chips[0][0].startswith(d["label"] + " · ")) + self.assertIsNone(chips[0][2]) + proof = next((c for c in d.get("controls", []) if c["key"] == control), {}).get("proven") + if proof: + self.assertTrue(chips[0][1].startswith("✓ " + proof["passed"]), (chips[0][1], proof)) + + +if __name__ == "__main__": + unittest.main()