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

推荐订阅源

N
Netflix TechBlog - Medium
IT之家
IT之家
博客园_首页
Hugging Face - Blog
Hugging Face - Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
美团技术团队
小众软件
小众软件
博客园 - 叶小钗
WordPress大学
WordPress大学
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - 三生石上(FineUI控件)
罗磊的独立博客
博客园 - Franky
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Last Week in AI
Last Week in AI
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
有赞技术团队
有赞技术团队
T
Tailwind CSS Blog
宝玉的分享
宝玉的分享
博客园 - 【当耐特】
月光博客
月光博客
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
酷 壳 – CoolShell
酷 壳 – CoolShell
人人都是产品经理
人人都是产品经理

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: dedupe qa matrix mock reads · openclaw/openclaw@4c6...
steipete · 2026-05-13 · via Recent Commits to openclaw:main

@@ -163,18 +163,36 @@ type MockCallSource = {

163163

};

164164

};

165165166+

function mockCall(source: MockCallSource, label: string, callIndex = 0) {

167+

const calls = source.mock.calls;

168+

const resolvedIndex = callIndex < 0 ? calls.length + callIndex : callIndex;

169+

const call = calls[resolvedIndex];

170+

if (!call) {

171+

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

172+

}

173+

return call;

174+

}

175+166176

function mockObjectArg(source: MockCallSource, label: string, callIndex = 0, argIndex = 0) {

167-

const arg = source.mock.calls[callIndex]?.[argIndex];

177+

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

168178

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

169179

throw new Error(`expected ${label} object arg`);

170180

}

171181

return arg as Record<string, unknown>;

172182

}

173183184+

function lastMockObjectArg(source: MockCallSource, label: string, argIndex = 0) {

185+

return mockObjectArg(source, label, -1, argIndex);

186+

}

187+174188

function mockMessageBody(source: MockCallSource, label: string, callIndex = 0) {

175189

return String(mockObjectArg(source, label, callIndex).body);

176190

}

177191192+

function lastMockMessageBody(source: MockCallSource, label: string) {

193+

return mockMessageBody(source, label, -1);

194+

}

195+178196

function expectSentTextMessage(

179197

source: MockCallSource,

180198

expected: {

@@ -640,7 +658,7 @@ describe("matrix live qa scenarios", () => {

640658

expect(artifacts.reactionEventId).toBe("$driver-approval-reaction");

641659

expect(artifacts.reactionTargetEventId).toBe(approvalEventId);

642660

expect(waitForRoomEvent).toHaveBeenCalledTimes(3);

643-

expect(gatewayCall.mock.calls.at(-1)?.[0]).toBe("exec.approval.waitDecision");

661+

expect(mockCall(gatewayCall, "gatewayCall", -1)[0]).toBe("exec.approval.waitDecision");

644662

});

645663646664

it("reuses observed Matrix approval events across channel and DM target=both waits", async () => {

@@ -741,10 +759,9 @@ describe("matrix live qa scenarios", () => {

741759

expect(artifacts.approvals?.[1]?.roomId).toBe("!driver-shared-dm:matrix-qa.test");

742760743761

expect(waitForRoomEvent).toHaveBeenCalledTimes(1);

744-

expect(gatewayCall.mock.calls.at(-1)?.[0]).toBe("exec.approval.resolve");

745-

expect((gatewayCall.mock.calls.at(-1)?.[2] as { expectFinal?: unknown }).expectFinal).toBe(

746-

false,

747-

);

762+

const finalGatewayCall = mockCall(gatewayCall, "gatewayCall", -1);

763+

expect(finalGatewayCall[0]).toBe("exec.approval.resolve");

764+

expect((finalGatewayCall[2] as { expectFinal?: unknown }).expectFinal).toBe(false);

748765

expect(createMatrixQaClient).toHaveBeenCalledTimes(3);

749766

});

750767

@@ -1421,7 +1438,7 @@ describe("matrix live qa scenarios", () => {

14211438

since: `${params.roomId}:no-reply`,

14221439

}));

14231440

const waitForRoomEvent = vi.fn().mockImplementation(async (params) => {

1424-

const sentBody = String(sendTextMessage.mock.calls.at(-1)?.[0]?.body ?? "");

1441+

const sentBody = lastMockMessageBody(sendTextMessage, "sendTextMessage");

14251442

const token = sentBody

14261443

.replace("@sut:matrix-qa.test reply with only this exact marker: ", "")

14271444

.replace("reply with only this exact marker: ", "");

@@ -1503,8 +1520,12 @@ describe("matrix live qa scenarios", () => {

15031520

"@sut:matrix-qa.test",

15041521

]);

15051522

expect(mockObjectArg(sendTextMessage, "sendTextMessage").roomId).toBe("!main:matrix-qa.test");

1506-

expect(sendTextMessage.mock.calls.at(1)?.[0]?.mentionUserIds).toEqual(["@sut:matrix-qa.test"]);

1507-

expect(sendTextMessage.mock.calls.at(1)?.[0]?.roomId).toBe("!main:matrix-qa.test");

1523+

expect(mockObjectArg(sendTextMessage, "sendTextMessage", 1).mentionUserIds).toEqual([

1524+

"@sut:matrix-qa.test",

1525+

]);

1526+

expect(mockObjectArg(sendTextMessage, "sendTextMessage", 1).roomId).toBe(

1527+

"!main:matrix-qa.test",

1528+

);

15081529

});

1509153015101531

it("queues a Matrix trigger during restart before proving incremental sync continues", async () => {

@@ -1515,7 +1536,7 @@ describe("matrix live qa scenarios", () => {

15151536

return String(params.body).includes("CATCHUP") ? "$catchup-trigger" : "$incremental-trigger";

15161537

});

15171538

const waitForRoomEvent = vi.fn().mockImplementation(async () => {

1518-

const sentBody = String(sendTextMessage.mock.calls.at(-1)?.[0]?.body ?? "");

1539+

const sentBody = lastMockMessageBody(sendTextMessage, "sendTextMessage");

15191540

const token = sentBody.replace("@sut:matrix-qa.test reply with only this exact marker: ", "");

15201541

callOrder.push(`wait:${token.includes("CATCHUP") ? "catchup" : "incremental"}`);

15211542

return {

@@ -1612,7 +1633,7 @@ describe("matrix live qa scenarios", () => {

16121633

return kind === "fresh" ? "$fresh-trigger" : "$first-trigger";

16131634

});

16141635

const waitForRoomEvent = vi.fn().mockImplementation(async () => {

1615-

const sentBody = String(sendTextMessage.mock.calls.at(-1)?.[0]?.body ?? "");

1636+

const sentBody = lastMockMessageBody(sendTextMessage, "sendTextMessage");

16161637

const token = sentBody.replace("@sut:matrix-qa.test reply with only this exact marker: ", "");

16171638

const kind = token.includes("REPLAY_DEDUPE_FRESH") ? "fresh" : "first";

16181639

callOrder.push(`wait:${kind}`);

@@ -1722,7 +1743,7 @@ describe("matrix live qa scenarios", () => {

17221743

return kind === "fresh" ? "$fresh-trigger" : "$first-trigger";

17231744

});

17241745

const waitForRoomEvent = vi.fn().mockImplementation(async () => {

1725-

const sentBody = String(sendTextMessage.mock.calls.at(-1)?.[0]?.body ?? "");

1746+

const sentBody = lastMockMessageBody(sendTextMessage, "sendTextMessage");

17261747

const token = sentBody.replace(

17271748

"@sut:matrix-qa.test reply with only this exact marker: ",

17281749

"",

@@ -2155,7 +2176,7 @@ describe("matrix live qa scenarios", () => {

21552176

return "$after-trigger";

21562177

});

21572178

const waitForRoomEvent = vi.fn().mockImplementation(async (params) => {

2158-

const body = String(sendTextMessage.mock.calls.at(-1)?.[0]?.body ?? "");

2179+

const body = lastMockMessageBody(sendTextMessage, "sendTextMessage");

21592180

const token = body.replace("@sut:matrix-qa.test reply with only this exact marker: ", "");

21602181

return {

21612182

event: {

@@ -3271,7 +3292,9 @@ describe("matrix live qa scenarios", () => {

32713292

expect(body).toMatch(

32723293

/reply with exactly this two-line body and no extra text:\nMATRIX_QA_BLOCK_ONE_[A-F0-9]{8}\nMATRIX_QA_BLOCK_TWO_[A-F0-9]{8}$/,

32733294

);

3274-

expect(waitForRoomEvent.mock.calls.at(1)?.[0]?.since).toBe("driver-sync-block-one");

3295+

expect(mockObjectArg(waitForRoomEvent, "waitForRoomEvent", 1).since).toBe(

3296+

"driver-sync-block-one",

3297+

);

32753298

});

3276329932773300

it("sends a real Matrix image attachment for image-understanding prompts", async () => {

@@ -3574,7 +3597,9 @@ describe("matrix live qa scenarios", () => {

35743597

expect(mediaMessage?.kind).toBe(mediaCase.kind);

35753598

expect(mediaMessage?.mentionUserIds).toEqual(["@sut:matrix-qa.test"]);

35763599

}

3577-

const firstReplyWait = waitForRoomEvent.mock.calls.at(1)?.[0];

3600+

const firstReplyWait = mockObjectArg(waitForRoomEvent, "waitForRoomEvent", 1) as {

3601+

predicate: (event: MatrixQaObservedEvent) => boolean;

3602+

};

35783603

const firstToken =

35793604

mockMessageBody(sendMediaMessage, "sendMediaMessage").match(

35803605

/MATRIX_QA_MEDIA_[A-Z]+_[A-Z0-9]+/,

@@ -4484,7 +4509,10 @@ describe("matrix live qa scenarios", () => {

44844509

search: "",

44854510

}),

44864511

).toBe(false);

4487-

const recoveryClientOptions = createMatrixQaE2eeScenarioClient.mock.calls.at(-1)?.[0];

4512+

const recoveryClientOptions = lastMockObjectArg(

4513+

createMatrixQaE2eeScenarioClient,

4514+

"createMatrixQaE2eeScenarioClient",

4515+

);

44884516

expect(recoveryClientOptions?.accessToken).toBe("recovery-token");

44894517

expect(recoveryClientOptions?.baseUrl).toBe("http://127.0.0.1:39877");

44904518

expect(recoveryClientOptions?.deviceId).toBe("RECOVERYDEVICE");