From 7d18e324b54891cec0d6b9ea6bc71f375160fa05 Mon Sep 17 00:00:00 2001 From: gubin-dev Date: Thu, 6 Aug 2026 00:17:45 +0300 Subject: [PATCH 1/2] refactor(providers): reuse retired Roo identifier --- .../config/__tests__/routerRemoval.spec.ts | 38 +++++++++++++++++++ src/core/config/routerRemoval.ts | 4 +- 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 src/core/config/__tests__/routerRemoval.spec.ts 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 = From 29bee5ec88a5ef24e7477aaac0c63bd37acff799 Mon Sep 17 00:00:00 2001 From: Elliott de Launay Date: Mon, 10 Aug 2026 02:07:01 +0000 Subject: [PATCH 2/2] test(providers): tighten retired Roo identifier regression spec --- src/core/config/__tests__/routerRemoval.spec.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/core/config/__tests__/routerRemoval.spec.ts b/src/core/config/__tests__/routerRemoval.spec.ts index 9c98661d2b..ebee4f8f6f 100644 --- a/src/core/config/__tests__/routerRemoval.spec.ts +++ b/src/core/config/__tests__/routerRemoval.spec.ts @@ -4,7 +4,6 @@ import { downgradeLegacyRooConfig, isLegacyRooConfig, LEGACY_ROO_PROVIDER } from 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") }) @@ -35,4 +34,10 @@ describe("routerRemoval", () => { migrated: false, }) }) + + it("rejects null and non-object input without throwing", () => { + expect(isLegacyRooConfig(null)).toBe(false) + expect(isLegacyRooConfig("roo")).toBe(false) + expect(isLegacyRooConfig({ apiProvider: "some-other-provider" })).toBe(false) + }) })