From 98092a05f58e932c5ed363e5951e746eb4117fce Mon Sep 17 00:00:00 2001 From: maxffarrell <72176209+maxffarrell@users.noreply.github.com> Date: Sun, 4 Oct 2026 09:02:45 -0500 Subject: [PATCH 1/2] List reported scores below benchmark charts; rebase onto current main --- site/assets/app.js | 30 ++++++++++++++++++++++ site/assets/styles.css | 57 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 87 insertions(+) diff --git a/site/assets/app.js b/site/assets/app.js index a51f554d..5beae832 100644 --- a/site/assets/app.js +++ b/site/assets/app.js @@ -6027,6 +6027,36 @@ function catalogSourceTable(source, payload) { chart ? organizationLegend(catalogPlottedRows(payload)) : null, infoDisclosure(notes.join(" ")), ]), + catalogScoreResults(source, rows), + ]); +} + +// The chart is useful for trends; the same observations need a readable route +// on a phone, including scores with no date (which cannot appear on the axis). +function catalogScoreResults(source, rows) { + if (!rows.length) return null; + const meta = catalogSourceMeta(source); + const ordered = rows.slice().sort((a, b) => + String(b.reported_date || "").localeCompare(String(a.reported_date || "")) || + String(a.model_name || "").localeCompare(String(b.model_name || "")) || + String(a.obs_id || "").localeCompare(String(b.obs_id || ""))); + return element("section", { className: "catalog-result-section" }, [ + element("h3", { text: `${t("Reported results")} · ${meta.name} (${ordered.length.toLocaleString()})` }), + element("ol", { className: "catalog-result-list" }, ordered.map((row) => + element("li", { className: "catalog-result" }, [ + element("div", { className: "catalog-result-main" }, [ + element("strong", { text: row.model_name || t("not recorded") }), + element("strong", { className: "catalog-result-value", text: String(row.raw_value ?? row.value ?? t("not recorded")) }), + ]), + element("p", { className: "catalog-result-meta", text: [ + row.organization, + row.reported_date ? `${t(row.date_precision === "model_announcement" ? "Model release" : "Document published")} ${formatDate(row.reported_date, { dateStyle: "medium" })}` : t("Date unknown"), + ].filter(Boolean).join(" · ") }), + row.instrument || row.protocol ? element("p", { className: "catalog-result-meta", text: [row.instrument, row.protocol].filter(Boolean).join(" · ") }) : null, + safeHttpUrl(row.source_url) ? element("a", { className: "catalog-result-source", text: t("Source ↗"), attrs: { + href: safeHttpUrl(row.source_url), target: "_blank", rel: "noopener noreferrer", + } }) : null, + ]))), ]); } diff --git a/site/assets/styles.css b/site/assets/styles.css index 1e627311..54ff51b8 100644 --- a/site/assets/styles.css +++ b/site/assets/styles.css @@ -5116,6 +5116,63 @@ footer { border-top: 1px solid #223036; } +.catalog-result-section { + margin-top: 1.5rem; +} + +.catalog-result-section h3 { + margin-bottom: 0.75rem; + font-size: 1rem; +} + +.catalog-result-list { + display: grid; + gap: 0; + max-height: 36rem; + overflow-y: auto; + margin: 0; + padding: 0; + list-style: none; + border: 1px solid #39464c; + border-radius: 6px; +} + +.catalog-result { + padding: 0.8rem 1rem; + min-width: 0; +} + +.catalog-result + .catalog-result { + border-top: 1px solid #223036; +} + +.catalog-result-main { + display: flex; + justify-content: space-between; + gap: 1rem; + overflow-wrap: anywhere; +} + +.catalog-result-value { + flex: none; + font-variant-numeric: tabular-nums; + color: #a2dccc; +} + +.catalog-result-meta { + margin: 0.25rem 0 0; + color: #aebcc1; + font-size: 0.8rem; + overflow-wrap: anywhere; +} + +.catalog-result-source { + display: inline-block; + margin-top: 0.35rem; + color: #a2dccc; + font-size: 0.8rem; +} + .catalog-sibling-link { padding: 0; border: 0; From dd021c228d9e3b35f0df4bdf693b6780512bdfe5 Mon Sep 17 00:00:00 2001 From: maxffarrell <72176209+maxffarrell@users.noreply.github.com> Date: Sun, 4 Oct 2026 09:13:48 -0500 Subject: [PATCH 2/2] Localize reported results and test complete source histories --- site/assets/app.js | 6 +-- tests/catalog_score_results_harness.mjs | 67 +++++++++++++++++++++++++ tests/test_saturation_view.py | 12 +++++ 3 files changed, 82 insertions(+), 3 deletions(-) create mode 100644 tests/catalog_score_results_harness.mjs diff --git a/site/assets/app.js b/site/assets/app.js index 5beae832..5875ed5d 100644 --- a/site/assets/app.js +++ b/site/assets/app.js @@ -6041,7 +6041,7 @@ function catalogScoreResults(source, rows) { String(a.model_name || "").localeCompare(String(b.model_name || "")) || String(a.obs_id || "").localeCompare(String(b.obs_id || ""))); return element("section", { className: "catalog-result-section" }, [ - element("h3", { text: `${t("Reported results")} · ${meta.name} (${ordered.length.toLocaleString()})` }), + element("h3", { text: `${t("Reported benchmark scores")} · ${t(meta.name)} (${ordered.length.toLocaleString()})` }), element("ol", { className: "catalog-result-list" }, ordered.map((row) => element("li", { className: "catalog-result" }, [ element("div", { className: "catalog-result-main" }, [ @@ -6050,10 +6050,10 @@ function catalogScoreResults(source, rows) { ]), element("p", { className: "catalog-result-meta", text: [ row.organization, - row.reported_date ? `${t(row.date_precision === "model_announcement" ? "Model release" : "Document published")} ${formatDate(row.reported_date, { dateStyle: "medium" })}` : t("Date unknown"), + row.reported_date ? `${t(row.date_precision === "model_announcement" ? "model release date" : "Document publication date")} ${formatDate(row.reported_date, { dateStyle: "medium" })}` : t("Date unknown"), ].filter(Boolean).join(" · ") }), row.instrument || row.protocol ? element("p", { className: "catalog-result-meta", text: [row.instrument, row.protocol].filter(Boolean).join(" · ") }) : null, - safeHttpUrl(row.source_url) ? element("a", { className: "catalog-result-source", text: t("Source ↗"), attrs: { + safeHttpUrl(row.source_url) ? element("a", { className: "catalog-result-source", text: t("Open source record ↗"), attrs: { href: safeHttpUrl(row.source_url), target: "_blank", rel: "noopener noreferrer", } }) : null, ]))), diff --git a/tests/catalog_score_results_harness.mjs b/tests/catalog_score_results_harness.mjs new file mode 100644 index 00000000..4ce978ee --- /dev/null +++ b/tests/catalog_score_results_harness.mjs @@ -0,0 +1,67 @@ +import assert from 'node:assert/strict'; +import { readFileSync } from 'node:fs'; +const source = readFileSync('site/assets/app.js', 'utf8'); +function fn(name) { + const start = source.indexOf(`function ${name}(`); + assert(start >= 0, name); + return source.slice(start, source.indexOf('\n}\n', start) + 2); +} +function constant(name) { + const start = source.indexOf(`const ${name} = {`); + return source.slice(start, source.indexOf('\n};', start) + 3); +} +class Node { + constructor(tag) { this.tag = tag; this.children = []; this.attrs = {}; this.ownText = ''; } + set textContent(value) { this.ownText = value; } + get textContent() { return this.ownText + this.children.map(child => child.textContent).join(' '); } + append(child) { this.children.push(child); } + setAttribute(key, value) { this.attrs[key] = value; } +} +let language = 'en'; +const document = { createElement: tag => new Node(tag) }; +const functions = ['t', 'element', 'formatDate', 'safeHttpUrl', 'catalogSourceMeta', 'catalogDisplayFactor', 'catalogSourceTable', 'catalogScoreResults', 'catalogScoresBlock']; +const render = new Function('document', 'getLang', ` +${constant('I18N')} +${constant('CATALOG_SOURCE_META')} +const dateValue = value => Date.parse(value); +const catalogScoreChart = () => null; +const infoDisclosure = text => element('details', {text}); +${functions.map(fn).join('\n')} +return {catalogScoreResults, catalogScoresBlock}; +`)(document, () => language); +const all = (node, predicate) => [node, ...node.children.flatMap(child => all(child, predicate))].filter(predicate); +const rows = Array.from({length: 1100}, (_, i) => ({ + obs_id: `observation-${i}`, model_name: `Model ${i}`, value: i, + reported_date: i % 2 ? '2026-09-01' : null, date_precision: 'model_announcement', +})); +rows[0] = {obs_id: 'zero', model_name: '', raw_value: 0, value: 0, reported_date: null, source_url: 'javascript:alert(1)'}; +rows[1] = {obs_id: 'document', model_name: 'Same model', value: 42, reported_date: '2026-09-02', date_precision: 'document_publication', instrument: 'Variant A', protocol: 'no tools', source_url: 'https://example.org/report'}; +rows[2] = {obs_id: 'variant', model_name: 'Same model', value: 43, reported_date: '2026-09-02', date_precision: 'document_publication', instrument: 'Variant B', protocol: 'with tools'}; +const originalOrder = rows.map(row => row.obs_id); +const section = render.catalogScoreResults('model_reports', rows); +const items = all(section, node => node.tag === 'li'); +assert.equal(items.length, rows.length, 'large histories never truncate observations'); +for (const row of rows) assert(items.some(item => item.textContent.includes(row.model_name))); +const zero = items.find(item => item.textContent.includes('')); +assert.equal(all(zero, node => node.className === 'catalog-result-value')[0].textContent, '0'); +assert(zero.textContent.includes('Date unknown')); +assert.equal(all(zero, node => node.tag === 'a').length, 0, 'unsafe URLs are not linked'); +assert(items.some(item => item.textContent.includes('Variant A') && item.textContent.includes('no tools'))); +assert(items.some(item => item.textContent.includes('Variant B') && item.textContent.includes('with tools'))); +assert.deepEqual(rows.map(row => row.obs_id), originalOrder, 'rendering does not reorder source observations'); +assert.equal(render.catalogScoreResults('llm_stats', []), null); +const separate = render.catalogScoresBlock({scores_by_source: { + model_reports: {rows}, llm_stats: {rows: [{model_name: 'Registry-only model', value: 99}]}, +}}); +const sources = all(separate, node => node.className === 'catalog-source'); +assert.equal(sources.length, 2); +assert.deepEqual(sources.map(node => all(node, item => item.tag === 'li').length).sort((a,b) => a-b), [1, 1100]); +assert.equal(sources.filter(node => node.textContent.includes('Registry-only model')).length, 1); +language = 'zh'; +const chinese = render.catalogScoreResults('model_reports', rows); +assert(all(chinese, node => node.tag === 'h3')[0].textContent.includes('Benchmark 已报告成绩 · 模型报告')); +for (const label of ['模型发布日期', '文档发布日期', '日期未知', '打开来源记录 ↗']) assert(chinese.textContent.includes(label), label); +for (const label of ['Reported benchmark scores', 'Model reports', 'model release date', 'Document publication date', 'Date unknown', 'Open source record']) assert(!chinese.textContent.includes(label), label); +language = 'en'; +assert(render.catalogScoreResults('model_reports', rows).textContent.includes('Reported benchmark scores · Model reports')); +console.log('Complete histories, undated zero scores, source partitions, run variants, safe links, and Chinese/English rendering passed.'); diff --git a/tests/test_saturation_view.py b/tests/test_saturation_view.py index 65a9b4e4..e8479d11 100644 --- a/tests/test_saturation_view.py +++ b/tests/test_saturation_view.py @@ -830,3 +830,15 @@ def _css_rule(styles: str, selector: str) -> str: """Return the body of the first rule whose selector matches exactly.""" assert selector in styles, f"missing selector: {selector}" return styles.split(selector, 1)[1].split("}", 1)[0] + + +def test_reported_result_lists_preserve_observations_sources_and_localization(): + import shutil + import subprocess + + import pytest + + node = shutil.which("node") + if not node: + pytest.skip("node is not installed") + subprocess.run([node, "tests/catalog_score_results_harness.mjs"], check=True, timeout=60)