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

推荐订阅源

WordPress大学
WordPress大学
H
Help Net Security
Jina AI
Jina AI
V
V2EX
G
Google Developers Blog
B
Blog
GbyAI
GbyAI
U
Unit 42
爱范儿
爱范儿
腾讯CDC
Engineering at Meta
Engineering at Meta
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园 - 三生石上(FineUI控件)
宝玉的分享
宝玉的分享
小众软件
小众软件
D
DataBreaches.Net
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - Franky
博客园 - 聂微东
The Cloudflare Blog
I
InfoQ
Microsoft Azure Blog
Microsoft Azure Blog
Hugging Face - Blog
Hugging Face - 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
fix(feishu): make manual setup the default · openclaw/ope...
steipete · 2026-05-11 · via Recent Commits to openclaw:main

@@ -8,7 +8,19 @@ import {

88

import { afterAll, beforeEach, describe, expect, it, vi } from "vitest";

99

import type { FeishuProbeResult } from "./types.js";

101011-

const { probeFeishuMock } = vi.hoisted(() => ({

11+

const {

12+

beginAppRegistrationMock,

13+

getAppOwnerOpenIdMock,

14+

initAppRegistrationMock,

15+

pollAppRegistrationMock,

16+

printQrCodeMock,

17+

probeFeishuMock,

18+

} = vi.hoisted(() => ({

19+

beginAppRegistrationMock: vi.fn(),

20+

getAppOwnerOpenIdMock: vi.fn(),

21+

initAppRegistrationMock: vi.fn(),

22+

pollAppRegistrationMock: vi.fn(),

23+

printQrCodeMock: vi.fn(),

1224

probeFeishuMock: vi.fn<() => Promise<FeishuProbeResult>>(async () => ({

1325

ok: false,

1426

error: "mocked",

@@ -20,13 +32,11 @@ vi.mock("./probe.js", () => ({

2032

}));

21332234

vi.mock("./app-registration.js", () => ({

23-

initAppRegistration: vi.fn(async () => {

24-

throw new Error("mocked: scan-to-create not available");

25-

}),

26-

beginAppRegistration: vi.fn(),

27-

pollAppRegistration: vi.fn(),

28-

printQrCode: vi.fn(async () => {}),

29-

getAppOwnerOpenId: vi.fn(async () => undefined),

35+

initAppRegistration: initAppRegistrationMock,

36+

beginAppRegistration: beginAppRegistrationMock,

37+

pollAppRegistration: pollAppRegistrationMock,

38+

printQrCode: printQrCodeMock,

39+

getAppOwnerOpenId: getAppOwnerOpenIdMock,

3040

}));

31413242

import { feishuPlugin } from "./channel.js";

@@ -86,6 +96,116 @@ describe("feishu setup wizard", () => {

8696

beforeEach(() => {

8797

probeFeishuMock.mockReset();

8898

probeFeishuMock.mockResolvedValue({ ok: false, error: "mocked" });

99+

initAppRegistrationMock.mockReset();

100+

initAppRegistrationMock.mockRejectedValue(new Error("mocked: scan-to-create not available"));

101+

beginAppRegistrationMock.mockReset();

102+

pollAppRegistrationMock.mockReset();

103+

printQrCodeMock.mockReset();

104+

printQrCodeMock.mockResolvedValue(undefined);

105+

getAppOwnerOpenIdMock.mockReset();

106+

getAppOwnerOpenIdMock.mockResolvedValue(undefined);

107+

});

108+109+

it("uses manual credentials by default instead of starting scan-to-create", async () => {

110+

const text = vi.fn().mockResolvedValueOnce("cli_manual").mockResolvedValueOnce("secret_manual");

111+

const prompter = createTestWizardPrompter({ text });

112+113+

const result = await runSetupWizardConfigure({

114+

configure: feishuConfigure,

115+

cfg: {} as never,

116+

prompter,

117+

runtime: createNonExitingRuntimeEnv(),

118+

});

119+120+

expect(initAppRegistrationMock).not.toHaveBeenCalled();

121+

expect(beginAppRegistrationMock).not.toHaveBeenCalled();

122+

expect(result.cfg.channels?.feishu).toMatchObject({

123+

appId: "cli_manual",

124+

appSecret: "secret_manual",

125+

connectionMode: "websocket",

126+

domain: "feishu",

127+

});

128+

});

129+130+

it("passes selected domain through scan-to-create and poll", async () => {

131+

initAppRegistrationMock.mockResolvedValueOnce(undefined);

132+

beginAppRegistrationMock.mockResolvedValueOnce({

133+

deviceCode: "device-code",

134+

qrUrl: "https://accounts.larksuite.com/qr",

135+

userCode: "user-code",

136+

interval: 1,

137+

expireIn: 10,

138+

});

139+

pollAppRegistrationMock.mockResolvedValueOnce({

140+

status: "success",

141+

result: {

142+

appId: "cli_lark",

143+

appSecret: "secret_lark",

144+

domain: "lark",

145+

openId: "ou_owner",

146+

},

147+

});

148+

const prompter = createTestWizardPrompter({

149+

select: vi

150+

.fn()

151+

.mockResolvedValueOnce("scan")

152+

.mockResolvedValueOnce("lark")

153+

.mockResolvedValueOnce("open") as never,

154+

});

155+156+

const result = await runSetupWizardConfigure({

157+

configure: feishuConfigure,

158+

cfg: {} as never,

159+

prompter,

160+

runtime: createNonExitingRuntimeEnv(),

161+

});

162+163+

expect(initAppRegistrationMock).toHaveBeenCalledWith("lark");

164+

expect(beginAppRegistrationMock).toHaveBeenCalledWith("lark");

165+

expect(pollAppRegistrationMock).toHaveBeenCalledWith(

166+

expect.objectContaining({

167+

deviceCode: "device-code",

168+

initialDomain: "lark",

169+

tp: "ob_cli_app",

170+

}),

171+

);

172+

expect(result.cfg.channels?.feishu).toMatchObject({

173+

appId: "cli_lark",

174+

appSecret: "secret_lark",

175+

domain: "lark",

176+

groupPolicy: "open",

177+

requireMention: true,

178+

});

179+

});

180+181+

it("falls back to manual credentials when selected scan-to-create is unavailable", async () => {

182+

const text = vi

183+

.fn()

184+

.mockResolvedValueOnce("cli_from_fallback")

185+

.mockResolvedValueOnce("secret_from_fallback");

186+

const prompter = createTestWizardPrompter({

187+

text,

188+

select: vi

189+

.fn()

190+

.mockResolvedValueOnce("scan")

191+

.mockResolvedValueOnce("feishu")

192+

.mockResolvedValueOnce("allowlist") as never,

193+

});

194+195+

const result = await runSetupWizardConfigure({

196+

configure: feishuConfigure,

197+

cfg: {} as never,

198+

prompter,

199+

runtime: createNonExitingRuntimeEnv(),

200+

});

201+202+

expect(initAppRegistrationMock).toHaveBeenCalledWith("feishu");

203+

expect(beginAppRegistrationMock).not.toHaveBeenCalled();

204+

expect(result.cfg.channels?.feishu).toMatchObject({

205+

appId: "cli_from_fallback",

206+

appSecret: "secret_from_fallback",

207+

domain: "feishu",

208+

});

89209

});

9021091211

it("prompts over SecretRef appId/appSecret config objects", async () => {