Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions site/assets/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Comment thread
maxffarrell marked this conversation as resolved.
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 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" }, [
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 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("Open source record ↗"), attrs: {
href: safeHttpUrl(row.source_url), target: "_blank", rel: "noopener noreferrer",
} }) : null,
]))),
]);
}

Expand Down
57 changes: 57 additions & 0 deletions site/assets/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
67 changes: 67 additions & 0 deletions tests/catalog_score_results_harness.mjs
Original file line number Diff line number Diff line change
@@ -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: '<Model zero>', 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('<Model zero>'));
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.');
12 changes: 12 additions & 0 deletions tests/test_saturation_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)