refactor(doctor): remove stale legacy path listers

This commit is contained in:
Vincent Koc
2026-06-19 08:39:31 +08:00
parent c654641e0c
commit 01b919aeff
4 changed files with 2 additions and 57 deletions

View File

@@ -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"]);
});
});

View File

@@ -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<T>(raw: T): { config: T; changes: string[] } {
if (!isRecord(raw) || !hasMappedLegacyWebFetchConfig(raw)) {

View File

@@ -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<string, unknown>,
},
} as OpenClawConfig),
).toEqual(["tools.web.x_search.apiKey"]);
});
});

View File

@@ -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<T>(raw: T): { config: T; changes: string[] } {
if (!isRecord(raw)) {