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

推荐订阅源

Recent Announcements
Recent Announcements
博客园 - 【当耐特】
Jina AI
Jina AI
人人都是产品经理
人人都是产品经理
酷 壳 – CoolShell
酷 壳 – CoolShell
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
博客园 - Franky
IT之家
IT之家
T
Tailwind CSS Blog
博客园 - 聂微东
雷峰网
雷峰网
大猫的无限游戏
大猫的无限游戏
博客园 - 司徒正美
爱范儿
爱范儿
I
InfoQ
N
Netflix TechBlog - Medium
Last Week in AI
Last Week in AI
J
Java Code Geeks
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
B
Blog RSS Feed
G
Google Developers Blog
D
Docker
C
Check Point Blog
B
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(ios): remove host zip dependency from IPA validator ...
vincentkoc · 2026-06-23 · via Recent Commits to openclaw:main
11

// iOS IPA validation tests cover the App Store upload gate without real signing assets.

22

import { execFileSync } from "node:child_process";

3-

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

3+

import {

4+

chmodSync,

5+

mkdirSync,

6+

mkdtempSync,

7+

readdirSync,

8+

readFileSync,

9+

rmSync,

10+

writeFileSync,

11+

} from "node:fs";

412

import os from "node:os";

513

import path from "node:path";

14+

import JSZip from "jszip";

615

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

716817

const SCRIPT = path.join(process.cwd(), "scripts", "ios-validate-app-store-ipa.sh");

@@ -104,15 +113,77 @@ if (Array.isArray(current)) {

104113

);

105114

}

106115107-

function writeValidFixture(

116+

function writeFakeUnzip(filePath: string): void {

117+

writeExecutable(

118+

filePath,

119+

`#!/usr/bin/env node

120+

const { mkdirSync, readFileSync, writeFileSync } = require("node:fs");

121+

const { createRequire } = require("node:module");

122+

const path = require("node:path");

123+

const requireFromRepo = createRequire(path.join(process.cwd(), "package.json"));

124+

const JSZip = requireFromRepo("jszip");

125+126+

const args = process.argv.slice(2);

127+

let ipaPath = "";

128+

let outputDir = "";

129+

for (let i = 0; i < args.length; i++) {

130+

const arg = args[i];

131+

if (arg === "-d") {

132+

outputDir = args[++i] || "";

133+

} else if (!arg.startsWith("-")) {

134+

ipaPath = arg;

135+

}

136+

}

137+

if (!ipaPath || !outputDir) process.exit(2);

138+139+

(async () => {

140+

const zip = await JSZip.loadAsync(readFileSync(ipaPath));

141+

for (const [entryPath, entry] of Object.entries(zip.files)) {

142+

const outputPath = path.join(outputDir, entryPath);

143+

if (entry.dir) {

144+

mkdirSync(outputPath, { recursive: true });

145+

continue;

146+

}

147+

mkdirSync(path.dirname(outputPath), { recursive: true });

148+

writeFileSync(outputPath, await entry.async("nodebuffer"));

149+

}

150+

})().catch(() => process.exit(1));

151+

`,

152+

);

153+

}

154+155+

async function writeIpaFixture(root: string): Promise<string> {

156+

const zip = new JSZip();

157+158+

function addTree(dirPath: string, zipPath: string): void {

159+

for (const entry of readdirSync(dirPath, { withFileTypes: true })) {

160+

const sourcePath = path.join(dirPath, entry.name);

161+

const entryZipPath = `${zipPath}/${entry.name}`;

162+

if (entry.isDirectory()) {

163+

addTree(sourcePath, entryZipPath);

164+

} else if (entry.isFile()) {

165+

zip.file(entryZipPath, readFileSync(sourcePath), { date: new Date(0) });

166+

}

167+

}

168+

}

169+170+

addTree(path.join(root, "Payload"), "Payload");

171+

const ipaPath = path.join(root, "OpenClaw.ipa");

172+

const buffer = await zip.generateAsync({ type: "nodebuffer", compression: "DEFLATE" });

173+

writeFileSync(ipaPath, buffer);

174+

return ipaPath;

175+

}

176+177+

async function writeValidFixture(

108178

root: string,

109179

options: { pushMode?: string; legacyKey?: boolean } = {},

110-

): {

180+

): Promise<{

111181

ipaPath: string;

112182

plistBuddy: string;

113183

codesign: string;

114184

security: string;

115-

} {

185+

unzip: string;

186+

}> {

116187

const binDir = path.join(root, "bin");

117188

const payloadDir = path.join(root, "Payload");

118189

const appDir = path.join(payloadDir, "OpenClaw.app");

@@ -172,6 +243,8 @@ function writeValidFixture(

172243173244

const plistBuddy = path.join(binDir, "plistbuddy");

174245

writeFakePlistBuddy(plistBuddy);

246+

const unzip = path.join(binDir, "unzip");

247+

writeFakeUnzip(unzip);

175248

const codesign = path.join(binDir, "codesign");

176249

writeExecutable(

177250

codesign,

@@ -189,16 +262,16 @@ cat "${profilePath}"

189262

`,

190263

);

191264192-

const ipaPath = path.join(root, "OpenClaw.ipa");

193-

execFileSync("zip", ["-qry", ipaPath, "Payload"], { cwd: root });

194-

return { ipaPath, plistBuddy, codesign, security };

265+

const ipaPath = await writeIpaFixture(root);

266+

return { ipaPath, plistBuddy, codesign, security, unzip };

195267

}

196268197269

function runValidator(fixture: {

198270

ipaPath: string;

199271

plistBuddy: string;

200272

codesign: string;

201273

security: string;

274+

unzip: string;

202275

}): { ok: boolean; stdout: string; stderr: string } {

203276

try {

204277

const stdout = execFileSync(BASH_BIN, [...bashArgs(SCRIPT), "--ipa", fixture.ipaPath], {

@@ -208,6 +281,7 @@ function runValidator(fixture: {

208281

IOS_VALIDATE_PLIST_BUDDY_BIN: fixture.plistBuddy,

209282

IOS_VALIDATE_CODESIGN_BIN: fixture.codesign,

210283

IOS_VALIDATE_SECURITY_BIN: fixture.security,

284+

IOS_VALIDATE_UNZIP_BIN: fixture.unzip,

211285

},

212286

encoding: "utf8",

213287

stdio: ["ignore", "pipe", "pipe"],

@@ -228,32 +302,32 @@ describe("scripts/ios-validate-app-store-ipa.sh", () => {

228302

}

229303

});

230304231-

it("accepts an App Store IPA with appStore mode and production entitlements", () => {

305+

it("accepts an App Store IPA with appStore mode and production entitlements", async () => {

232306

const root = mkdtempSync(path.join(os.tmpdir(), "openclaw-ios-ipa-"));

233307

tempDirs.push(root);

234-

const fixture = writeValidFixture(root);

308+

const fixture = await writeValidFixture(root);

235309236310

const result = runValidator(fixture);

237311238312

expect(result.ok).toBe(true);

239313

expect(result.stdout).toContain("Validated iOS App Store IPA");

240314

});

241315242-

it("rejects an IPA that was exported with a non-App-Store push mode", () => {

316+

it("rejects an IPA that was exported with a non-App-Store push mode", async () => {

243317

const root = mkdtempSync(path.join(os.tmpdir(), "openclaw-ios-ipa-"));

244318

tempDirs.push(root);

245-

const fixture = writeValidFixture(root, { pushMode: "localProduction" });

319+

const fixture = await writeValidFixture(root, { pushMode: "localProduction" });

246320247321

const result = runValidator(fixture);

248322249323

expect(result.ok).toBe(false);

250324

expect(result.stderr).toContain("push mode mismatch");

251325

});

252326253-

it("rejects legacy independently selectable production push keys", () => {

327+

it("rejects legacy independently selectable production push keys", async () => {

254328

const root = mkdtempSync(path.join(os.tmpdir(), "openclaw-ios-ipa-"));

255329

tempDirs.push(root);

256-

const fixture = writeValidFixture(root, { legacyKey: true });

330+

const fixture = await writeValidFixture(root, { legacyKey: true });

257331258332

const result = runValidator(fixture);

259333