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

推荐订阅源

IT之家
IT之家
博客园 - 聂微东
雷峰网
雷峰网
Microsoft Azure Blog
Microsoft Azure Blog
WordPress大学
WordPress大学
Hugging Face - Blog
Hugging Face - Blog
S
SegmentFault 最新的问题
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
T
Tailwind CSS Blog
博客园 - 三生石上(FineUI控件)
V
Visual Studio Blog
博客园 - 司徒正美
爱范儿
爱范儿
月光博客
月光博客
阮一峰的网络日志
阮一峰的网络日志
博客园_首页
博客园 - 【当耐特】
Jina AI
Jina AI
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
酷 壳 – CoolShell
酷 壳 – CoolShell
大猫的无限游戏
大猫的无限游戏
小众软件
小众软件
人人都是产品经理
人人都是产品经理
V
V2EX

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
refactor(test): dedupe zip central directory fixture · op...
vincentkoc · 2026-06-18 · via Recent Commits to openclaw:main
Original file line numberDiff line numberDiff line change

@@ -6,6 +6,7 @@ import * as tar from "tar";

66

import { afterAll, beforeAll, describe, expect, it, vi } from "vitest";

77

import { createSuiteTempRootTracker } from "../test-helpers/temp-dir.js";

88

import { withRealpathSymlinkRebindRace } from "../test-utils/symlink-rebind-race.js";

9+

import { createZipCentralDirectoryArchive } from "../test-utils/zip-central-directory-fixture.js";

910

import type { ArchiveSecurityError } from "./archive.js";

1011

import {

1112

extractArchive,

@@ -91,31 +92,6 @@ async function expectExtractedSizeBudgetExceeded(params: {

9192

).rejects.toThrow("archive extracted size exceeds limit");

9293

}

9394
94-

function createZipCentralDirectoryArchive(params: {

95-

actualEntryCount: number;

96-

declaredEntryCount?: number;

97-

declaredCentralDirectorySize?: number;

98-

}): Buffer {

99-

const centralDirectory = Buffer.concat(

100-

Array.from({ length: params.actualEntryCount }, (_, index) => {

101-

const name = Buffer.from(`file-${index}.txt`);

102-

const header = Buffer.alloc(46 + name.byteLength);

103-

header.writeUInt32LE(0x02014b50, 0);

104-

header.writeUInt16LE(name.byteLength, 28);

105-

name.copy(header, 46);

106-

return header;

107-

}),

108-

);

109-

const declaredEntryCount = params.declaredEntryCount ?? params.actualEntryCount;

110-

const eocd = Buffer.alloc(22);

111-

eocd.writeUInt32LE(0x06054b50, 0);

112-

eocd.writeUInt16LE(Math.min(declaredEntryCount, 0xffff), 8);

113-

eocd.writeUInt16LE(Math.min(declaredEntryCount, 0xffff), 10);

114-

eocd.writeUInt32LE(params.declaredCentralDirectorySize ?? centralDirectory.byteLength, 12);

115-

eocd.writeUInt32LE(0, 16);

116-

return Buffer.concat([centralDirectory, eocd]);

117-

}

118-
11995

beforeAll(async () => {

12096

await fixtureRootTracker.setup();

12197

});

Original file line numberDiff line numberDiff line change

@@ -6,6 +6,7 @@ import path from "node:path";

66

import { Readable } from "node:stream";

77

import JSZip from "jszip";

88

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

9+

import { createZipCentralDirectoryArchive } from "../test-utils/zip-central-directory-fixture.js";

910
1011

const parseClawHubPluginSpecMock = vi.fn();

1112

const fetchClawHubPackageDetailMock = vi.fn();

@@ -107,31 +108,6 @@ function createLoggerSpies() {

107108

};

108109

}

109110
110-

function createZipCentralDirectoryArchive(params: {

111-

actualEntryCount: number;

112-

declaredEntryCount?: number;

113-

declaredCentralDirectorySize?: number;

114-

}): Buffer {

115-

const centralDirectory = Buffer.concat(

116-

Array.from({ length: params.actualEntryCount }, (_, index) => {

117-

const name = Buffer.from(`file-${index}.txt`);

118-

const header = Buffer.alloc(46 + name.byteLength);

119-

header.writeUInt32LE(0x02014b50, 0);

120-

header.writeUInt16LE(name.byteLength, 28);

121-

name.copy(header, 46);

122-

return header;

123-

}),

124-

);

125-

const declaredEntryCount = params.declaredEntryCount ?? params.actualEntryCount;

126-

const eocd = Buffer.alloc(22);

127-

eocd.writeUInt32LE(0x06054b50, 0);

128-

eocd.writeUInt16LE(Math.min(declaredEntryCount, 0xffff), 8);

129-

eocd.writeUInt16LE(Math.min(declaredEntryCount, 0xffff), 10);

130-

eocd.writeUInt32LE(params.declaredCentralDirectorySize ?? centralDirectory.byteLength, 12);

131-

eocd.writeUInt32LE(0, 16);

132-

return Buffer.concat([centralDirectory, eocd]);

133-

}

134-
135111

function expectClawHubInstallFlow(params: {

136112

baseUrl: string;

137113

version: string;

Original file line numberDiff line numberDiff line change

@@ -0,0 +1,25 @@

1+

// Builds minimal ZIP central-directory-only archives for archive limit tests.

2+

export function createZipCentralDirectoryArchive(params: {

3+

actualEntryCount: number;

4+

declaredEntryCount?: number;

5+

declaredCentralDirectorySize?: number;

6+

}): Buffer {

7+

const centralDirectory = Buffer.concat(

8+

Array.from({ length: params.actualEntryCount }, (_, index) => {

9+

const name = Buffer.from(`file-${index}.txt`);

10+

const header = Buffer.alloc(46 + name.byteLength);

11+

header.writeUInt32LE(0x02014b50, 0);

12+

header.writeUInt16LE(name.byteLength, 28);

13+

name.copy(header, 46);

14+

return header;

15+

}),

16+

);

17+

const declaredEntryCount = params.declaredEntryCount ?? params.actualEntryCount;

18+

const eocd = Buffer.alloc(22);

19+

eocd.writeUInt32LE(0x06054b50, 0);

20+

eocd.writeUInt16LE(Math.min(declaredEntryCount, 0xffff), 8);

21+

eocd.writeUInt16LE(Math.min(declaredEntryCount, 0xffff), 10);

22+

eocd.writeUInt32LE(params.declaredCentralDirectorySize ?? centralDirectory.byteLength, 12);

23+

eocd.writeUInt32LE(0, 16);

24+

return Buffer.concat([centralDirectory, eocd]);

25+

}