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

推荐订阅源

Blog — PlanetScale
Blog — PlanetScale
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Vercel News
Vercel News
B
Blog
腾讯CDC
P
Proofpoint News Feed
Google DeepMind News
Google DeepMind News
N
Netflix TechBlog - Medium
L
LangChain Blog
F
Fortinet All Blogs
T
The Blog of Author Tim Ferriss
人人都是产品经理
人人都是产品经理
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
I
InfoQ
IT之家
IT之家
酷 壳 – CoolShell
酷 壳 – CoolShell
aimingoo的专栏
aimingoo的专栏
D
DataBreaches.Net
Stack Overflow Blog
Stack Overflow Blog
The Cloudflare Blog
Last Week in AI
Last Week in AI
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
博客园 - 三生石上(FineUI控件)
T
Tailwind CSS 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(extensions): guard model and Twilio fetches · opencla...
steipete · 2026-05-01 · via Recent Commits to openclaw:main

@@ -1,22 +1,23 @@

11

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

2-

import { TwilioApiError, twilioApiRequest } from "./api.js";

324-

const apiMocks = vi.hoisted(() => ({

5-

fetchWithSsrFGuard: vi.fn(),

3+

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

4+

fetchWithSsrFGuardMock: vi.fn(),

65

}));

768-

vi.mock("openclaw/plugin-sdk/ssrf-runtime", () => ({

9-

fetchWithSsrFGuard: apiMocks.fetchWithSsrFGuard,

7+

vi.mock("../../../api.js", () => ({

8+

fetchWithSsrFGuard: fetchWithSsrFGuardMock,

109

}));

111011+

import { TwilioApiError, twilioApiRequest } from "./api.js";

12+1213

describe("twilioApiRequest", () => {

1314

afterEach(() => {

14-

apiMocks.fetchWithSsrFGuard.mockReset();

15+

fetchWithSsrFGuardMock.mockReset();

1516

});

16171718

it("posts form bodies with basic auth and parses json", async () => {

1819

const release = vi.fn(async () => {});

19-

apiMocks.fetchWithSsrFGuard.mockResolvedValue({

20+

fetchWithSsrFGuardMock.mockResolvedValue({

2021

response: new Response(JSON.stringify({ sid: "CA123" }), { status: 200 }),

2122

release,

2223

});

@@ -34,10 +35,12 @@ describe("twilioApiRequest", () => {

3435

}),

3536

).resolves.toEqual({ sid: "CA123" });

363737-

const [{ url, init, auditContext, policy }] = apiMocks.fetchWithSsrFGuard.mock.calls[0] ?? [];

38+

const [{ url, init, auditContext, policy, timeoutMs }] =

39+

fetchWithSsrFGuardMock.mock.calls[0] ?? [];

3840

expect(url).toBe("https://api.twilio.com/Calls.json");

3941

expect(auditContext).toBe("voice-call.twilio.api");

4042

expect(policy).toEqual({ allowedHostnames: ["api.twilio.com"] });

43+

expect(timeoutMs).toBe(30_000);

4144

expect(init).toEqual(

4245

expect.objectContaining({

4346

method: "POST",

@@ -63,7 +66,7 @@ describe("twilioApiRequest", () => {

6366

new Response("missing", { status: 404 }),

6467

];

6568

const release = vi.fn(async () => {});

66-

apiMocks.fetchWithSsrFGuard.mockImplementation(async () => ({

69+

fetchWithSsrFGuardMock.mockImplementation(async () => ({

6770

response: responses.shift()!,

6871

release,

6972

}));

@@ -93,7 +96,7 @@ describe("twilioApiRequest", () => {

93969497

it("throws twilio api errors for non-ok responses", async () => {

9598

const release = vi.fn(async () => {});

96-

apiMocks.fetchWithSsrFGuard.mockResolvedValue({

99+

fetchWithSsrFGuardMock.mockResolvedValue({

97100

response: new Response("bad request", { status: 400 }),

98101

release,

99102

});

@@ -112,7 +115,7 @@ describe("twilioApiRequest", () => {

112115113116

it("exposes structured Twilio error codes from json error bodies", async () => {

114117

const release = vi.fn(async () => {});

115-

apiMocks.fetchWithSsrFGuard.mockResolvedValue({

118+

fetchWithSsrFGuardMock.mockResolvedValue({

116119

response: new Response(

117120

JSON.stringify({

118121

code: 21220,