mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-26 17:12:27 +03:00
fix(intelligence): synthesize base-model arena rows from effort/harness variants; drop MODEL_ALIAS_MAP (#11504) (#11506)
Validated in a combined 4-PR batch worktree off release/v3.8.51 tip (stacked on #11492, merged first). - TDD-first: the new base-model-synthesis describe block failed 5/5 pre-fix, passes now - Focused test: tests/unit/arena-elo-sync.test.ts — 56/56 pass, part of batch's 246/246 node:test + 126/126 vitest runs - typecheck:core, file-size, changelog-integrity, complexity, cognitive-complexity, check:cycles — all OK Thanks for closing the arena-lookup gap for harness/effort-annotated leaderboard rows and retiring MODEL_ALIAS_MAP's cross-generation score copying in favor of scoresAs + registry-owned aliases.
This commit is contained in:
@@ -40,6 +40,7 @@ const {
|
||||
} = await import("../../src/lib/arenaEloSync.ts");
|
||||
const { setFeatureFlagOverride, removeFeatureFlagOverride } =
|
||||
await import("../../src/lib/db/featureFlags.ts");
|
||||
const { resolveScoresAs } = await import("../../open-sse/services/autoCombo/scoresAs.ts");
|
||||
|
||||
import type {
|
||||
ArenaLeaderboardData,
|
||||
@@ -328,7 +329,7 @@ describe("transformToModelIntelligence()", () => {
|
||||
}
|
||||
});
|
||||
|
||||
it("expands model aliases for known models", () => {
|
||||
it("does not copy a variant's score onto a different generation (MODEL_ALIAS_MAP removed, #11504)", () => {
|
||||
const data = makeLeaderboardMap({
|
||||
text: [
|
||||
makeModelEntry({
|
||||
@@ -344,8 +345,10 @@ describe("transformToModelIntelligence()", () => {
|
||||
const models = entries.map((e) => e.model);
|
||||
|
||||
assert.ok(models.includes("claude-opus-4-6-thinking"));
|
||||
assert.ok(models.includes("claude-opus-4"));
|
||||
assert.ok(models.includes("anthropic/claude-opus-4"));
|
||||
// Was asserted the other way round while MODEL_ALIAS_MAP existed: it copied this
|
||||
// score onto `claude-opus-4`, so a claude-opus-4 request read a 4.6-thinking ELO.
|
||||
assert.ok(!models.includes("claude-opus-4"));
|
||||
assert.ok(!models.includes("anthropic/claude-opus-4"));
|
||||
});
|
||||
|
||||
it("empty leaderboard → no entries", () => {
|
||||
@@ -409,6 +412,131 @@ describe("transformToModelIntelligence()", () => {
|
||||
});
|
||||
});
|
||||
|
||||
// ═══════════════════════════════════════════════════════════
|
||||
// 2b. Variant → base row synthesis (#11504)
|
||||
// ═══════════════════════════════════════════════════════════
|
||||
|
||||
describe("transformToModelIntelligence() — base-model synthesis", () => {
|
||||
it("normalizeModelName strips a trailing harness annotation", () => {
|
||||
assert.strictEqual(
|
||||
normalizeModelName("gpt-5.6-sol-xhigh (codex-harness)"),
|
||||
"gpt-5.6-sol-xhigh"
|
||||
);
|
||||
});
|
||||
|
||||
it("normalizeModelName strips vendor prefix and harness annotation together", () => {
|
||||
assert.strictEqual(
|
||||
normalizeModelName("OpenAI/GPT-5.6-Sol-xhigh (Codex-Harness)"),
|
||||
"gpt-5.6-sol-xhigh"
|
||||
);
|
||||
});
|
||||
|
||||
it("harness-annotated variant yields both the variant row and a base row", () => {
|
||||
const data = makeLeaderboardMap({
|
||||
code: [
|
||||
makeModelEntry({
|
||||
model: "gpt-5.6-sol-xhigh (codex-harness)",
|
||||
score: 1700,
|
||||
votes: 5000,
|
||||
rank: 1,
|
||||
}),
|
||||
],
|
||||
});
|
||||
|
||||
const entries = transformToModelIntelligence(data);
|
||||
const coding = entries.filter((e) => e.category === "coding").map((e) => e.model);
|
||||
|
||||
assert.ok(coding.includes("gpt-5.6-sol-xhigh"), "variant row is kept");
|
||||
assert.ok(coding.includes("gpt-5.6-sol"), "base row is synthesized");
|
||||
// `gpt-5.6` is a vendor alias of `gpt-5.6-sol`, resolved at lookup time — never stored here.
|
||||
assert.ok(!coding.includes("gpt-5.6"));
|
||||
});
|
||||
|
||||
it("base row carries the best variant's score and eloRaw", () => {
|
||||
const data = makeLeaderboardMap({
|
||||
code: [
|
||||
makeModelEntry({ model: "claude-opus-5-max", score: 1691, votes: 5000, rank: 1 }),
|
||||
makeModelEntry({ model: "claude-opus-5-high", score: 1663, votes: 5000, rank: 2 }),
|
||||
],
|
||||
});
|
||||
|
||||
const entries = transformToModelIntelligence(data);
|
||||
const base = entries.find((e) => e.model === "claude-opus-5" && e.category === "coding");
|
||||
const max = entries.find((e) => e.model === "claude-opus-5-max" && e.category === "coding");
|
||||
|
||||
assert.ok(base, "synthesized base row exists");
|
||||
assert.ok(max);
|
||||
assert.strictEqual(base.eloRaw, 1691);
|
||||
assert.strictEqual(base.score, max.score);
|
||||
});
|
||||
|
||||
it("never lowers an explicitly measured base row", () => {
|
||||
const data = makeLeaderboardMap({
|
||||
code: [
|
||||
makeModelEntry({ model: "claude-opus-5", score: 1700, votes: 5000, rank: 1 }),
|
||||
makeModelEntry({ model: "claude-opus-5-max", score: 1691, votes: 5000, rank: 2 }),
|
||||
],
|
||||
});
|
||||
|
||||
const entries = transformToModelIntelligence(data);
|
||||
const base = entries.filter((e) => e.model === "claude-opus-5" && e.category === "coding");
|
||||
|
||||
assert.strictEqual(base.length, 1);
|
||||
assert.strictEqual(base[0].eloRaw, 1700);
|
||||
});
|
||||
|
||||
it("does not collapse generations (regression guard for the deleted alias map)", () => {
|
||||
const data = makeLeaderboardMap({
|
||||
text: [makeModelEntry({ model: "openai/gpt-5.5", score: 1600, votes: 5000, rank: 1 })],
|
||||
});
|
||||
|
||||
const entries = transformToModelIntelligence(data);
|
||||
const models = entries.map((e) => e.model);
|
||||
|
||||
assert.ok(models.includes("gpt-5.5"));
|
||||
assert.ok(!models.includes("gpt-5"), "gpt-5.5 must never emit a gpt-5 row");
|
||||
});
|
||||
|
||||
it("synthesizes nothing when the stripped base is not a routable catalog id", () => {
|
||||
// Catalog-anchored by construction: assert the premise instead of a frozen catalog fact.
|
||||
assert.strictEqual(resolveScoresAs("grok-4.6-fast-high").via, null);
|
||||
|
||||
const data = makeLeaderboardMap({
|
||||
code: [makeModelEntry({ model: "grok-4.6-fast-high", score: 1600, votes: 5000, rank: 1 })],
|
||||
});
|
||||
|
||||
const entries = transformToModelIntelligence(data);
|
||||
const models = entries.map((e) => e.model);
|
||||
|
||||
assert.deepStrictEqual(models, ["grok-4.6-fast-high"]);
|
||||
});
|
||||
|
||||
it("is idempotent and emits no duplicate (model, category) keys", () => {
|
||||
const data = makeLeaderboardMap({
|
||||
code: [
|
||||
makeModelEntry({ model: "claude-opus-5-max", score: 1691, votes: 5000, rank: 1 }),
|
||||
makeModelEntry({ model: "claude-opus-5-high", score: 1663, votes: 5000, rank: 2 }),
|
||||
makeModelEntry({
|
||||
model: "gpt-5.6-sol-xhigh (codex-harness)",
|
||||
score: 1700,
|
||||
votes: 5000,
|
||||
rank: 3,
|
||||
}),
|
||||
],
|
||||
});
|
||||
|
||||
const first = transformToModelIntelligence(data);
|
||||
const second = transformToModelIntelligence(data);
|
||||
|
||||
const strip = (entries: ReturnType<typeof transformToModelIntelligence>) =>
|
||||
entries.map(({ expiresAt: _expiresAt, ...rest }) => rest);
|
||||
assert.deepStrictEqual(strip(second), strip(first));
|
||||
|
||||
const keys = first.map((e) => `${e.model}|${e.category}`);
|
||||
assert.strictEqual(new Set(keys).size, keys.length);
|
||||
});
|
||||
});
|
||||
|
||||
// ═══════════════════════════════════════════════════════════
|
||||
// 3. fetchArenaLeaderboards()
|
||||
// ═══════════════════════════════════════════════════════════
|
||||
@@ -693,7 +821,7 @@ describe("syncArenaElo()", () => {
|
||||
assert.ok(status.lastSyncModelCount > 0);
|
||||
});
|
||||
|
||||
it("model aliases are stored in DB alongside canonical names", async () => {
|
||||
it("stores no cross-generation alias rows in the DB (MODEL_ALIAS_MAP removed, #11504)", async () => {
|
||||
const textData = makeLeaderboardData(
|
||||
[
|
||||
makeModelEntry({
|
||||
@@ -718,7 +846,7 @@ describe("syncArenaElo()", () => {
|
||||
const models = entries.map((e) => String(e.model));
|
||||
|
||||
assert.ok(models.includes("claude-opus-4-6-thinking"));
|
||||
assert.ok(models.includes("claude-opus-4"));
|
||||
assert.ok(!models.includes("claude-opus-4"));
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user