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

推荐订阅源

Hugging Face - Blog
Hugging Face - Blog
宝玉的分享
宝玉的分享
G
Google Developers Blog
T
Tailwind CSS Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
V
V2EX
V
Visual Studio Blog
博客园 - Franky
S
SegmentFault 最新的问题
Jina AI
Jina AI
爱范儿
爱范儿
The Cloudflare Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
D
DataBreaches.Net
C
Check Point Blog
月光博客
月光博客
P
Proofpoint News Feed
T
The Blog of Author Tim Ferriss
罗磊的独立博客
H
Hackread – Cybersecurity News, Data Breaches, AI and More
MongoDB | Blog
MongoDB | Blog
The GitHub Blog
The GitHub Blog
Y
Y Combinator Blog
Martin Fowler
Martin Fowler

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 sandbox registry assertions · openclaw/open...
steipete · 2026-05-10 · via Recent Commits to openclaw:main

@@ -82,6 +82,7 @@ import {

82828383

type SandboxBrowserRegistryEntry = import("./registry.js").SandboxBrowserRegistryEntry;

8484

type SandboxRegistryEntry = import("./registry.js").SandboxRegistryEntry;

85+

type MigrationResult = Awaited<ReturnType<typeof migrateLegacySandboxRegistryFiles>>[number];

85868687

function payloadMentionsContainer(payload: string, containerName: string): boolean {

8788

return (

@@ -189,7 +190,24 @@ async function seedStaleLock(lockPath: string) {

189190

}

190191191192

async function expectPathMissing(targetPath: string): Promise<void> {

192-

await expect(fs.access(targetPath)).rejects.toMatchObject({ code: "ENOENT" });

193+

try {

194+

await fs.access(targetPath);

195+

throw new Error(`expected ${targetPath} to be missing`);

196+

} catch (error) {

197+

const code = error && typeof error === "object" && "code" in error ? error.code : undefined;

198+

expect(code).toBe("ENOENT");

199+

}

200+

}

201+202+

function requireMigrationResult(

203+

results: readonly MigrationResult[],

204+

kind: MigrationResult["kind"],

205+

): MigrationResult {

206+

const result = results.find((candidate) => candidate.kind === kind);

207+

if (!result) {

208+

throw new Error(`expected migration result for ${kind}`);

209+

}

210+

return result;

193211

}

194212195213

describe("registry race safety", () => {

@@ -214,14 +232,12 @@ describe("registry race safety", () => {

214232215233

await migrateLegacySandboxRegistryFiles();

216234

const registry = await readRegistry();

217-

expect(registry.entries).toEqual([

218-

expect.objectContaining({

219-

containerName: "legacy-container",

220-

backendId: "docker",

221-

runtimeLabel: "legacy-container",

222-

configLabelKind: "Image",

223-

}),

224-

]);

235+

expect(registry.entries).toHaveLength(1);

236+

const [entry] = registry.entries;

237+

expect(entry?.containerName).toBe("legacy-container");

238+

expect(entry?.backendId).toBe("docker");

239+

expect(entry?.runtimeLabel).toBe("legacy-container");

240+

expect(entry?.configLabelKind).toBe("Image");

225241

});

226242227243

it("migrates legacy container and browser registry files after explicit repair", async () => {

@@ -245,37 +261,34 @@ describe("registry race safety", () => {

245261

await seedStaleLock(`${SANDBOX_REGISTRY_PATH}.lock`);

246262

await seedStaleLock(`${SANDBOX_BROWSER_REGISTRY_PATH}.lock`);

247263248-

await expect(migrateLegacySandboxRegistryFiles()).resolves.toEqual([

249-

expect.objectContaining({ kind: "containers", status: "migrated", entries: 1 }),

250-

expect.objectContaining({ kind: "browsers", status: "migrated", entries: 1 }),

251-

]);

264+

const migrationResults = await migrateLegacySandboxRegistryFiles();

265+

const containerMigration = requireMigrationResult(migrationResults, "containers");

266+

const browserMigration = requireMigrationResult(migrationResults, "browsers");

267+

expect(containerMigration.status).toBe("migrated");

268+

expect(containerMigration.entries).toBe(1);

269+

expect(browserMigration.status).toBe("migrated");

270+

expect(browserMigration.entries).toBe(1);

252271253272

await expectPathMissing(SANDBOX_REGISTRY_PATH);

254273

await expectPathMissing(SANDBOX_BROWSER_REGISTRY_PATH);

255274

await expectPathMissing(`${SANDBOX_REGISTRY_PATH}.lock`);

256275

await expectPathMissing(`${SANDBOX_BROWSER_REGISTRY_PATH}.lock`);

257-

await expect(readRegistry()).resolves.toEqual({

258-

entries: [

259-

expect.objectContaining({

260-

containerName: "legacy-container",

261-

backendId: "docker",

262-

runtimeLabel: "legacy-container",

263-

sessionKey: "agent:legacy",

264-

configHash: "legacy-container-hash",

265-

}),

266-

],

267-

});

268-

await expect(readBrowserRegistry()).resolves.toEqual({

269-

entries: [

270-

expect.objectContaining({

271-

containerName: "legacy-browser",

272-

sessionKey: "agent:legacy",

273-

cdpPort: 9333,

274-

noVncPort: 6081,

275-

configHash: "legacy-browser-hash",

276-

}),

277-

],

278-

});

276+

const containerRegistry = await readRegistry();

277+

expect(containerRegistry.entries).toHaveLength(1);

278+

const [container] = containerRegistry.entries;

279+

expect(container?.containerName).toBe("legacy-container");

280+

expect(container?.backendId).toBe("docker");

281+

expect(container?.runtimeLabel).toBe("legacy-container");

282+

expect(container?.sessionKey).toBe("agent:legacy");

283+

expect(container?.configHash).toBe("legacy-container-hash");

284+

const browserRegistry = await readBrowserRegistry();

285+

expect(browserRegistry.entries).toHaveLength(1);

286+

const [browser] = browserRegistry.entries;

287+

expect(browser?.containerName).toBe("legacy-browser");

288+

expect(browser?.sessionKey).toBe("agent:legacy");

289+

expect(browser?.cdpPort).toBe(9333);

290+

expect(browser?.noVncPort).toBe(6081);

291+

expect(browser?.configHash).toBe("legacy-browser-hash");

279292

});

280293281294

it("does not overwrite newer sharded entries during legacy migration", async () => {

@@ -297,25 +310,17 @@ describe("registry race safety", () => {

297310

await migrateLegacySandboxRegistryFiles();

298311299312

const entry = await readRegistryEntry("container-a");

300-

expect(entry).toEqual(

301-

expect.objectContaining({

302-

sessionKey: "new-session",

303-

lastUsedAtMs: 10,

304-

}),

305-

);

313+

expect(entry?.sessionKey).toBe("new-session");

314+

expect(entry?.lastUsedAtMs).toBe(10);

306315

});

307316308317

it("reads a single sharded entry without scanning the full registry", async () => {

309318

await updateRegistry(containerEntry({ containerName: "container-x", sessionKey: "sess:x" }));

310319

await updateRegistry(containerEntry({ containerName: "container-y", sessionKey: "sess:y" }));

311320312321

const entry = await readRegistryEntry("container-x");

313-

expect(entry).toEqual(

314-

expect.objectContaining({

315-

containerName: "container-x",

316-

sessionKey: "sess:x",

317-

}),

318-

);

322+

expect(entry?.containerName).toBe("container-x");

323+

expect(entry?.sessionKey).toBe("sess:x");

319324

await expect(readRegistryEntry("missing-container")).resolves.toBeNull();

320325

});

321326

@@ -424,9 +429,10 @@ describe("registry race safety", () => {

424429

const invalidEntries = `{"entries":[{"sessionKey":"agent:main"}]}`;

425430

await seedMalformedContainerRegistry(invalidEntries);

426431

await seedMalformedBrowserRegistry(invalidEntries);

427-

await expect(migrateLegacySandboxRegistryFiles()).resolves.toEqual([

428-

expect.objectContaining({ kind: "containers", status: "quarantined-invalid" }),

429-

expect.objectContaining({ kind: "browsers", status: "quarantined-invalid" }),

430-

]);

432+

const migrationResults = await migrateLegacySandboxRegistryFiles();

433+

expect(requireMigrationResult(migrationResults, "containers").status).toBe(

434+

"quarantined-invalid",

435+

);

436+

expect(requireMigrationResult(migrationResults, "browsers").status).toBe("quarantined-invalid");

431437

});

432438

});