Files
OmniRoute/tests/unit/provider-registry-github-copilot-gpt-4.test.ts
backryun e755c5ac68 fix(providers): refresh GitHub Copilot catalog (#6154)
* fix(providers): refresh github copilot catalog

Limit GitHub Copilot discovery to the curated supported model set and keep the provider cooldown panel client-safe by moving countdown formatting out of localDb.

* chore(quality): rebaseline providerPageHelpers.ts file-size (+13, #6154 copilot catalog)

The GitHub Copilot catalog refresh grows the provider-page model-section helper
(1021->1034). Fast-path PR->release skips check:file-size, so the bump lands with
the PR. Justification recorded in file-size-baseline.json.

Co-authored-by: diegosouzapw <diegosouza.pw@gmail.com>

---------

Co-authored-by: diegosouzapw <diegosouza.pw@gmail.com>
2026-07-05 02:33:32 -03:00

60 lines
2.5 KiB
TypeScript

/**
* Curated GitHub Copilot GPT-4-family registry coverage.
*
* The final Copilot allowlist keeps `gpt-4-0125-preview` but intentionally drops
* the older bare `gpt-4` alias. GPT-4 Turbo is a chat/completions model — it
* must NOT use `openai-responses`.
*/
import test from "node:test";
import assert from "node:assert/strict";
const { REGISTRY } = await import("../../open-sse/config/providerRegistry.ts");
const { getModelsByProviderId, getProviderModel, isValidModel } =
await import("../../open-sse/config/providerModels.ts");
type ModelEntry = { id: string; name?: string; targetFormat?: string; [k: string]: unknown };
function githubModel(id: string): ModelEntry | undefined {
const provider = (REGISTRY as Record<string, { models?: ModelEntry[] }>)["github"];
return provider?.models?.find((m) => m.id === id);
}
test("github/gpt-4-0125-preview is registered under the gh provider", () => {
const model = githubModel("gpt-4-0125-preview");
assert.ok(model, "gpt-4-0125-preview must be registered under the github (gh) provider");
assert.equal(typeof model?.name, "string");
});
test("github/gpt-4-0125-preview routes via chat/completions (no openai-responses)", () => {
const model = githubModel("gpt-4-0125-preview");
assert.ok(model);
assert.notEqual(
model.targetFormat,
"openai-responses",
"GPT-4 Turbo on GitHub Copilot is a chat/completions model — Responses API would reject it"
);
});
test("getModelsByProviderId(github) exposes gpt-4-0125-preview", () => {
const models = getModelsByProviderId("github") as ModelEntry[];
const gpt4 = models.find((m) => m.id === "gpt-4-0125-preview");
assert.ok(gpt4, "gpt-4-0125-preview resolvable via getModelsByProviderId(github)");
});
test("gpt-4-0125-preview resolves through both the gh alias and the github id", () => {
// getProviderModel keys on the public alias; isValidModel mirrors it.
assert.ok(
getProviderModel("gh", "gpt-4-0125-preview"),
"getProviderModel('gh','gpt-4-0125-preview') must resolve"
);
assert.equal(
isValidModel("gh", "gpt-4-0125-preview"),
true,
"isValidModel('gh','gpt-4-0125-preview') must be true"
);
// Raw provider id resolves to the same entry via the alias map.
const viaId = getModelsByProviderId("github").find((m) => m.id === "gpt-4-0125-preview");
assert.ok(viaId, "gpt-4-0125-preview resolvable via the raw 'github' provider id");
assert.equal(isValidModel("gh", "gpt-4"), false, "bare gpt-4 is not in the curated list");
});