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

推荐订阅源

J
Java Code Geeks
F
Fortinet All Blogs
云风的 BLOG
云风的 BLOG
MyScale Blog
MyScale Blog
D
DataBreaches.Net
Stack Overflow Blog
Stack Overflow Blog
A
About on SuperTechFans
Google DeepMind News
Google DeepMind News
Microsoft Security Blog
Microsoft Security Blog
腾讯CDC
The GitHub Blog
The GitHub Blog
Jina AI
Jina AI
B
Blog RSS Feed
I
InfoQ
N
Netflix TechBlog - Medium
T
The Blog of Author Tim Ferriss
Microsoft Azure Blog
Microsoft Azure Blog
Recent Announcements
Recent Announcements
GbyAI
GbyAI
H
Help Net Security
L
LangChain Blog
M
MIT News - Artificial intelligence
Y
Y Combinator Blog
aimingoo的专栏
aimingoo的专栏

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: tighten native approval runtime assertions · opencl...
steipete · 2026-05-11 · via Recent Commits to openclaw:main

@@ -20,6 +20,18 @@ afterEach(() => {

2020

vi.useRealTimers();

2121

});

222223+

function requireRecord(value: unknown): Record<string, unknown> {

24+

expect(value).toBeTruthy();

25+

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

26+

expect(Array.isArray(value)).toBe(false);

27+

return value as Record<string, unknown>;

28+

}

29+30+

function mockCallArg(mock: ReturnType<typeof vi.fn>, index = 0): Record<string, unknown> {

31+

const arg = mock.mock.calls[index]?.[0];

32+

return requireRecord(arg);

33+

}

34+2335

describe("deliverApprovalRequestViaChannelNativePlan", () => {

2436

it("dedupes converged prepared targets", async () => {

2537

const adapter: ChannelApprovalNativeAdapter = {

@@ -165,49 +177,52 @@ describe("createChannelNativeApprovalRuntime", () => {

165177

ts: 1,

166178

});

167179168-

expect(buildPendingContent).toHaveBeenCalledWith({

169-

request: expect.objectContaining({ id: "plugin:req-1" }),

170-

approvalKind: "plugin",

171-

nowMs: expect.any(Number),

172-

});

173-

expect(prepareTarget).toHaveBeenCalledWith({

174-

plannedTarget: {

175-

surface: "approver-dm",

176-

target: { to: "plugin:secondary" },

177-

reason: "preferred",

178-

},

179-

request: expect.objectContaining({ id: "plugin:req-1" }),

180-

approvalKind: "plugin",

181-

pendingContent: "pending plugin",

182-

});

183-

expect(deliverTarget).toHaveBeenCalledWith({

184-

plannedTarget: {

185-

surface: "approver-dm",

186-

target: { to: "plugin:secondary" },

187-

reason: "preferred",

188-

},

189-

preparedTarget: { chatId: "plugin:secondary" },

190-

request: expect.objectContaining({ id: "plugin:req-1" }),

191-

approvalKind: "plugin",

192-

pendingContent: "pending plugin",

193-

});

194-

expect(describeDeliveryCapabilities).toHaveBeenCalledWith({

195-

cfg: {} as never,

196-

accountId: "secondary",

197-

approvalKind: "plugin",

198-

request: expect.objectContaining({ id: "plugin:req-1" }),

180+

const pendingCall = mockCallArg(buildPendingContent);

181+

expect(requireRecord(pendingCall.request).id).toBe("plugin:req-1");

182+

expect(pendingCall.approvalKind).toBe("plugin");

183+

expect(typeof pendingCall.nowMs).toBe("number");

184+185+

const prepareCall = mockCallArg(prepareTarget);

186+

expect(prepareCall.plannedTarget).toEqual({

187+

surface: "approver-dm",

188+

target: { to: "plugin:secondary" },

189+

reason: "preferred",

199190

});

200-

expect(resolveApproverDmTargets).toHaveBeenCalledWith({

201-

cfg: {} as never,

202-

accountId: "secondary",

203-

approvalKind: "plugin",

204-

request: expect.objectContaining({ id: "plugin:req-1" }),

191+

expect(requireRecord(prepareCall.request).id).toBe("plugin:req-1");

192+

expect(prepareCall.approvalKind).toBe("plugin");

193+

expect(prepareCall.pendingContent).toBe("pending plugin");

194+195+

const deliverCall = mockCallArg(deliverTarget);

196+

expect(deliverCall.plannedTarget).toEqual({

197+

surface: "approver-dm",

198+

target: { to: "plugin:secondary" },

199+

reason: "preferred",

205200

});

206-

expect(finalizeResolved).toHaveBeenCalledWith({

207-

request: expect.objectContaining({ id: "plugin:req-1" }),

208-

resolved: expect.objectContaining({ id: "plugin:req-1", decision: "allow-once" }),

209-

entries: [{ chatId: "plugin:secondary", messageId: "m1" }],

201+

expect(deliverCall.preparedTarget).toEqual({ chatId: "plugin:secondary" });

202+

expect(requireRecord(deliverCall.request).id).toBe("plugin:req-1");

203+

expect(deliverCall.approvalKind).toBe("plugin");

204+

expect(deliverCall.pendingContent).toBe("pending plugin");

205+206+

const capabilitiesCall = mockCallArg(describeDeliveryCapabilities);

207+

expect(capabilitiesCall.cfg).toEqual({});

208+

expect(capabilitiesCall.accountId).toBe("secondary");

209+

expect(capabilitiesCall.approvalKind).toBe("plugin");

210+

expect(requireRecord(capabilitiesCall.request).id).toBe("plugin:req-1");

211+212+

const dmTargetsCall = mockCallArg(resolveApproverDmTargets);

213+

expect(dmTargetsCall.cfg).toEqual({});

214+

expect(dmTargetsCall.accountId).toBe("secondary");

215+

expect(dmTargetsCall.approvalKind).toBe("plugin");

216+

expect(requireRecord(dmTargetsCall.request).id).toBe("plugin:req-1");

217+218+

const resolvedCall = mockCallArg(finalizeResolved);

219+

expect(requireRecord(resolvedCall.request).id).toBe("plugin:req-1");

220+

expect(requireRecord(resolvedCall.resolved)).toEqual({

221+

id: "plugin:req-1",

222+

decision: "allow-once",

223+

ts: 1,

210224

});

225+

expect(resolvedCall.entries).toEqual([{ chatId: "plugin:secondary", messageId: "m1" }]);

211226

});

212227213228

it("runs expiration through the shared runtime factory", async () => {

@@ -252,10 +267,9 @@ describe("createChannelNativeApprovalRuntime", () => {

252267253268

await vi.advanceTimersByTimeAsync(60_000);

254269255-

expect(finalizeExpired).toHaveBeenCalledWith({

256-

request: expect.objectContaining({ id: "req-1" }),

257-

entries: [{ chatId: "owner", messageId: "m1" }],

258-

});

270+

const expiredCall = mockCallArg(finalizeExpired);

271+

expect(requireRecord(expiredCall.request).id).toBe("req-1");

272+

expect(expiredCall.entries).toEqual([{ chatId: "owner", messageId: "m1" }]);

259273

vi.useRealTimers();

260274

});

261275

});