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

推荐订阅源

云风的 BLOG
云风的 BLOG
M
MIT News - Artificial intelligence
Recent Announcements
Recent Announcements
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Stack Overflow Blog
Stack Overflow Blog
J
Java Code Geeks
Microsoft Azure Blog
Microsoft Azure Blog
罗磊的独立博客
博客园 - 【当耐特】
H
Help Net Security
腾讯CDC
大猫的无限游戏
大猫的无限游戏
GbyAI
GbyAI
Last Week in AI
Last Week in AI
Jina AI
Jina AI
博客园 - 聂微东
Blog — PlanetScale
Blog — PlanetScale
A
About on SuperTechFans
Apple Machine Learning Research
Apple Machine Learning Research
P
Proofpoint News Feed
Y
Y Combinator Blog
C
Check Point 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: tighten matrix monitor handler assertions · opencla...
steipete · 2026-05-11 · via Recent Commits to openclaw:main

@@ -173,12 +173,29 @@ function expectNoticeSent(mock: unknown) {

173173

expect(String(message.body)).toContain("channels.matrix.dm.sessionScope");

174174

}

175175176+

function expectRuntimeErrorContaining(mock: unknown, text: string) {

177+

const matched = mockCalls(mock, "runtime error").some(([message]) =>

178+

String(message).includes(text),

179+

);

180+

expect(matched).toBe(true);

181+

}

182+176183

function findMockCall(mock: unknown, label: string, predicate: (call: Array<unknown>) => boolean) {

177184

const call = mockCalls(mock, label).find(predicate);

178185

expect(call, label).toBeDefined();

179186

return call as Array<unknown>;

180187

}

181188189+

function expectMatrixEdit(roomId: string, eventId: string, body: string) {

190+

const call = findMockCall(

191+

editMessageMatrixMock,

192+

`edit call for ${eventId}`,

193+

([room, editedEventId, editedBody]) =>

194+

room === roomId && editedEventId === eventId && editedBody === body,

195+

);

196+

expect(call[3], "edit options").toBeDefined();

197+

}

198+182199

function expectFinalizedPreviewEdit(eventId: string, text: string) {

183200

const call = findMockCall(

184201

editMessageMatrixMock,

@@ -709,7 +726,8 @@ describe("matrix monitor handler pairing account scope", () => {

709726

}),

710727

);

711728712-

expect(hasControlCommand).toHaveBeenCalledWith("/new", expect.anything());

729+

expect(callArg(hasControlCommand, 0, 0, "control command")).toBe("/new");

730+

expect(callArg(hasControlCommand, 0, 1, "control command")).toBeDefined();

713731

expect(recordInboundSession).not.toHaveBeenCalled();

714732

expect(finalizeInboundContext).not.toHaveBeenCalled();

715733

});

@@ -734,7 +752,8 @@ describe("matrix monitor handler pairing account scope", () => {

734752

}),

735753

);

736754737-

expect(hasControlCommand).toHaveBeenCalledWith("/new", expect.anything());

755+

expect(callArg(hasControlCommand, 0, 0, "control command")).toBe("/new");

756+

expect(callArg(hasControlCommand, 0, 1, "control command")).toBeDefined();

738757

const context = requireRecord(

739758

callArg(finalizeInboundContext, 0, 0, "finalized context"),

740759

"finalized context",

@@ -1060,7 +1079,8 @@ describe("matrix monitor handler pairing account scope", () => {

10601079

}),

10611080

);

106210811063-

expect(sendNotice).toHaveBeenCalledWith("!dm:example.org", expect.anything());

1082+

expect(callArg(sendNotice, 0, 0, "send notice")).toBe("!dm:example.org");

1083+

expect(callArg(sendNotice, 0, 1, "send notice")).toBeDefined();

10641084

expectNoticeSent(sendNotice);

1065108510661086

await handler(

@@ -1114,7 +1134,8 @@ describe("matrix monitor handler pairing account scope", () => {

11141134

}),

11151135

);

111611361117-

expect(sendNotice).toHaveBeenCalledWith("!dm:example.org", expect.anything());

1137+

expect(callArg(sendNotice, 0, 0, "send notice")).toBe("!dm:example.org");

1138+

expect(callArg(sendNotice, 0, 1, "send notice")).toBeDefined();

11181139

expectNoticeSent(sendNotice);

11191140

} finally {

11201141

fs.rmSync(tempDir, { recursive: true, force: true });

@@ -1166,7 +1187,8 @@ describe("matrix monitor handler pairing account scope", () => {

11661187

}),

11671188

);

116811891169-

expect(sendNotice).toHaveBeenCalledWith("!dm:example.org", expect.anything());

1190+

expect(callArg(sendNotice, 0, 0, "send notice")).toBe("!dm:example.org");

1191+

expect(callArg(sendNotice, 0, 1, "send notice")).toBeDefined();

11701192

expectNoticeSent(sendNotice);

11711193

} finally {

11721194

fs.rmSync(tempDir, { recursive: true, force: true });

@@ -1208,7 +1230,8 @@ describe("matrix monitor handler pairing account scope", () => {

12081230

}),

12091231

);

121012321211-

expect(sendNotice).toHaveBeenCalledWith("!dm:example.org", expect.anything());

1233+

expect(callArg(sendNotice, 0, 0, "send notice")).toBe("!dm:example.org");

1234+

expect(callArg(sendNotice, 0, 1, "send notice")).toBeDefined();

12121235

expectNoticeSent(sendNotice);

12131236

} finally {

12141237

fs.rmSync(tempDir, { recursive: true, force: true });

@@ -2373,7 +2396,7 @@ describe("matrix monitor handler durable inbound dedupe", () => {

23732396

roomId: "!room:example.org",

23742397

eventId: "$release-on-error",

23752398

});

2376-

expect(runtime.error).toHaveBeenCalledWith(expect.stringContaining("matrix handler failed"));

2399+

expectRuntimeErrorContaining(runtime.error, "matrix handler failed");

23772400

});

2378240123792402

it("keeps replay committed when queued final delivery fails after a generic error", async () => {

@@ -2418,9 +2441,7 @@ describe("matrix monitor handler durable inbound dedupe", () => {

24182441

eventId: "$release-on-final-delivery-error",

24192442

});

24202443

expect(inboundDeduper.releaseEvent).not.toHaveBeenCalled();

2421-

expect(runtime.error).toHaveBeenCalledWith(

2422-

expect.stringContaining("matrix final reply failed"),

2423-

);

2444+

expectRuntimeErrorContaining(runtime.error, "matrix final reply failed");

24242445

});

2425244624262447

it.each(["tool", "block"] as const)(

@@ -2471,9 +2492,7 @@ describe("matrix monitor handler durable inbound dedupe", () => {

24712492

eventId: `$release-on-${kind}-delivery-error`,

24722493

});

24732494

expect(inboundDeduper.releaseEvent).not.toHaveBeenCalled();

2474-

expect(runtime.error).toHaveBeenCalledWith(

2475-

expect.stringContaining(`matrix ${kind} reply failed`),

2476-

);

2495+

expectRuntimeErrorContaining(runtime.error, `matrix ${kind} reply failed`);

24772496

},

24782497

);

24792498

@@ -3016,12 +3035,7 @@ describe("matrix monitor handler draft streaming", () => {

30163035

opts.onPartialReply?.({ text: "AlphaBeta" });

30173036

await vi.waitFor(

30183037

() => {

3019-

expect(editMessageMatrixMock).toHaveBeenCalledWith(

3020-

"!room:example.org",

3021-

"$draft1",

3022-

"AlphaBeta",

3023-

expect.anything(),

3024-

);

3038+

expectMatrixEdit("!room:example.org", "$draft1", "AlphaBeta");

30253039

},

30263040

{ interval: 1 },

30273041

);

@@ -3043,12 +3057,7 @@ describe("matrix monitor handler draft streaming", () => {

30433057

{ interval: 1 },

30443058

);

30453059

expect(sendSingleTextMessageMatrixMock.mock.calls[0]?.[1]).toBe("Beta");

3046-

expect(editMessageMatrixMock).toHaveBeenCalledWith(

3047-

"!room:example.org",

3048-

"$draft1",

3049-

"Alpha",

3050-

expect.anything(),

3051-

);

3060+

expectMatrixEdit("!room:example.org", "$draft1", "Alpha");

30523061

expect(deliverMatrixRepliesMock).not.toHaveBeenCalled();

30533062

expect(redactEventMock).not.toHaveBeenCalled();

30543063

await finish();

@@ -3143,12 +3152,7 @@ describe("matrix monitor handler draft streaming", () => {

31433152

opts.onPartialReply?.({ text: "Beta" });

3144315331453154

await vi.waitFor(() => {

3146-

expect(editMessageMatrixMock).toHaveBeenCalledWith(

3147-

"!room:example.org",

3148-

"$draft1",

3149-

"Beta",

3150-

expect.anything(),

3151-

);

3155+

expectMatrixEdit("!room:example.org", "$draft1", "Beta");

31523156

});

3153315731543158

sendSingleTextMessageMatrixMock.mockClear();

@@ -3159,12 +3163,7 @@ describe("matrix monitor handler draft streaming", () => {

31593163

});

31603164

await deliver({ text: "Alpha" }, { kind: "block" });

316131653162-

expect(editMessageMatrixMock).toHaveBeenCalledWith(

3163-

"!room:example.org",

3164-

"$draft1",

3165-

"Alpha",

3166-

expect.anything(),

3167-

);

3166+

expectMatrixEdit("!room:example.org", "$draft1", "Alpha");

31683167

expect(deliverMatrixRepliesMock).not.toHaveBeenCalled();

31693168

expect(redactEventMock).not.toHaveBeenCalled();

31703169

await vi.waitFor(() => {

@@ -3194,12 +3193,7 @@ describe("matrix monitor handler draft streaming", () => {

31943193

opts.onPartialReply?.({ text: "Beta" });

3195319431963195

await vi.waitFor(() => {

3197-

expect(editMessageMatrixMock).toHaveBeenCalledWith(

3198-

"!room:example.org",

3199-

"$draft1",

3200-

"Beta",

3201-

expect.anything(),

3202-

);

3196+

expectMatrixEdit("!room:example.org", "$draft1", "Beta");

32033197

});

3204319832053199

sendSingleTextMessageMatrixMock.mockClear();

@@ -3210,12 +3204,7 @@ describe("matrix monitor handler draft streaming", () => {

32103204

});

32113205

await deliver({ text: "Alpha" }, { kind: "block" });

321232063213-

expect(editMessageMatrixMock).toHaveBeenCalledWith(

3214-

"!room:example.org",

3215-

"$draft1",

3216-

"Alpha",

3217-

expect.anything(),

3218-

);

3207+

expectMatrixEdit("!room:example.org", "$draft1", "Alpha");

32193208

expect(deliverMatrixRepliesMock).not.toHaveBeenCalled();

32203209

expect(redactEventMock).not.toHaveBeenCalled();

32213210

await vi.waitFor(() => {