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

推荐订阅源

Vercel News
Vercel News
博客园 - 【当耐特】
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
小众软件
小众软件
Hugging Face - Blog
Hugging Face - Blog
aimingoo的专栏
aimingoo的专栏
WordPress大学
WordPress大学
G
Google Developers Blog
博客园 - 叶小钗
大猫的无限游戏
大猫的无限游戏
P
Proofpoint News Feed
J
Java Code Geeks
U
Unit 42
云风的 BLOG
云风的 BLOG
阮一峰的网络日志
阮一峰的网络日志
N
Netflix TechBlog - Medium
宝玉的分享
宝玉的分享
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
D
Docker
V
Visual Studio Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
H
Help Net Security
V
V2EX
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
test(gateway): mock runtime config io imports · openclaw/...
steipete · 2026-04-28 · via Recent Commits to openclaw:main

@@ -10,6 +10,9 @@ const applyPluginAutoEnable = vi.hoisted(() =>

1010

autoEnabledReasons: {} as Record<string, string[]>,

1111

})),

1212

);

13+

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

14+

isNixMode: { value: false },

15+

}));

1316

const pluginManifestRegistry = vi.hoisted(() => ({ plugins: [], diagnostics: [] }));

1417

const pluginMetadataSnapshot = vi.hoisted(

1518

(): PluginMetadataSnapshot => ({

@@ -52,20 +55,30 @@ const pluginMetadataSnapshot = vi.hoisted(

5255

}),

5356

);

545755-

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

56-

applyConfigOverrides: vi.fn((config: OpenClawConfig) => config),

57-

isNixMode: false,

58+

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

5859

readConfigFileSnapshot: vi.fn(),

5960

readConfigFileSnapshotWithPluginMetadata: vi.fn(),

6061

recoverConfigFromLastKnownGood: vi.fn(),

6162

recoverConfigFromJsonRootSuffix: vi.fn(),

63+

}));

64+65+

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

66+

get isNixMode() {

67+

return configMocks.isNixMode.value;

68+

},

69+

}));

70+71+

vi.mock("../config/runtime-overrides.js", () => ({

72+

applyConfigOverrides: vi.fn((config: OpenClawConfig) => config),

73+

}));

74+75+

vi.mock("../config/recovery-policy.js", () => ({

6276

isPluginLocalInvalidConfigSnapshot: vi.fn((snapshot: ConfigFileSnapshot) => {

6377

if (snapshot.valid || snapshot.legacyIssues.length > 0 || snapshot.issues.length === 0) {

6478

return false;

6579

}

6680

return snapshot.issues.every((issue) => issue.path.startsWith("plugins.entries."));

6781

}),

68-

replaceConfigFile: vi.fn(),

6982

shouldAttemptLastKnownGoodRecovery: vi.fn((snapshot: ConfigFileSnapshot) => {

7083

if (snapshot.valid) {

7184

return false;

@@ -76,12 +89,18 @@ vi.mock("../config/config.js", () => ({

7689

snapshot.issues.every((issue) => issue.path.startsWith("plugins.entries."))

7790

);

7891

}),

92+

}));

93+94+

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

95+

replaceConfigFile: vi.fn(),

96+

}));

97+98+

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

7999

validateConfigObjectWithPlugins: vi.fn((config: OpenClawConfig) => ({

80100

ok: true,

81101

config,

82102

warnings: [],

83103

})),

84-

writeConfigFile: vi.fn(),

85104

}));

8610587106

vi.mock("../config/plugin-auto-enable.js", () => ({

@@ -93,7 +112,8 @@ vi.mock("./config-recovery-notice.js", () => ({

93112

}));

9411395114

let loadGatewayStartupConfigSnapshot: typeof import("./server-startup-config.js").loadGatewayStartupConfigSnapshot;

96-

let configIo: typeof import("../config/config.js");

115+

let configIo: typeof import("../config/io.js");

116+

let configMutate: typeof import("../config/mutate.js");

97117

let recoveryNotice: typeof import("./config-recovery-notice.js");

9811899119

const configPath = "/tmp/openclaw-startup-recovery.json";

@@ -123,12 +143,14 @@ function buildSnapshot(params: {

123143

describe("gateway startup config recovery", () => {

124144

beforeAll(async () => {

125145

({ loadGatewayStartupConfigSnapshot } = await import("./server-startup-config.js"));

126-

configIo = await import("../config/config.js");

146+

configIo = await import("../config/io.js");

147+

configMutate = await import("../config/mutate.js");

127148

recoveryNotice = await import("./config-recovery-notice.js");

128149

});

129150130151

beforeEach(() => {

131152

vi.clearAllMocks();

153+

configMocks.isNixMode.value = false;

132154

vi.mocked(configIo.readConfigFileSnapshotWithPluginMetadata).mockImplementation(async () => ({

133155

snapshot: await vi.mocked(configIo.readConfigFileSnapshot)(),

134156

}));

@@ -200,7 +222,7 @@ describe("gateway startup config recovery", () => {

200222

env: process.env,

201223

manifestRegistry: pluginManifestRegistry,

202224

});

203-

expect(configIo.replaceConfigFile).not.toHaveBeenCalled();

225+

expect(configMutate.replaceConfigFile).not.toHaveBeenCalled();

204226

expect(log.info).not.toHaveBeenCalled();

205227

});

206228

@@ -291,7 +313,7 @@ describe("gateway startup config recovery", () => {

291313

snapshot: legacySnapshot,

292314

pluginMetadataSnapshot,

293315

});

294-

vi.mocked(configIo, true).isNixMode = true;

316+

configMocks.isNixMode.value = true;

295317296318

await expect(

297319

loadGatewayStartupConfigSnapshot({

@@ -495,7 +517,7 @@ describe("gateway startup config recovery", () => {

495517

config.models?.providers?.anthropic,

496518

);

497519

expect(configIo.recoverConfigFromLastKnownGood).not.toHaveBeenCalled();

498-

expect(configIo.writeConfigFile).not.toHaveBeenCalled();

520+

expect(configMutate.replaceConfigFile).not.toHaveBeenCalled();

499521

expect(log.warn).toHaveBeenCalledWith(

500522

'gateway: skipped model provider openrouter; configured provider api is invalid. Run "openclaw doctor --fix" to repair the config.',

501523

);