Files
msd-core/tests/model-catalog-runtime-defaults.test.cjs
Jakub Zych a9a7a328e6 refactor: hard-fork GSD -> MSD (Make Software Done)
Mechanical rename produced by scripts/msd-rename.cjs: gsd/Gsd/GSD -> msd/Msd/MSD
across contents and paths, upstream package/repo coordinates -> @golem15/msd-core
and golem15com/msd-core. Deep links into upstream history, sibling upstream
packages, the GSD-2 import feature, CHANGELOG.md and .changeset/ are kept as-is.

Hand edits on top: MSD block-letter banner and logos, LICENSE copyright line,
package/plugin identity, regenerated lockfile, install-tree fixtures, derived
registries and benchmark baseline; migration checksum baseline re-locked
(MSD keeps its own install state, so no install had applied the old sums);
sort-order and regex-escaped expectations in tests adjusted.
2026-10-06 01:47:40 +02:00

82 lines
3.6 KiB
JavaScript

// allow-test-rule: source-text-is-the-product
// These docs tables are the shipped operator surface for runtime model tiers.
'use strict';
const { describe, test } = require('node:test');
const assert = require('node:assert/strict');
const fs = require('node:fs');
const path = require('node:path');
const { catalog, KNOWN_RUNTIMES } = require('../msd-core/bin/lib/model-catalog.cjs');
const { allRuntimes } = require('../bin/install.js');
const ROOT = path.join(__dirname, '..');
const SETTINGS_ADVANCED = fs.readFileSync(path.join(ROOT, 'msd-core', 'workflows', 'settings-advanced.md'), 'utf8');
const CONFIG_DOC = fs.readFileSync(path.join(ROOT, 'docs', 'CONFIGURATION.md'), 'utf8');
const catalogPath = path.join(ROOT, 'msd-core', 'bin', 'shared', 'model-catalog.json');
const CATALOG_RAW = fs.readFileSync(catalogPath, 'utf8');
describe('model catalog runtime defaults parity (#3229)', () => {
test('known runtimes include hermes and match catalog keys', () => {
assert.ok(KNOWN_RUNTIMES.has('hermes'));
assert.ok(KNOWN_RUNTIMES.has('kimi'));
assert.deepStrictEqual([...KNOWN_RUNTIMES].sort(), Object.keys(catalog.runtimeTierDefaults).sort());
});
test('installer-supported runtimes are all known to the model catalog', () => {
assert.deepStrictEqual([...allRuntimes].sort(), [...KNOWN_RUNTIMES].sort());
});
test('settings-advanced runtime defaults table matches catalog for concrete runtimes', () => {
for (const [runtime, tiers] of Object.entries(catalog.runtimeTierDefaults)) {
if (!tiers.opus) continue; // Group B runtimes intentionally have no built-ins
assert.ok(SETTINGS_ADVANCED.includes(`| \`${runtime}\``), `settings-advanced.md missing ${runtime} row`);
for (const alias of ['opus', 'sonnet', 'haiku']) {
const entry = tiers[alias];
assert.ok(entry?.model, `${runtime}.${alias} missing model in catalog`);
assert.ok(
SETTINGS_ADVANCED.includes(`\`${entry.model}\``),
`settings-advanced.md missing ${runtime}.${alias} model ${entry.model}`,
);
}
}
});
test('CONFIGURATION runtime defaults table matches catalog for concrete runtimes', () => {
for (const [runtime, tiers] of Object.entries(catalog.runtimeTierDefaults)) {
if (!tiers.opus) continue;
assert.ok(CONFIG_DOC.includes(`| \`${runtime}\``), `CONFIGURATION.md missing ${runtime} row`);
for (const alias of ['opus', 'sonnet', 'haiku']) {
const entry = tiers[alias];
assert.ok(
CONFIG_DOC.includes(`\`${entry.model}\``),
`CONFIGURATION.md missing ${runtime}.${alias} model ${entry.model}`,
);
}
}
});
test('Group B runtimes remain documented as having no built-in defaults', () => {
const groupB = Object.keys(catalog.runtimeTierDefaults)
.filter(runtime => !catalog.runtimeTierDefaults[runtime].opus);
assert.ok(groupB.length > 0, 'expected at least one Group B runtime in catalog');
for (const runtime of groupB) {
const tiers = catalog.runtimeTierDefaults[runtime];
assert.equal(tiers.opus, null);
assert.equal(tiers.sonnet, null);
assert.equal(tiers.haiku, null);
}
assert.ok(SETTINGS_ADVANCED.includes('Group B'));
assert.ok(CONFIG_DOC.includes('Group B'));
});
test('catalog contains no retired/invalid model IDs', () => {
// Retired per issue #779 verify-first audit (gemini-cli source + OpenAI Codex models page).
const RETIRED = ['"gemini-3-pro"', '"gpt-5.3-codex"'];
for (const id of RETIRED) {
assert.ok(!CATALOG_RAW.includes(id), `retired model ID ${id} must not appear in model-catalog.json (see #779)`);
}
});
});