Skip to content

Commit 6b28668

Browse files
committed
test(plugins): cover retired google auth compatibility
1 parent 4ed30ab commit 6b28668

File tree

4 files changed

+80
-7
lines changed

4 files changed

+80
-7
lines changed

extensions/google/gemini-cli-provider.test.ts

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,33 @@ import googlePlugin from "./index.js";
88

99
function registerGooglePlugin(): {
1010
provider: ProviderPlugin;
11+
webSearchProvider: {
12+
id: string;
13+
envVars: string[];
14+
label: string;
15+
} | null;
1116
webSearchProviderRegistered: boolean;
1217
} {
1318
let provider: ProviderPlugin | undefined;
1419
let webSearchProviderRegistered = false;
20+
let webSearchProvider: {
21+
id: string;
22+
envVars: string[];
23+
label: string;
24+
} | null = null;
1525
googlePlugin.register({
1626
registerProvider(nextProvider: ProviderPlugin) {
1727
provider = nextProvider;
1828
},
19-
registerWebSearchProvider() {
29+
registerWebSearchProvider(nextProvider: { id: string; envVars: string[]; label: string }) {
2030
webSearchProviderRegistered = true;
31+
webSearchProvider = nextProvider;
2132
},
2233
} as never);
2334
if (!provider) {
2435
throw new Error("provider registration missing");
2536
}
26-
return { provider, webSearchProviderRegistered };
37+
return { provider, webSearchProviderRegistered, webSearchProvider };
2738
}
2839

2940
describe("google plugin", () => {
@@ -32,6 +43,11 @@ describe("google plugin", () => {
3243

3344
expect(result.provider.id).toBe("google-gemini-cli");
3445
expect(result.webSearchProviderRegistered).toBe(true);
46+
expect(result.webSearchProvider).toMatchObject({
47+
id: "gemini",
48+
label: "Gemini (Google Search)",
49+
envVars: ["GEMINI_API_KEY"],
50+
});
3551
});
3652

3753
it("owns gemini 3.1 forward-compat resolution", () => {

src/config/config.plugin-validation.test.ts

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,47 @@ describe("config plugin validation", () => {
281281
}
282282
});
283283

284+
it("warns for removed google gemini auth plugin ids instead of failing validation", async () => {
285+
const removedId = "google-gemini-cli-auth";
286+
const res = validateInSuite({
287+
agents: { list: [{ id: "pi" }] },
288+
plugins: {
289+
enabled: false,
290+
entries: { [removedId]: { enabled: true } },
291+
allow: [removedId],
292+
deny: [removedId],
293+
slots: { memory: removedId },
294+
},
295+
});
296+
expect(res.ok).toBe(true);
297+
if (res.ok) {
298+
expect(res.warnings).toEqual(
299+
expect.arrayContaining([
300+
{
301+
path: `plugins.entries.${removedId}`,
302+
message:
303+
"plugin removed: google-gemini-cli-auth (stale config entry ignored; remove it from plugins config)",
304+
},
305+
{
306+
path: "plugins.allow",
307+
message:
308+
"plugin removed: google-gemini-cli-auth (stale config entry ignored; remove it from plugins config)",
309+
},
310+
{
311+
path: "plugins.deny",
312+
message:
313+
"plugin removed: google-gemini-cli-auth (stale config entry ignored; remove it from plugins config)",
314+
},
315+
{
316+
path: "plugins.slots.memory",
317+
message:
318+
"plugin removed: google-gemini-cli-auth (stale config entry ignored; remove it from plugins config)",
319+
},
320+
]),
321+
);
322+
}
323+
});
324+
284325
it("surfaces plugin config diagnostics", async () => {
285326
const res = validateInSuite({
286327
agents: { list: [{ id: "pi" }] },

src/config/validation.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import { findLegacyConfigIssues } from "./legacy.js";
2424
import type { OpenClawConfig, ConfigValidationIssue } from "./types.js";
2525
import { OpenClawSchema } from "./zod-schema.js";
2626

27-
const LEGACY_REMOVED_PLUGIN_IDS = new Set(["google-antigravity-auth"]);
27+
const LEGACY_REMOVED_PLUGIN_IDS = new Set(["google-antigravity-auth", "google-gemini-cli-auth"]);
2828

2929
type UnknownIssueRecord = Record<string, unknown>;
3030
type AllowedValuesCollection = {

src/plugins/providers.test.ts

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ describe("resolvePluginProviders", () => {
1111
beforeEach(() => {
1212
loadOpenClawPluginsMock.mockReset();
1313
loadOpenClawPluginsMock.mockReturnValue({
14-
providers: [{ provider: { id: "demo-provider" } }],
14+
providers: [{ pluginId: "google", provider: { id: "demo-provider" } }],
1515
});
1616
});
1717

@@ -23,7 +23,7 @@ describe("resolvePluginProviders", () => {
2323
env,
2424
});
2525

26-
expect(providers).toEqual([{ id: "demo-provider" }]);
26+
expect(providers).toEqual([{ id: "demo-provider", pluginId: "google" }]);
2727
expect(loadOpenClawPluginsMock).toHaveBeenCalledWith(
2828
expect.objectContaining({
2929
workspaceDir: "/workspace/explicit",
@@ -46,13 +46,12 @@ describe("resolvePluginProviders", () => {
4646
expect.objectContaining({
4747
config: expect.objectContaining({
4848
plugins: expect.objectContaining({
49-
allow: expect.arrayContaining(["openrouter", "kilocode", "moonshot"]),
49+
allow: expect.arrayContaining(["openrouter", "google", "kilocode", "moonshot"]),
5050
}),
5151
}),
5252
}),
5353
);
5454
});
55-
5655
it("can enable bundled provider plugins under Vitest when no explicit plugin config exists", () => {
5756
resolvePluginProviders({
5857
env: { VITEST: "1" } as NodeJS.ProcessEnv,
@@ -70,4 +69,21 @@ describe("resolvePluginProviders", () => {
7069
}),
7170
);
7271
});
72+
73+
it("does not reintroduce the retired google auth plugin id into compat allowlists", () => {
74+
resolvePluginProviders({
75+
config: {
76+
plugins: {
77+
allow: ["openrouter"],
78+
},
79+
},
80+
bundledProviderAllowlistCompat: true,
81+
});
82+
83+
const call = loadOpenClawPluginsMock.mock.calls.at(-1)?.[0];
84+
const allow = call?.config?.plugins?.allow;
85+
86+
expect(allow).toContain("google");
87+
expect(allow).not.toContain("google-gemini-cli-auth");
88+
});
7389
});

0 commit comments

Comments
 (0)