Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix: restore comparison loading for legacy benchmark catalogs (#8242)

[._.]/fbe162867c48
diff --git a/server/routes/modelComparison.test.js b/server/routes/modelComparison.test.js
index 05afee4543..3e3896321f 100644
--- a/server/routes/modelComparison.test.js
+++ b/server/routes/modelComparison.test.js
@@ -100,3 +100,33 @@ it('requires explicit estimation provenance and protects run-only sources on eve
const forged = { ...observation, id: 'forged-quota', quota: { unitsPerTask: 1, unit: 'task', source: { ...observation.quality.source, url: 'portos://model-comparison/00000000-0000-4000-8000-000000000001' } } };
expect((await request(app).post('/comparison/import').send({ schemaVersion: 1, observations: [forged] })).status).toBe(400);
});
+
+it('loads legacy benchmark labels after upgrade and preserves evidence through subsequent imports', async () => {
+ const shipped = seed.observations.filter(row => row.id.startsWith('lcb-generation-2023-05-08--2025-04-07-'));
+ expect(shipped.length).toBeGreaterThan(0);
+ const legacy = shipped.map(row => ({ ...row,
+ benchmark: 'LiveCodeBench (generation, pass@1, 2023-05-08 to 2025-04-07)',
+ inputPerMillion: null, outputPerMillion: null,
+ }));
+ const stored = JSON.stringify({ schemaVersion: 1, observations: legacy });
+ await writeFile(join(dir, 'model-comparison.json'), stored);
+ for (let reload = 0; reload < 2; reload++) {
+ const result = await request(app).get('/comparison');
+ expect(result.status).toBe(200);
+ expect(result.body.observations).toHaveLength(seed.observations.length);
+ for (const row of shipped) expect(result.body.observations.find(item => item.id === row.id)).toMatchObject({
+ benchmark: row.benchmark, quality: row.quality, inputPerMillion: row.inputPerMillion, outputPerMillion: row.outputPerMillion,
+ });
+ }
+ // Reload is read-only; persistence occurs only during an explicit import.
+ expect(await readFile(join(dir, 'model-comparison.json'), 'utf8')).toBe(stored);
+ expect((await request(app).post('/comparison/import').send({ schemaVersion: 1, observations: legacy })).status).toBe(200);
+ const saved = JSON.parse(await readFile(join(dir, 'model-comparison.json'), 'utf8'));
+ expect(saved.observations).toHaveLength(seed.observations.length);
+ for (const row of shipped) expect(saved.observations.find(item => item.id === row.id)).toMatchObject({
+ benchmark: row.benchmark, quality: row.quality, inputPerMillion: row.inputPerMillion, outputPerMillion: row.outputPerMillion,
+ });
+ const changed = { ...legacy[0], benchmark: 'LiveCodeBench (generation, pass@1, 2025-01-01 to 2025-04-07)' };
+ expect((await request(app).post('/comparison/import').send({ schemaVersion: 1, observations: [changed] })).status).toBe(409);
+ expect((await request(app).get('/comparison')).status).toBe(200);
+});
diff --git a/server/services/modelComparison.js b/server/services/modelComparison.js
index 301f0b86aa..678ae02a1c 100644
--- a/server/services/modelComparison.js
+++ b/server/services/modelComparison.js
@@ -18,6 +18,16 @@ const hasPortosRunSource = row => [
].some(metric => typeof metric?.source?.url === 'string'
&& /^portos:\/\/model-comparison\/[0-9a-f-]{36}$/i.test(metric.source.url));
+// This shipped label was clarified without changing the benchmark's dataset or
+// scoring. Normalize the exact legacy name at read/import boundaries so upgrades
+// retain stable observation ids without relaxing semantic identity checks.
+const normalizeCatalog = catalog => ({
+ ...catalog,
+ observations: catalog.observations.map(row => row.benchmark === 'LiveCodeBench (generation, pass@1, 2023-05-08 to 2025-04-07)'
+ ? { ...row, benchmark: 'LiveCodeBench generation pass@1 (1,055 problems; 2023-05-08 to 2025-04-07)' }
+ : row),
+});
+
export async function getModelComparison() {
const raw = await readFile(catalogPath(), 'utf8').catch(error => {
if (error.code !== 'ENOENT') throw error;
@@ -25,14 +35,14 @@ export async function getModelComparison() {
});
// A malformed or future-version catalog must surface an error, never be
// replaced with an empty store by the next import.
- const catalog = modelComparisonCatalogSchema.parse(JSON.parse(raw));
+ const catalog = normalizeCatalog(modelComparisonCatalogSchema.parse(JSON.parse(raw)));
return catalog;
}
/** Public comparison data always comes from the shipped catalog, never local files. */
export async function getShippedModelComparison() {
const raw = await readFile(join(PATHS.root, 'data.reference/model-comparison.json'), 'utf8');
- const catalog = modelComparisonCatalogSchema.parse(JSON.parse(raw));
+ const catalog = normalizeCatalog(modelComparisonCatalogSchema.parse(JSON.parse(raw)));
return {
...catalog,
observations: catalog.observations.filter(row =>
@@ -72,7 +82,7 @@ async function mergeModelComparison(incoming) {
}
export function importModelComparison(input) {
- const incoming = modelComparisonImportSchema.parse(input);
+ const incoming = normalizeCatalog(modelComparisonImportSchema.parse(input));
if (incoming.observations.some(row => isPortosBenchmarkObservation(row) || hasPortosRunSource(row))) {
throw new ServerError('PortOS benchmark observations can only be created by the explicit benchmark run.', { status: 400 });
}