Files
SkillCompiler/data/skills-bench/website/scripts/generate-results-registry.ts
T
2026-09-04 14:58:42 +08:00

67 lines
2.4 KiBLFS
TypeScript

import path from "path";
import { writeJsonOutput, fetchFromGitHub } from "./resolve-data-paths";
import { HY3_PR18_RESULTS } from "./hy3-pr18-results";
/**
* Per-(task, model-harness, condition) result row. Mirrors
* src/utils/result-types.ts (kept in sync; `family` is an open string —
* the registry now spans 8 model families, not 3).
*/
interface TaskResult {
task: string;
model: string;
modelShort: string;
harness: string;
family: string;
condition: "No Skills" | "With Skills" | "Self-Generated";
score: number;
trials: number;
passCount: number;
perfectCount: number;
}
/**
* The Results-board registry is PUBLISHED by the SkillsBench trajectories repo
* (benchflow-ai/skillsbench-trajectories@main:website-data/results-registry.json),
* computed from the HuggingFace dataset. The website consumes that snapshot
* and appends small, reviewed supplements for newer PR refs that have not yet
* landed in the producer repo. This used to also scan a local
* `xiangyi-completed/` trajectory dir, but that only knew the previous-generation
* 7-model / 3-family lineup and would silently overwrite the correct snapshot
* whenever that sibling repo was present in a dev/CI checkout. Removed.
*
* Fail LOUDLY if the snapshot can't be fetched: a missing/empty registry must
* abort the build, not ship every task's Results tab blank.
*/
async function generateResultsRegistry(): Promise<void> {
const outputPath = path.join(__dirname, "..", "src", "data", "results-registry.json");
const remote = await fetchFromGitHub<TaskResult[]>("results-registry.json");
if (!remote || remote.length === 0) {
throw new Error(
`[results] Could not fetch website-data/results-registry.json from ` +
`skillsbench-trajectories@main (got ${remote ? "an empty array" : "null"}). ` +
`The website Results tabs depend on this snapshot — aborting build.`,
);
}
const seen = new Set(
remote.map((row) => `${row.task}|${row.model}|${row.condition}`),
);
const supplements = HY3_PR18_RESULTS.filter(
(row) => !seen.has(`${row.task}|${row.model}|${row.condition}`),
);
const merged = [...remote, ...supplements];
writeJsonOutput(outputPath, merged);
console.log(
`[results] Wrote ${merged.length} entries: ${remote.length} canonical + ` +
`${supplements.length} reviewed PR supplements`,
);
}
generateResultsRegistry().catch((err) => {
console.error(err);
process.exit(1);
});