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

推荐订阅源

WordPress大学
WordPress大学
酷 壳 – CoolShell
酷 壳 – CoolShell
小众软件
小众软件
Vercel News
Vercel News
Last Week in AI
Last Week in AI
H
Help Net Security
The Cloudflare Blog
L
LangChain Blog
Microsoft Security Blog
Microsoft Security Blog
B
Blog RSS Feed
云风的 BLOG
云风的 BLOG
I
InfoQ
U
Unit 42
美团技术团队
人人都是产品经理
人人都是产品经理
雷峰网
雷峰网
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - 叶小钗
Y
Y Combinator Blog
Hugging Face - Blog
Hugging Face - Blog
A
About on SuperTechFans
宝玉的分享
宝玉的分享
量子位
博客园_首页

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 comfy image assertions · openclaw/openclaw@...
steipete · 2026-05-11 · via Recent Commits to openclaw:main

@@ -15,6 +15,24 @@ const { fetchWithSsrFGuardMock } = vi.hoisted(() => ({

1515

fetchWithSsrFGuardMock: vi.fn(),

1616

}));

171718+

type FetchGuardRequest = {

19+

url?: unknown;

20+

auditContext?: unknown;

21+

init?: {

22+

method?: unknown;

23+

headers?: HeadersInit;

24+

body?: BodyInit | null;

25+

};

26+

};

27+28+

function fetchRequest(call: number): FetchGuardRequest {

29+

const request = fetchWithSsrFGuardMock.mock.calls[call - 1]?.[0] as FetchGuardRequest | undefined;

30+

if (!request) {

31+

throw new Error(`expected Comfy fetch call ${call}`);

32+

}

33+

return request;

34+

}

35+1836

function parseJsonBody(call: number): Record<string, unknown> {

1937

return parseComfyJsonBody(fetchWithSsrFGuardMock, call);

2038

}

@@ -146,33 +164,23 @@ describe("comfy image-generation provider", () => {

146164

}),

147165

});

148166149-

expect(fetchWithSsrFGuardMock).toHaveBeenNthCalledWith(

150-

1,

151-

expect.objectContaining({

152-

url: "http://127.0.0.1:8188/prompt",

153-

auditContext: "comfy-image-generate",

154-

}),

155-

);

167+

const submitRequest = fetchRequest(1);

168+

expect(submitRequest.url).toBe("http://127.0.0.1:8188/prompt");

169+

expect(submitRequest.auditContext).toBe("comfy-image-generate");

156170

expect(parseJsonBody(1)).toEqual({

157171

prompt: {

158172

"6": { inputs: { text: "draw a lobster" } },

159173

"9": { inputs: {} },

160174

},

161175

});

162-

expect(fetchWithSsrFGuardMock).toHaveBeenNthCalledWith(

163-

2,

164-

expect.objectContaining({

165-

url: "http://127.0.0.1:8188/history/local-prompt-1",

166-

auditContext: "comfy-history",

167-

}),

168-

);

169-

expect(fetchWithSsrFGuardMock).toHaveBeenNthCalledWith(

170-

3,

171-

expect.objectContaining({

172-

url: "http://127.0.0.1:8188/view?filename=generated.png&subfolder=&type=output",

173-

auditContext: "comfy-image-download",

174-

}),

176+

const historyRequest = fetchRequest(2);

177+

expect(historyRequest.url).toBe("http://127.0.0.1:8188/history/local-prompt-1");

178+

expect(historyRequest.auditContext).toBe("comfy-history");

179+

const downloadRequest = fetchRequest(3);

180+

expect(downloadRequest.url).toBe(

181+

"http://127.0.0.1:8188/view?filename=generated.png&subfolder=&type=output",

175182

);

183+

expect(downloadRequest.auditContext).toBe("comfy-image-download");

176184

expect(result).toEqual({

177185

images: [

178186

{

@@ -260,14 +268,16 @@ describe("comfy image-generation provider", () => {

260268

],

261269

});

262270263-

const uploadRequest = fetchWithSsrFGuardMock.mock.calls[0]?.[0];

271+

const uploadRequest = fetchRequest(1);

264272

expect(uploadRequest?.url).toBe("http://127.0.0.1:8188/upload/image");

265273

expect(uploadRequest?.auditContext).toBe("comfy-image-upload");

266274

expect(uploadRequest?.init?.method).toBe("POST");

267275

const uploadForm = uploadRequest?.init?.body;

268-

expect(uploadForm).toBeInstanceOf(FormData);

269-

expect(uploadForm?.get("type")).toBe("input");

270-

expect(uploadForm?.get("overwrite")).toBe("true");

276+

if (!(uploadForm instanceof FormData)) {

277+

throw new Error("expected Comfy upload request body to be FormData");

278+

}

279+

expect(uploadForm.get("type")).toBe("input");

280+

expect(uploadForm.get("overwrite")).toBe("true");

271281272282

expect(parseJsonBody(2)).toEqual({

273283

prompt: {

@@ -306,7 +316,7 @@ describe("comfy image-generation provider", () => {

306316

}),

307317

});

308318309-

const submitRequest = fetchWithSsrFGuardMock.mock.calls[0]?.[0];

319+

const submitRequest = fetchRequest(1);

310320

expect(submitRequest?.url).toBe("https://cloud.comfy.org/api/prompt");

311321

expect(submitRequest?.auditContext).toBe("comfy-image-generate");

312322

const submitHeaders = new Headers(submitRequest?.init?.headers);

@@ -321,34 +331,20 @@ describe("comfy image-generation provider", () => {

321331

},

322332

});

323333324-

expect(fetchWithSsrFGuardMock).toHaveBeenNthCalledWith(

325-

2,

326-

expect.objectContaining({

327-

url: "https://cloud.comfy.org/api/job/cloud-job-1/status",

328-

auditContext: "comfy-status",

329-

}),

330-

);

331-

expect(fetchWithSsrFGuardMock).toHaveBeenNthCalledWith(

332-

3,

333-

expect.objectContaining({

334-

url: "https://cloud.comfy.org/api/history_v2/cloud-job-1",

335-

auditContext: "comfy-history",

336-

}),

337-

);

338-

expect(fetchWithSsrFGuardMock).toHaveBeenNthCalledWith(

339-

4,

340-

expect.objectContaining({

341-

url: "https://cloud.comfy.org/api/view?filename=cloud.png&subfolder=&type=output",

342-

auditContext: "comfy-image-download",

343-

}),

344-

);

345-

expect(fetchWithSsrFGuardMock).toHaveBeenNthCalledWith(

346-

5,

347-

expect.objectContaining({

348-

url: "https://cdn.example.com/cloud.png",

349-

auditContext: "comfy-image-download",

350-

}),

334+

const statusRequest = fetchRequest(2);

335+

expect(statusRequest.url).toBe("https://cloud.comfy.org/api/job/cloud-job-1/status");

336+

expect(statusRequest.auditContext).toBe("comfy-status");

337+

const historyRequest = fetchRequest(3);

338+

expect(historyRequest.url).toBe("https://cloud.comfy.org/api/history_v2/cloud-job-1");

339+

expect(historyRequest.auditContext).toBe("comfy-history");

340+

const viewRequest = fetchRequest(4);

341+

expect(viewRequest.url).toBe(

342+

"https://cloud.comfy.org/api/view?filename=cloud.png&subfolder=&type=output",

351343

);

344+

expect(viewRequest.auditContext).toBe("comfy-image-download");

345+

const cdnRequest = fetchRequest(5);

346+

expect(cdnRequest.url).toBe("https://cdn.example.com/cloud.png");

347+

expect(cdnRequest.auditContext).toBe("comfy-image-download");

352348

expect(result.metadata).toEqual({

353349

promptId: "cloud-job-1",

354350

outputNodeIds: ["9"],

@@ -384,14 +380,12 @@ describe("comfy image-generation provider", () => {

384380

}),

385381

});

386382387-

const submitRequest = fetchWithSsrFGuardMock.mock.calls[0]?.[0];

383+

const submitRequest = fetchRequest(1);

388384

const submitHeaders = new Headers(submitRequest?.init?.headers);

389385

expect(submitHeaders.get("x-api-key")).toBe("comfy-secret-ref-key");

390-

expect(parseJsonBody(1)).toMatchObject({

391-

extra_data: {

392-

api_key_comfy_org: "comfy-secret-ref-key",

393-

},

394-

});

386+

const requestBody = parseJsonBody(1);

387+

const extraData = requestBody.extra_data as { api_key_comfy_org?: unknown } | undefined;

388+

expect(extraData?.api_key_comfy_org).toBe("comfy-secret-ref-key");

395389

});

396390397391

it("uses provider auth fallback for cloud workflows without plugin config API keys", async () => {

@@ -423,13 +417,11 @@ describe("comfy image-generation provider", () => {

423417

}),

424418

});

425419426-

const submitRequest = fetchWithSsrFGuardMock.mock.calls[0]?.[0];

420+

const submitRequest = fetchRequest(1);

427421

const submitHeaders = new Headers(submitRequest?.init?.headers);

428422

expect(submitHeaders.get("x-api-key")).toBe("profile-key");

429-

expect(parseJsonBody(1)).toMatchObject({

430-

extra_data: {

431-

api_key_comfy_org: "profile-key",

432-

},

433-

});

423+

const requestBody = parseJsonBody(1);

424+

const extraData = requestBody.extra_data as { api_key_comfy_org?: unknown } | undefined;

425+

expect(extraData?.api_key_comfy_org).toBe("profile-key");

434426

});

435427

});