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

推荐订阅源

MongoDB | Blog
MongoDB | Blog
B
Blog
Y
Y Combinator Blog
大猫的无限游戏
大猫的无限游戏
aimingoo的专栏
aimingoo的专栏
B
Blog RSS Feed
博客园 - Franky
V
V2EX
IT之家
IT之家
WordPress大学
WordPress大学
博客园 - 三生石上(FineUI控件)
J
Java Code Geeks
F
Fortinet All Blogs
I
InfoQ
云风的 BLOG
云风的 BLOG
腾讯CDC
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
月光博客
月光博客
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
N
Netflix TechBlog - Medium
宝玉的分享
宝玉的分享
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
P
Proofpoint News Feed
Microsoft Security Blog
Microsoft Security 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
ci: block new package patches · openclaw/openclaw@0916a19
steipete · 2026-05-14 · via Recent Commits to openclaw:main

@@ -0,0 +1,173 @@

1+

import { execFileSync } from "node:child_process";

2+

import { mkdirSync, rmSync, writeFileSync } from "node:fs";

3+

import path from "node:path";

4+

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

5+

import { collectPackagePatchViolations } from "../../scripts/check-package-patches.mjs";

6+

import { cleanupTempDirs, makeTempRepoRoot, writeJsonFile } from "../helpers/temp-repo.js";

7+8+

const tempDirs: string[] = [];

9+10+

const nestedGitEnvKeys = [

11+

"GIT_ALTERNATE_OBJECT_DIRECTORIES",

12+

"GIT_DIR",

13+

"GIT_INDEX_FILE",

14+

"GIT_OBJECT_DIRECTORY",

15+

"GIT_QUARANTINE_PATH",

16+

"GIT_WORK_TREE",

17+

] as const;

18+19+

function createNestedGitEnv(): NodeJS.ProcessEnv {

20+

const env = {

21+

...process.env,

22+

GIT_CONFIG_NOSYSTEM: "1",

23+

GIT_TERMINAL_PROMPT: "0",

24+

};

25+

for (const key of nestedGitEnvKeys) {

26+

delete env[key];

27+

}

28+

return env;

29+

}

30+31+

function git(cwd: string, args: string[]) {

32+

execFileSync("git", args, {

33+

cwd,

34+

encoding: "utf8",

35+

env: createNestedGitEnv(),

36+

});

37+

}

38+39+

function makeRepo() {

40+

const dir = makeTempRepoRoot(tempDirs, "openclaw-package-patches-");

41+

git(dir, ["init", "-q", "--initial-branch=main"]);

42+

writeJsonFile(path.join(dir, "package.json"), { name: "fixture" });

43+

writeFileSync(path.join(dir, "pnpm-workspace.yaml"), "packages:\n - .\n", "utf8");

44+

writeFileSync(path.join(dir, "pnpm-lock.yaml"), "lockfileVersion: '9.0'\n", "utf8");

45+

git(dir, ["add", "package.json", "pnpm-workspace.yaml", "pnpm-lock.yaml"]);

46+

return dir;

47+

}

48+49+

afterEach(() => {

50+

cleanupTempDirs(tempDirs);

51+

});

52+53+

describe("check-package-patches", () => {

54+

it("allows the existing legacy pnpm patches", () => {

55+

const dir = makeRepo();

56+

mkdirSync(path.join(dir, "patches"), { recursive: true });

57+

writeFileSync(

58+

path.join(dir, "pnpm-workspace.yaml"),

59+

`packages:

60+

- .

61+

patchedDependencies:

62+

"baileys@7.0.0-rc11": "patches/baileys@7.0.0-rc11.patch"

63+

"@agentclientprotocol/claude-agent-acp@0.33.1": "patches/@agentclientprotocol__claude-agent-acp@0.33.1.patch"

64+

`,

65+

"utf8",

66+

);

67+

writeFileSync(

68+

path.join(dir, "pnpm-lock.yaml"),

69+

`lockfileVersion: '9.0'

70+

patchedDependencies:

71+

'@agentclientprotocol/claude-agent-acp@0.33.1': 3995624bb834cc60fea1461c7ef33f1fcdd8fb58b8f43f2f1490bc689f6e1be2

72+

baileys@7.0.0-rc11: a9aea1790d2c65b1ae543c77faca4119bbfb91ee3b6ca6c38d1cad4f5702ada2

73+

`,

74+

"utf8",

75+

);

76+

writeFileSync(path.join(dir, "patches", "baileys@7.0.0-rc11.patch"), "diff\n", "utf8");

77+

writeFileSync(

78+

path.join(dir, "patches", "@agentclientprotocol__claude-agent-acp@0.33.1.patch"),

79+

"diff\n",

80+

"utf8",

81+

);

82+

git(dir, ["add", "pnpm-workspace.yaml", "pnpm-lock.yaml", "patches"]);

83+84+

expect(collectPackagePatchViolations(dir)).toEqual([]);

85+

});

86+87+

it("rejects new workspace patchedDependencies and patch files", () => {

88+

const dir = makeRepo();

89+

mkdirSync(path.join(dir, "patches"), { recursive: true });

90+

mkdirSync(path.join(dir, "fixtures"), { recursive: true });

91+

writeFileSync(

92+

path.join(dir, "pnpm-workspace.yaml"),

93+

`packages:

94+

- .

95+

patchedDependencies:

96+

"left-pad@1.3.0": "patches/left-pad@1.3.0.patch"

97+

`,

98+

"utf8",

99+

);

100+

writeFileSync(path.join(dir, "patches", "left-pad@1.3.0.patch"), "diff\n", "utf8");

101+

writeFileSync(path.join(dir, "fixtures", "fixture.patch"), "diff\n", "utf8");

102+

git(dir, ["add", "pnpm-workspace.yaml", "patches", "fixtures"]);

103+104+

expect(collectPackagePatchViolations(dir)).toEqual([

105+

{

106+

file: "pnpm-workspace.yaml",

107+

kind: "patchedDependency",

108+

detail: "left-pad@1.3.0 -> patches/left-pad@1.3.0.patch",

109+

},

110+

{

111+

file: "fixtures/fixture.patch",

112+

kind: "patchFile",

113+

detail: "new package patch file",

114+

},

115+

{

116+

file: "patches/left-pad@1.3.0.patch",

117+

kind: "patchFile",

118+

detail: "new package patch file",

119+

},

120+

]);

121+

});

122+123+

it("rejects lockfile-only and package-local patch declarations", () => {

124+

const dir = makeRepo();

125+

writeJsonFile(path.join(dir, "package.json"), {

126+

name: "fixture",

127+

pnpm: {

128+

patchedDependencies: {

129+

"nested@1.0.0": "patches/nested.patch",

130+

},

131+

},

132+

});

133+

writeFileSync(

134+

path.join(dir, "pnpm-lock.yaml"),

135+

`lockfileVersion: '9.0'

136+

patchedDependencies:

137+

hidden@1.0.0: abc123

138+

`,

139+

"utf8",

140+

);

141+

git(dir, ["add", "package.json", "pnpm-lock.yaml"]);

142+143+

expect(collectPackagePatchViolations(dir)).toEqual([

144+

{

145+

file: "pnpm-lock.yaml",

146+

kind: "patchedDependency",

147+

detail: "hidden@1.0.0 -> abc123",

148+

},

149+

{

150+

file: "package.json",

151+

kind: "packageJsonPatchedDependency",

152+

detail: "nested@1.0.0 -> patches/nested.patch",

153+

},

154+

]);

155+

});

156+157+

it("skips tracked package manifests deleted in the worktree", () => {

158+

const dir = makeRepo();

159+

mkdirSync(path.join(dir, "packages", "deleted"), { recursive: true });

160+

writeJsonFile(path.join(dir, "packages", "deleted", "package.json"), {

161+

name: "deleted",

162+

pnpm: {

163+

patchedDependencies: {

164+

"deleted-only@1.0.0": "patches/deleted-only.patch",

165+

},

166+

},

167+

});

168+

git(dir, ["add", "packages/deleted/package.json"]);

169+

rmSync(path.join(dir, "packages", "deleted", "package.json"));

170+171+

expect(collectPackagePatchViolations(dir)).toEqual([]);

172+

});

173+

});