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

推荐订阅源

博客园 - 三生石上(FineUI控件)
WordPress大学
WordPress大学
S
SegmentFault 最新的问题
小众软件
小众软件
T
Tailwind CSS Blog
博客园 - 聂微东
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
人人都是产品经理
人人都是产品经理
V
Visual Studio Blog
罗磊的独立博客
有赞技术团队
有赞技术团队
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Jina AI
Jina AI
量子位
云风的 BLOG
云风的 BLOG
Recent Announcements
Recent Announcements
Hugging Face - Blog
Hugging Face - Blog
P
Proofpoint News Feed
N
Netflix TechBlog - Medium
GbyAI
GbyAI
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
腾讯CDC
美团技术团队

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 auth profile save assertions · openclaw/ope...
steipete · 2026-05-11 · via Recent Commits to openclaw:main

@@ -18,6 +18,20 @@ vi.mock("./auth-profiles/external-auth.js", () => ({

1818

syncPersistedExternalCliAuthProfiles: <T>(store: T) => store,

1919

}));

202021+

function requireRecord(value: unknown, label: string): Record<string, unknown> {

22+

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

23+

throw new Error(`expected ${label} to be an object`);

24+

}

25+

return value as Record<string, unknown>;

26+

}

27+28+

function expectProfileFields(profile: unknown, expected: Record<string, unknown>): void {

29+

const actual = requireRecord(profile, "auth profile");

30+

for (const [key, value] of Object.entries(expected)) {

31+

expect(actual[key]).toEqual(value);

32+

}

33+

}

34+2135

describe("saveAuthProfileStore", () => {

2236

it("strips plaintext when keyRef/tokenRef are present", async () => {

2337

const structuredCloneSpy = vi.spyOn(globalThis, "structuredClone");

@@ -98,7 +112,7 @@ describe("saveAuthProfileStore", () => {

98112

},

99113

]);

100114101-

expect(ensureAuthProfileStore(agentDir).profiles["anthropic:default"]).toMatchObject({

115+

expectProfileFields(ensureAuthProfileStore(agentDir).profiles["anthropic:default"], {

102116

access: "access-1",

103117

refresh: "refresh-1",

104118

});

@@ -118,15 +132,15 @@ describe("saveAuthProfileStore", () => {

118132119133

saveAuthProfileStore(rotatedStore, agentDir);

120134121-

expect(ensureAuthProfileStore(agentDir).profiles["anthropic:default"]).toMatchObject({

135+

expectProfileFields(ensureAuthProfileStore(agentDir).profiles["anthropic:default"], {

122136

access: "access-2",

123137

refresh: "refresh-2",

124138

});

125139126140

const persisted = JSON.parse(await fs.readFile(resolveAuthStorePath(agentDir), "utf8")) as {

127141

profiles: Record<string, { access?: string; refresh?: string }>;

128142

};

129-

expect(persisted.profiles["anthropic:default"]).toMatchObject({

143+

expectProfileFields(persisted.profiles["anthropic:default"], {

130144

access: "access-2",

131145

refresh: "refresh-2",

132146

});

@@ -215,7 +229,7 @@ describe("saveAuthProfileStore", () => {

215229

});

216230217231

const localUpdateStore = ensureAuthProfileStoreForLocalUpdate(childAgentDir);

218-

expect(localUpdateStore.profiles["openai-codex:default"]).toMatchObject({

232+

expectProfileFields(localUpdateStore.profiles["openai-codex:default"], {

219233

type: "oauth",

220234

refresh: "main-refresh-token",

221235

});

@@ -232,7 +246,7 @@ describe("saveAuthProfileStore", () => {

232246

const child = JSON.parse(await fs.readFile(childAuthPath, "utf8")) as {

233247

profiles: Record<string, unknown>;

234248

};

235-

expect(child.profiles["openai:default"]).toMatchObject({

249+

expectProfileFields(child.profiles["openai:default"], {

236250

type: "api_key",

237251

provider: "openai",

238252

});

@@ -251,7 +265,7 @@ describe("saveAuthProfileStore", () => {

251265

},

252266

});

253267254-

expect(ensureAuthProfileStore(childAgentDir).profiles["openai-codex:default"]).toMatchObject({

268+

expectProfileFields(ensureAuthProfileStore(childAgentDir).profiles["openai-codex:default"], {

255269

type: "oauth",

256270

access: "main-refreshed-access-token",

257271

refresh: "main-refreshed-refresh-token",

@@ -287,7 +301,7 @@ describe("saveAuthProfileStore", () => {

287301

});

288302289303

const localUpdateStore = ensureAuthProfileStoreForLocalUpdate(childAgentDir);

290-

expect(localUpdateStore.profiles["openai-codex:default"]).toMatchObject({

304+

expectProfileFields(localUpdateStore.profiles["openai-codex:default"], {

291305

type: "oauth",

292306

refresh: "main-old-refresh-token",

293307

});

@@ -319,12 +333,12 @@ describe("saveAuthProfileStore", () => {

319333

const child = JSON.parse(await fs.readFile(childAuthPath, "utf8")) as {

320334

profiles: Record<string, unknown>;

321335

};

322-

expect(child.profiles["openai:default"]).toMatchObject({

336+

expectProfileFields(child.profiles["openai:default"], {

323337

type: "api_key",

324338

provider: "openai",

325339

});

326340

expect(child.profiles["openai-codex:default"]).toBeUndefined();

327-

expect(ensureAuthProfileStore(childAgentDir).profiles["openai-codex:default"]).toMatchObject({

341+

expectProfileFields(ensureAuthProfileStore(childAgentDir).profiles["openai-codex:default"], {

328342

type: "oauth",

329343

access: "main-refreshed-access-token",

330344

refresh: "main-refreshed-refresh-token",

@@ -380,11 +394,11 @@ describe("saveAuthProfileStore", () => {

380394

expect(child.profiles["openai-codex:default"]).toBeUndefined();

381395382396

const runtime = ensureAuthProfileStore(childAgentDir);

383-

expect(runtime.profiles["openai:default"]).toMatchObject({

397+

expectProfileFields(runtime.profiles["openai:default"], {

384398

type: "api_key",

385399

provider: "openai",

386400

});

387-

expect(runtime.profiles["openai-codex:default"]).toMatchObject({

401+

expectProfileFields(runtime.profiles["openai-codex:default"], {

388402

type: "oauth",

389403

access: "main-access-token",

390404

refresh: "main-refresh-token",

@@ -403,7 +417,7 @@ describe("saveAuthProfileStore", () => {

403417

},

404418

});

405419406-

expect(ensureAuthProfileStore(childAgentDir).profiles["openai-codex:default"]).toMatchObject({

420+

expectProfileFields(ensureAuthProfileStore(childAgentDir).profiles["openai-codex:default"], {

407421

type: "oauth",

408422

access: "main-refreshed-access-token",

409423

refresh: "main-refreshed-refresh-token",