diff --git a/extensions/anthropic/provider-policy-api.test.ts b/extensions/anthropic/provider-policy-api.test.ts index 49e6fd8ec79..3b6ff1873b3 100644 --- a/extensions/anthropic/provider-policy-api.test.ts +++ b/extensions/anthropic/provider-policy-api.test.ts @@ -23,6 +23,16 @@ function createModel(id: string, name: string): ModelDefinitionConfig { }; } +function collectLegacyExtendedLevelIds(levels: readonly { id: string }[] | undefined): string[] { + const ids: string[] = []; + for (const level of levels ?? []) { + if (level.id === "xhigh" || level.id === "max") { + ids.push(level.id); + } + } + return ids; +} + describe("anthropic provider policy public artifact", () => { it("normalizes Anthropic provider config", () => { expect( @@ -117,9 +127,7 @@ describe("anthropic provider policy public artifact", () => { if (!profile) { throw new Error("Expected Anthropic policy profile"); } - expect( - profile.levels.map((level) => level.id).filter((id) => id === "xhigh" || id === "max"), - ).toEqual([]); + expect(collectLegacyExtendedLevelIds(profile.levels)).toEqual([]); }); it("does not expose Anthropic thinking profiles for unrelated providers", () => { diff --git a/extensions/opencode/provider-policy-api.test.ts b/extensions/opencode/provider-policy-api.test.ts index 4877c1a70d2..4f02914f247 100644 --- a/extensions/opencode/provider-policy-api.test.ts +++ b/extensions/opencode/provider-policy-api.test.ts @@ -1,6 +1,16 @@ import { describe, expect, it } from "vitest"; import { resolveThinkingProfile } from "./provider-policy-api.js"; +function collectLegacyExtendedLevelIds(levels: readonly { id: string }[] | undefined): string[] { + const ids: string[] = []; + for (const level of levels ?? []) { + if (level.id === "xhigh" || level.id === "max") { + ids.push(level.id); + } + } + return ids; +} + describe("opencode provider policy public artifact", () => { it("exposes Claude Opus 4.7 thinking levels without loading the full provider plugin", () => { expect( @@ -24,8 +34,6 @@ describe("opencode provider policy public artifact", () => { levels: expect.arrayContaining([{ id: "adaptive" }]), defaultLevel: "adaptive", }); - expect( - profile.levels.map((level) => level.id).filter((id) => id === "xhigh" || id === "max"), - ).toEqual([]); + expect(collectLegacyExtendedLevelIds(profile.levels)).toEqual([]); }); }); diff --git a/extensions/vercel-ai-gateway/thinking.test.ts b/extensions/vercel-ai-gateway/thinking.test.ts index 58a3d60cb88..54fafefcfb1 100644 --- a/extensions/vercel-ai-gateway/thinking.test.ts +++ b/extensions/vercel-ai-gateway/thinking.test.ts @@ -5,6 +5,16 @@ import { import { describe, expect, it } from "vitest"; import plugin from "./index.js"; +function collectLegacyExtendedLevelIds(levels: readonly { id: string }[] | undefined): string[] { + const ids: string[] = []; + for (const level of levels ?? []) { + if (level.id === "xhigh" || level.id === "max") { + ids.push(level.id); + } + } + return ids; +} + describe("vercel ai gateway thinking profile", () => { async function getProvider() { const { providers } = await registerProviderPlugin({ @@ -49,9 +59,7 @@ describe("vercel ai gateway thinking profile", () => { levels: expect.arrayContaining([{ id: "adaptive" }]), defaultLevel: "adaptive", }); - expect( - profile?.levels.map((level) => level.id).filter((id) => id === "xhigh" || id === "max"), - ).toEqual([]); + expect(collectLegacyExtendedLevelIds(profile?.levels)).toEqual([]); }); it("falls through for unsupported OpenAI or untrusted namespaced refs", async () => {