diff --git a/src/config/config-misc.test.ts b/src/config/config-misc.test.ts index e31f76b0a35..451daddc114 100644 --- a/src/config/config-misc.test.ts +++ b/src/config/config-misc.test.ts @@ -760,135 +760,6 @@ describe("config strict validation", () => { }); }); - it("accepts legacy x_search auth via auto-migration and reports legacyIssues", async () => { - await withTempHome(async (home) => { - await writeOpenClawConfig(home, { - tools: { - web: { - x_search: { - apiKey: "test-key", - }, - }, - }, - }); - - const snap = await readConfigFileSnapshot(); - - expect(snap.valid).toBe(true); - expect(snap.legacyIssues.some((issue) => issue.path === "tools.web.x_search.apiKey")).toBe( - true, - ); - expect(snap.sourceConfig.plugins?.entries?.xai?.config?.webSearch).toMatchObject({ - apiKey: "test-key", - }); - expect( - (snap.sourceConfig.tools?.web?.x_search as Record | undefined)?.apiKey, - ).toBeUndefined(); - }); - }); - - it("accepts legacy x_search SecretRefs via auto-migration and reports legacyIssues", async () => { - await withTempHome(async (home) => { - await writeOpenClawConfig(home, { - tools: { - web: { - x_search: { - apiKey: { - source: "env", - provider: "default", - id: "X_SEARCH_KEY_REF", - }, - }, - }, - }, - }); - - const snap = await readConfigFileSnapshot(); - - expect(snap.valid).toBe(true); - expect(snap.legacyIssues.some((issue) => issue.path === "tools.web.x_search.apiKey")).toBe( - true, - ); - expect(snap.sourceConfig.plugins?.entries?.xai?.config?.webSearch).toMatchObject({ - apiKey: { - source: "env", - provider: "default", - id: "X_SEARCH_KEY_REF", - }, - }); - expect( - (snap.sourceConfig.tools?.web?.x_search as Record | undefined)?.apiKey, - ).toBeUndefined(); - }); - }); - - it("accepts legacy thread binding ttlHours via auto-migration and reports legacyIssues", () => { - const raw = { - session: { - threadBindings: { - ttlHours: 24, - }, - }, - channels: { - discord: { - threadBindings: { - ttlHours: 12, - }, - accounts: { - alpha: { - threadBindings: { - ttlHours: 6, - }, - }, - }, - }, - }, - }; - const issues = findLegacyConfigIssues(raw); - const migrated = applyRuntimeLegacyConfigMigrations(raw); - - expect(issues.some((issue) => issue.path === "session.threadBindings")).toBe(true); - expect(issues.some((issue) => issue.path === "channels")).toBe(true); - expect(migrated.next).not.toBeNull(); - - const next = migrated.next as { - session?: { - threadBindings?: { - idleHours?: number; - ttlHours?: unknown; - }; - }; - channels?: { - discord?: { - threadBindings?: { - idleHours?: number; - ttlHours?: unknown; - }; - accounts?: { - alpha?: { - threadBindings?: { - idleHours?: number; - ttlHours?: unknown; - }; - }; - }; - }; - }; - } | null; - expect(next?.session?.threadBindings).toMatchObject({ - idleHours: 24, - }); - expect(next?.channels?.discord?.threadBindings).toMatchObject({ - idleHours: 12, - }); - expect(next?.channels?.discord?.accounts?.alpha?.threadBindings).toMatchObject({ - idleHours: 6, - }); - expect(next?.session?.threadBindings?.ttlHours).toBeUndefined(); - expect(next?.channels?.discord?.threadBindings?.ttlHours).toBeUndefined(); - expect(next?.channels?.discord?.accounts?.alpha?.threadBindings?.ttlHours).toBeUndefined(); - }); - it("accepts legacy channel streaming aliases via auto-migration and reports legacyIssues", () => { const raw = { channels: {