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

推荐订阅源

腾讯CDC
aimingoo的专栏
aimingoo的专栏
S
SegmentFault 最新的问题
A
About on SuperTechFans
Engineering at Meta
Engineering at Meta
宝玉的分享
宝玉的分享
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
博客园 - 叶小钗
WordPress大学
WordPress大学
N
Netflix TechBlog - Medium
MyScale Blog
MyScale Blog
Stack Overflow Blog
Stack Overflow Blog
Microsoft Azure Blog
Microsoft Azure Blog
博客园 - 聂微东
M
MIT News - Artificial intelligence
F
Fortinet All Blogs
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Blog — PlanetScale
Blog — PlanetScale
T
Tailwind CSS Blog
Recent Announcements
Recent Announcements
Jina AI
Jina AI
大猫的无限游戏
大猫的无限游戏
Apple Machine Learning Research
Apple Machine Learning Research
J
Java Code Geeks

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 backup manifest assertions · openclaw/openc...
steipete · 2026-05-09 · via Recent Commits to openclaw:main

@@ -8,6 +8,7 @@ import * as backupShared from "./backup-shared.js";

88

import {

99

buildBackupArchiveRoot,

1010

encodeAbsolutePathForBackupArchive,

11+

type BackupAsset,

1112

resolveBackupPlanFromPaths,

1213

resolveBackupPlanFromDisk,

1314

} from "./backup-shared.js";

@@ -21,6 +22,25 @@ import {

21222223

const { backupCreateCommand } = await import("./backup.js");

232425+

type CapturedBackupManifest = {

26+

schemaVersion: 1;

27+

createdAt: string;

28+

archiveRoot: string;

29+

platform: NodeJS.Platform;

30+

options: {

31+

includeWorkspace: boolean;

32+

onlyConfig: boolean;

33+

};

34+

paths: {

35+

stateDir: string;

36+

configPath: string;

37+

oauthDir: string;

38+

workspaceDirs: string[];

39+

};

40+

assets: Array<Pick<BackupAsset, "kind" | "sourcePath" | "archivePath">>;

41+

skipped: Array<{ kind: string; sourcePath: string; reason: string; coveredBy?: string }>;

42+

};

43+2444

describe("backup commands", () => {

2545

let tempHome: TempHomeEnv;

2646

@@ -89,10 +109,19 @@ describe("backup commands", () => {

89109

) {

90110

expect(plan.included).toHaveLength(1);

91111

const [included] = plan.included;

92-

expect(included).toMatchObject({ kind: "state" });

93-

expect(plan.skipped).toEqual(

94-

expect.arrayContaining([expect.objectContaining({ kind: "workspace", reason: "covered" })]),

95-

);

112+

if (!included) {

113+

throw new Error("Expected state asset to be included");

114+

}

115+

expect(included.kind).toBe("state");

116+

expect(plan.skipped).toHaveLength(1);

117+

const [skipped] = plan.skipped;

118+

if (!skipped) {

119+

throw new Error("Expected covered workspace skip entry");

120+

}

121+

expect(skipped.kind).toBe("workspace");

122+

expect(skipped.reason).toBe("covered");

123+

expect(skipped.coveredBy).toBe(included.displayPath);

124+

expect(path.relative(included.sourcePath, skipped.sourcePath).startsWith("..")).toBe(false);

96125

}

9712698127

function expectOnlyAssetKind(assets: Array<{ kind: string }>, kind: string) {

@@ -159,9 +188,7 @@ describe("backup commands", () => {

159188

const externalWorkspace = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-workspace-"));

160189

const configPath = path.join(tempHome.home, "custom-config.json");

161190

const backupDir = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-backups-"));

162-

let capturedManifest: {

163-

assets: Array<{ kind: string; archivePath: string }>;

164-

} | null = null;

191+

let capturedManifest: CapturedBackupManifest | null = null;

165192

let capturedEntryPaths: string[] = [];

166193

let capturedOnWriteEntry: ((entry: { path: string }) => void) | null = null;

167194

try {

@@ -200,9 +227,9 @@ describe("backup commands", () => {

200227

options: { file: string; onWriteEntry?: (entry: { path: string }) => void },

201228

entryPaths: string[],

202229

) => {

203-

capturedManifest = JSON.parse(await fs.readFile(entryPaths[0], "utf8")) as {

204-

assets: Array<{ kind: string; archivePath: string }>;

205-

};

230+

capturedManifest = JSON.parse(

231+

await fs.readFile(entryPaths[0], "utf8"),

232+

) as CapturedBackupManifest;

206233

capturedEntryPaths = entryPaths;

207234

capturedOnWriteEntry = options.onWriteEntry ?? null;

208235

await fs.writeFile(options.file, "archive-bytes", "utf8");

@@ -217,22 +244,36 @@ describe("backup commands", () => {

217244

expect(result.archivePath).toBe(

218245

path.join(backupDir, `${buildBackupArchiveRoot(nowMs)}.tar.gz`),

219246

);

220-

expect(capturedManifest).toEqual(expect.objectContaining({ assets: expect.any(Array) }));

221247

expect(typeof capturedOnWriteEntry).toBe("function");

222248

if (capturedManifest === null || capturedOnWriteEntry === null) {

223249

throw new Error("Expected backup manifest and archive entry callback");

224250

}

225-

const manifest = capturedManifest as unknown as {

226-

assets: Array<{ kind: string; archivePath: string }>;

227-

};

251+

const manifest = capturedManifest as CapturedBackupManifest;

228252

const onWriteEntry = capturedOnWriteEntry as unknown as (entry: { path: string }) => void;

253+

expect(manifest.schemaVersion).toBe(1);

254+

expect(manifest.createdAt).toBe(result.createdAt);

255+

expect(manifest.archiveRoot).toBe(result.archiveRoot);

256+

expect(manifest.platform).toBe(process.platform);

257+

expect(manifest.options).toEqual({ includeWorkspace: true, onlyConfig: false });

258+

expect(manifest.paths).toEqual({

259+

stateDir,

260+

configPath,

261+

oauthDir: path.join(stateDir, "credentials"),

262+

workspaceDirs: [externalWorkspace],

263+

});

229264

expect(manifest.assets).toEqual(

230-

expect.arrayContaining([

231-

expect.objectContaining({ kind: "state" }),

232-

expect.objectContaining({ kind: "config" }),

233-

expect.objectContaining({ kind: "workspace" }),

234-

]),

265+

result.assets.map((asset) => ({

266+

kind: asset.kind,

267+

sourcePath: asset.sourcePath,

268+

archivePath: asset.archivePath,

269+

})),

235270

);

271+

expect(manifest.assets.map((asset) => asset.kind).toSorted()).toEqual([

272+

"config",

273+

"state",

274+

"workspace",

275+

]);

276+

expect(manifest.skipped).toEqual([]);

236277237278

const stateAsset = result.assets.find((asset) => asset.kind === "state");

238279

const workspaceAsset = result.assets.find((asset) => asset.kind === "workspace");