惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Blog — PlanetScale
Blog — PlanetScale
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Vercel News
Vercel News
B
Blog
腾讯CDC
P
Proofpoint News Feed
Google DeepMind News
Google DeepMind News
N
Netflix TechBlog - Medium
L
LangChain Blog
F
Fortinet All Blogs
T
The Blog of Author Tim Ferriss
人人都是产品经理
人人都是产品经理
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
I
InfoQ
IT之家
IT之家
酷 壳 – CoolShell
酷 壳 – CoolShell
aimingoo的专栏
aimingoo的专栏
D
DataBreaches.Net
Stack Overflow Blog
Stack Overflow Blog
The Cloudflare Blog
Last Week in AI
Last Week in AI
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
博客园 - 三生石上(FineUI控件)
T
Tailwind CSS Blog

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
test: clear auth-choice plugin provider broad matchers · ...
steipete · 2026-05-11 · via Recent Commits to openclaw:main

@@ -56,6 +56,38 @@ function createRuntime() {

5656

};

5757

}

585859+

type MockCalls = { mock: { calls: Array<Array<unknown>> } };

60+61+

function mockCall(mock: MockCalls, callIndex = 0): Array<unknown> {

62+

const call = mock.mock.calls[callIndex];

63+

if (!call) {

64+

throw new Error(`expected mock call ${callIndex}`);

65+

}

66+

return call;

67+

}

68+69+

function mockArg(mock: MockCalls, callIndex = 0, argIndex = 0): Record<string, unknown> {

70+

const arg = mockCall(mock, callIndex)[argIndex];

71+

if (!arg || typeof arg !== "object") {

72+

throw new Error(`expected mock arg at call ${callIndex}, arg ${argIndex}`);

73+

}

74+

return arg as Record<string, unknown>;

75+

}

76+77+

function expectWorkspaceDir(value: unknown) {

78+

expect(typeof value).toBe("string");

79+

expect((value as string).length).toBeGreaterThan(0);

80+

}

81+82+

function expectConfigDefaults(value: unknown) {

83+

const config = value as { agents?: unknown };

84+

expect(config.agents).toEqual({ defaults: {} });

85+

}

86+87+

function expectRuntimeErrorIncludes(runtime: ReturnType<typeof createRuntime>, text: string) {

88+

expect(runtime.error.mock.calls.some(([message]) => String(message).includes(text))).toBe(true);

89+

}

90+5991

describe("applyNonInteractivePluginProviderChoice", () => {

6092

it("loads plugin providers for provider-plugin auth choices", async () => {

6193

const runtime = createRuntime();

@@ -79,18 +111,11 @@ describe("applyNonInteractivePluginProviderChoice", () => {

7911180112

expect(resolveOwningPluginIdsForProvider).toHaveBeenCalledOnce();

81113

expect(resolvePreferredProviderForAuthChoice).not.toHaveBeenCalled();

82-

expect(resolveOwningPluginIdsForProvider).toHaveBeenCalledWith(

83-

expect.objectContaining({

84-

provider: "vllm",

85-

}),

86-

);

114+

expect(mockArg(resolveOwningPluginIdsForProvider).provider).toBe("vllm");

87115

expect(resolvePluginProviders).toHaveBeenCalledOnce();

88-

expect(resolvePluginProviders).toHaveBeenCalledWith(

89-

expect.objectContaining({

90-

onlyPluginIds: ["vllm"],

91-

includeUntrustedWorkspacePlugins: false,

92-

}),

93-

);

116+

const providersInput = mockArg(resolvePluginProviders);

117+

expect(providersInput.onlyPluginIds).toEqual(["vllm"]);

118+

expect(providersInput.includeUntrustedWorkspacePlugins).toBe(false);

94119

expect(resolveProviderPluginChoice).toHaveBeenCalledOnce();

95120

expect(runNonInteractive).toHaveBeenCalledOnce();

96121

expect(result).toEqual({ plugins: { allow: ["vllm"] } });

@@ -111,10 +136,9 @@ describe("applyNonInteractivePluginProviderChoice", () => {

111136112137

expect(result).toBeNull();

113138

expect(resolvePreferredProviderForAuthChoice).not.toHaveBeenCalled();

114-

expect(runtime.error).toHaveBeenCalledWith(

115-

expect.stringContaining(

116-

'Auth choice "provider-plugin:workspace-provider:api-key" was not matched to a trusted provider plugin.',

117-

),

139+

expectRuntimeErrorIncludes(

140+

runtime,

141+

'Auth choice "provider-plugin:workspace-provider:api-key" was not matched to a trusted provider plugin.',

118142

);

119143

expect(runtime.exit).toHaveBeenCalledWith(1);

120144

});

@@ -138,33 +162,22 @@ describe("applyNonInteractivePluginProviderChoice", () => {

138162

});

139163140164

expect(result).toBeNull();

141-

expect(runtime.error).toHaveBeenCalledWith(

142-

expect.stringContaining(

143-

'Auth choice "workspace-provider-api-key" matched a provider plugin that is not trusted or enabled for setup.',

144-

),

165+

expectRuntimeErrorIncludes(

166+

runtime,

167+

'Auth choice "workspace-provider-api-key" matched a provider plugin that is not trusted or enabled for setup.',

145168

);

146169

expect(runtime.exit).toHaveBeenCalledWith(1);

147-

expect(resolvePluginProviders).toHaveBeenCalledWith(

148-

expect.objectContaining({

149-

includeUntrustedWorkspacePlugins: false,

150-

}),

151-

);

170+

expect(mockArg(resolvePluginProviders).includeUntrustedWorkspacePlugins).toBe(false);

152171

expect(resolveProviderPluginChoice).toHaveBeenCalledTimes(1);

153172

expect(resolvePluginProviders).toHaveBeenCalledTimes(1);

154-

expect(resolveManifestProviderAuthChoice).toHaveBeenCalledWith(

155-

"workspace-provider-api-key",

156-

expect.objectContaining({

157-

includeUntrustedWorkspacePlugins: false,

158-

}),

159-

);

160-

expect(resolveManifestProviderAuthChoice).toHaveBeenCalledWith(

161-

"workspace-provider-api-key",

162-

expect.objectContaining({

163-

config: expect.objectContaining({ agents: { defaults: {} } }),

164-

workspaceDir: expect.any(String),

165-

includeUntrustedWorkspacePlugins: true,

166-

}),

167-

);

173+

expect(mockCall(resolveManifestProviderAuthChoice, 0)[0]).toBe("workspace-provider-api-key");

174+

const trustedManifestInput = mockArg(resolveManifestProviderAuthChoice, 0, 1);

175+

expect(trustedManifestInput.includeUntrustedWorkspacePlugins).toBe(false);

176+

expect(mockCall(resolveManifestProviderAuthChoice, 1)[0]).toBe("workspace-provider-api-key");

177+

const untrustedManifestInput = mockArg(resolveManifestProviderAuthChoice, 1, 1);

178+

expectConfigDefaults(untrustedManifestInput.config);

179+

expectWorkspaceDir(untrustedManifestInput.workspaceDir);

180+

expect(untrustedManifestInput.includeUntrustedWorkspacePlugins).toBe(true);

168181

});

169182170183

it("limits setup-provider resolution to owning plugin ids without pre-enabling them", async () => {

@@ -189,13 +202,10 @@ describe("applyNonInteractivePluginProviderChoice", () => {

189202

toApiKeyCredential: vi.fn(),

190203

});

191204192-

expect(resolvePluginProviders).toHaveBeenCalledWith(

193-

expect.objectContaining({

194-

config: expect.objectContaining({ agents: { defaults: {} } }),

195-

onlyPluginIds: ["demo-plugin"],

196-

includeUntrustedWorkspacePlugins: false,

197-

}),

198-

);

205+

const providersInput = mockArg(resolvePluginProviders);

206+

expectConfigDefaults(providersInput.config);

207+

expect(providersInput.onlyPluginIds).toEqual(["demo-plugin"]);

208+

expect(providersInput.includeUntrustedWorkspacePlugins).toBe(false);

199209

expect(runNonInteractive).toHaveBeenCalledOnce();

200210

expect(result).toEqual({ plugins: { allow: ["demo-plugin"] } });

201211

});

@@ -214,17 +224,10 @@ describe("applyNonInteractivePluginProviderChoice", () => {

214224

toApiKeyCredential: vi.fn(),

215225

});

216226217-

expect(resolvePreferredProviderForAuthChoice).toHaveBeenCalledWith(

218-

expect.objectContaining({

219-

choice: "openai-api-key",

220-

includeUntrustedWorkspacePlugins: false,

221-

}),

222-

);

223-

expect(resolvePluginProviders).toHaveBeenCalledWith(

224-

expect.objectContaining({

225-

includeUntrustedWorkspacePlugins: false,

226-

}),

227-

);

227+

const preferenceInput = mockArg(resolvePreferredProviderForAuthChoice);

228+

expect(preferenceInput.choice).toBe("openai-api-key");

229+

expect(preferenceInput.includeUntrustedWorkspacePlugins).toBe(false);

230+

expect(mockArg(resolvePluginProviders).includeUntrustedWorkspacePlugins).toBe(false);

228231

});

229232230233

it("ensures Codex after a non-interactive OpenAI provider choice sets the default model", async () => {

@@ -260,14 +263,11 @@ describe("applyNonInteractivePluginProviderChoice", () => {

260263

});

261264262265

expect(runNonInteractive).toHaveBeenCalledOnce();

263-

expect(ensureCodexRuntimePluginForModelSelection).toHaveBeenCalledWith(

264-

expect.objectContaining({

265-

cfg: selectedConfig,

266-

model: "openai/gpt-5.5",

267-

runtime,

268-

workspaceDir: expect.any(String),

269-

}),

270-

);

266+

const ensureInput = mockArg(ensureCodexRuntimePluginForModelSelection);

267+

expect(ensureInput.cfg).toBe(selectedConfig);

268+

expect(ensureInput.model).toBe("openai/gpt-5.5");

269+

expect(ensureInput.runtime).toBe(runtime);

270+

expectWorkspaceDir(ensureInput.workspaceDir);

271271

expect(result).toBe(installedConfig);

272272

});

273273

});