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

推荐订阅源

Y
Y Combinator Blog
博客园_首页
量子位
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
H
Help Net Security
The Cloudflare Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
A
About on SuperTechFans
腾讯CDC
H
Hackread – Cybersecurity News, Data Breaches, AI and More
D
DataBreaches.Net
L
LangChain Blog
Stack Overflow Blog
Stack Overflow Blog
Jina AI
Jina AI
月光博客
月光博客
云风的 BLOG
云风的 BLOG
博客园 - 聂微东
Hugging Face - Blog
Hugging Face - Blog
雷峰网
雷峰网
C
Check Point Blog
V
V2EX
T
Tailwind CSS Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
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
fix(test): avoid walking provider family scans · openclaw...
vincentkoc · 2026-05-16 · via Recent Commits to openclaw:main

@@ -1,7 +1,8 @@

1-

import { existsSync, readdirSync, readFileSync } from "node:fs";

1+

import { spawnSync } from "node:child_process";

2+

import fs from "node:fs";

23

import { basename, dirname, relative, resolve, sep } from "node:path";

34

import { fileURLToPath } from "node:url";

4-

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

5+

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

56

import { loadPluginManifestRegistry } from "../manifest-registry.js";

6778

type SharedFamilyHookKind = "replay" | "stream" | "tool-compat";

@@ -49,10 +50,40 @@ function toRepoRelative(path: string): string {

4950

return relative(REPO_ROOT, path).split(sep).join("/");

5051

}

515253+

function shouldSkipScannedPath(relativePath: string): boolean {

54+

return relativePath.split("/").some((part) => part === "dist" || part === "node_modules");

55+

}

56+57+

function listGitFiles(dir: string): string[] | null {

58+

const relativeDir = toRepoRelative(dir);

59+

if (!relativeDir || relativeDir.startsWith("..")) {

60+

return null;

61+

}

62+

const result = spawnSync("git", ["ls-files", "--", relativeDir], {

63+

cwd: REPO_ROOT,

64+

encoding: "utf8",

65+

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

66+

});

67+

if (result.status !== 0) {

68+

return null;

69+

}

70+

return result.stdout

71+

.split("\n")

72+

.map((line) => line.trim().replaceAll("\\", "/"))

73+

.filter((line) => line.length > 0 && !shouldSkipScannedPath(line))

74+

.map((line) => resolve(REPO_ROOT, line))

75+

.toSorted();

76+

}

77+5278

function listFiles(dir: string): string[] {

79+

const gitFiles = listGitFiles(dir);

80+

if (gitFiles) {

81+

return gitFiles;

82+

}

83+5384

const files: string[] = [];

548555-

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

86+

for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {

5687

if (entry.name === "dist" || entry.name === "node_modules") {

5788

continue;

5889

}

@@ -82,7 +113,7 @@ function resolveBundledPluginSourceRoot(rootDir: string, workspaceDir?: string):

82113

return workspaceDir;

83114

}

84115

const sourceRoot = resolve(REPO_ROOT, "extensions", basename(rootDir));

85-

return existsSync(sourceRoot) ? sourceRoot : rootDir;

116+

return fs.existsSync(sourceRoot) ? sourceRoot : rootDir;

86117

}

8711888119

function collectSharedFamilyProviders(): Map<string, SharedFamilyProviderInventory> {

@@ -93,7 +124,7 @@ function collectSharedFamilyProviders(): Map<string, SharedFamilyProviderInvento

93124

if (!filePath.endsWith(".ts") || filePath.endsWith(".test.ts")) {

94125

continue;

95126

}

96-

const source = readFileSync(filePath, "utf8");

127+

const source = fs.readFileSync(filePath, "utf8");

97128

const matchedKinds = SHARED_FAMILY_HOOK_PATTERNS.filter(({ regex }) => regex.test(source));

98129

if (matchedKinds.length === 0) {

99130

continue;

@@ -121,7 +152,7 @@ function collectProviderBoundaryTests(): Map<string, Set<string>> {

121152

if (!filePath.endsWith(".test.ts")) {

122153

continue;

123154

}

124-

const source = readFileSync(filePath, "utf8");

155+

const source = fs.readFileSync(filePath, "utf8");

125156

if (!PROVIDER_BOUNDARY_TEST_SIGNALS.some((signal) => signal.test(source))) {

126157

continue;

127158

}

@@ -149,7 +180,7 @@ function collectSharedFamilyAssignments(): Map<string, ExpectedSharedFamilyContr

149180

if (!filePath.endsWith(".ts") || filePath.endsWith(".test.ts")) {

150181

continue;

151182

}

152-

const source = readFileSync(filePath, "utf8");

183+

const source = fs.readFileSync(filePath, "utf8");

153184

const replayFamilies = listMatchingFamilies(source, replayPattern);

154185

const streamFamilies = listMatchingFamilies(source, streamPattern);

155186

const toolCompatFamilies = listMatchingFamilies(source, toolCompatPattern);

@@ -184,6 +215,20 @@ function collectSharedFamilyAssignments(): Map<string, ExpectedSharedFamilyContr

184215

}

185216186217

describe("provider family plugin-boundary inventory", () => {

218+

it("lists bundled plugin files from git without walking plugin roots", () => {

219+

const bundledRoots = listBundledPluginRoots();

220+

const readDir = vi.spyOn(fs, "readdirSync");

221+

try {

222+

const files = bundledRoots.flatMap((plugin) => listFiles(plugin.rootDir));

223+224+

expect(files.length).toBeGreaterThan(0);

225+

expect(files.some((file) => toRepoRelative(file).startsWith("extensions/"))).toBe(true);

226+

expect(readDir).not.toHaveBeenCalled();

227+

} finally {

228+

readDir.mockRestore();

229+

}

230+

});

231+187232

it("keeps shared-family provider hooks covered by at least one plugin-boundary test", () => {

188233

const sharedFamilyProviders = collectSharedFamilyProviders();

189234

const providerBoundaryTests = collectProviderBoundaryTests();