From 01b919aeffca1aa2a49284b44e37d3be3ca8084e Mon Sep 17 00:00:00 2001 From: Vincent Koc Date: Fri, 19 Jun 2026 08:39:31 +0800 Subject: [PATCH] refactor(doctor): remove stale legacy path listers --- .../shared/legacy-web-fetch-migrate.test.ts | 21 +------------------ .../doctor/shared/legacy-web-fetch-migrate.ts | 10 --------- .../shared/legacy-x-search-migrate.test.ts | 19 +---------------- .../doctor/shared/legacy-x-search-migrate.ts | 9 -------- 4 files changed, 2 insertions(+), 57 deletions(-) diff --git a/src/commands/doctor/shared/legacy-web-fetch-migrate.test.ts b/src/commands/doctor/shared/legacy-web-fetch-migrate.test.ts index e0db5256d8c..4103ff5585e 100644 --- a/src/commands/doctor/shared/legacy-web-fetch-migrate.test.ts +++ b/src/commands/doctor/shared/legacy-web-fetch-migrate.test.ts @@ -1,10 +1,7 @@ // Legacy web-fetch migration tests cover doctor repair of old web fetch config. import { describe, expect, it } from "vitest"; import type { OpenClawConfig } from "../../../config/config.js"; -import { - listLegacyWebFetchConfigPaths, - migrateLegacyWebFetchConfig, -} from "./legacy-web-fetch-migrate.js"; +import { migrateLegacyWebFetchConfig } from "./legacy-web-fetch-migrate.js"; describe("legacy web fetch config", () => { it("migrates legacy Firecrawl fetch config into plugin-owned config", () => { @@ -68,20 +65,4 @@ describe("legacy web fetch config", () => { }); }); - it("lists legacy Firecrawl fetch config paths", () => { - expect( - listLegacyWebFetchConfigPaths({ - tools: { - web: { - fetch: { - firecrawl: { - apiKey: "firecrawl-key", - maxAgeMs: 123, - }, - }, - }, - }, - }), - ).toEqual(["tools.web.fetch.firecrawl.apiKey", "tools.web.fetch.firecrawl.maxAgeMs"]); - }); }); diff --git a/src/commands/doctor/shared/legacy-web-fetch-migrate.ts b/src/commands/doctor/shared/legacy-web-fetch-migrate.ts index 7bd9a598349..63f4b09ffcf 100644 --- a/src/commands/doctor/shared/legacy-web-fetch-migrate.ts +++ b/src/commands/doctor/shared/legacy-web-fetch-migrate.ts @@ -76,16 +76,6 @@ function migratePluginWebFetchConfig(params: { ); } -/** List legacy tools.web.fetch.firecrawl config paths present in raw config. */ -export function listLegacyWebFetchConfigPaths(raw: unknown): string[] { - const fetch = resolveLegacyFetchConfig(raw); - const firecrawl = fetch ? copyLegacyFirecrawlFetchConfig(fetch) : undefined; - if (!firecrawl) { - return []; - } - return Object.keys(firecrawl).map((key) => `tools.web.fetch.firecrawl.${key}`); -} - /** Move legacy Firecrawl web-fetch config into plugins.entries.firecrawl.config.webFetch. */ export function migrateLegacyWebFetchConfig(raw: T): { config: T; changes: string[] } { if (!isRecord(raw) || !hasMappedLegacyWebFetchConfig(raw)) { diff --git a/src/commands/doctor/shared/legacy-x-search-migrate.test.ts b/src/commands/doctor/shared/legacy-x-search-migrate.test.ts index 44e676e25cb..713b7734666 100644 --- a/src/commands/doctor/shared/legacy-x-search-migrate.test.ts +++ b/src/commands/doctor/shared/legacy-x-search-migrate.test.ts @@ -1,10 +1,7 @@ // Legacy X search migration tests cover doctor repair of old X search config. import { describe, expect, it } from "vitest"; import type { OpenClawConfig } from "../../../config/config.js"; -import { - listLegacyXSearchConfigPaths, - migrateLegacyXSearchConfig, -} from "./legacy-x-search-migrate.js"; +import { migrateLegacyXSearchConfig } from "./legacy-x-search-migrate.js"; describe("legacy x_search config migration", () => { it("moves only legacy x_search auth into the xai plugin config", () => { @@ -136,18 +133,4 @@ describe("legacy x_search config migration", () => { expect(res.config.plugins?.entries?.xai).toBeUndefined(); }); - it("lists legacy x_search paths", () => { - expect( - listLegacyXSearchConfigPaths({ - tools: { - web: { - x_search: { - apiKey: "xai-legacy-key", - enabled: false, - }, - } as Record, - }, - } as OpenClawConfig), - ).toEqual(["tools.web.x_search.apiKey"]); - }); }); diff --git a/src/commands/doctor/shared/legacy-x-search-migrate.ts b/src/commands/doctor/shared/legacy-x-search-migrate.ts index 1c1682877cb..af594e1cd5f 100644 --- a/src/commands/doctor/shared/legacy-x-search-migrate.ts +++ b/src/commands/doctor/shared/legacy-x-search-migrate.ts @@ -37,15 +37,6 @@ function resolveLegacyXSearchAuth(legacy: JsonRecord): unknown { return legacy.apiKey; } -/** List legacy tools.web.x_search auth config paths present in raw config. */ -export function listLegacyXSearchConfigPaths(raw: unknown): string[] { - const legacy = resolveLegacyXSearchConfig(raw); - if (!legacy || !Object.hasOwn(legacy, "apiKey")) { - return []; - } - return [`${X_SEARCH_LEGACY_PATH}.apiKey`]; -} - /** Move legacy X search API key config into plugins.entries.xai.config.webSearch. */ export function migrateLegacyXSearchConfig(raw: T): { config: T; changes: string[] } { if (!isRecord(raw)) {