diff --git a/src/core/config/__tests__/routerRemoval.spec.ts b/src/core/config/__tests__/routerRemoval.spec.ts new file mode 100644 index 0000000000..9c98661d2b --- /dev/null +++ b/src/core/config/__tests__/routerRemoval.spec.ts @@ -0,0 +1,38 @@ +import { retiredProviderIdentifiers } from "@roo-code/types" + +import { downgradeLegacyRooConfig, isLegacyRooConfig, LEGACY_ROO_PROVIDER } from "../routerRemoval" + +describe("routerRemoval", () => { + it("uses the canonical retired Roo provider identifier without changing its persisted value", () => { + expect(LEGACY_ROO_PROVIDER).toBe(retiredProviderIdentifiers.roo) + expect(LEGACY_ROO_PROVIDER).toBe("roo") + }) + + it("continues to recognize and downgrade persisted Roo provider settings", () => { + const persistedConfig = { + apiProvider: retiredProviderIdentifiers.roo, + apiModelId: "roo/code-supernova", + rooApiKey: "legacy-key", + customSetting: "preserved", + } + + expect(isLegacyRooConfig(persistedConfig)).toBe(true) + expect(downgradeLegacyRooConfig(persistedConfig)).toEqual({ + config: { customSetting: "preserved" }, + migrated: true, + }) + }) + + it("leaves non-Roo retired provider settings unchanged", () => { + const persistedConfig = { + apiProvider: retiredProviderIdentifiers.groq, + apiModelId: "legacy-model", + } + + expect(isLegacyRooConfig(persistedConfig)).toBe(false) + expect(downgradeLegacyRooConfig(persistedConfig)).toEqual({ + config: persistedConfig, + migrated: false, + }) + }) +}) diff --git a/src/core/config/routerRemoval.ts b/src/core/config/routerRemoval.ts index a34143cc35..45d96c65d2 100644 --- a/src/core/config/routerRemoval.ts +++ b/src/core/config/routerRemoval.ts @@ -1,6 +1,8 @@ +import { retiredProviderIdentifiers } from "@roo-code/types" + import { t } from "../../i18n" -export const LEGACY_ROO_PROVIDER = "roo" +export const LEGACY_ROO_PROVIDER = retiredProviderIdentifiers.roo const ROUTER_REMOVAL_I18N_KEY = "common:errors.roo.routerRemoved" const ROUTER_REMOVAL_DEFAULT_MESSAGE =