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

推荐订阅源

Hugging Face - Blog
Hugging Face - Blog
Vercel News
Vercel News
C
Check Point Blog
G
Google Developers Blog
博客园 - 司徒正美
量子位
Engineering at Meta
Engineering at Meta
S
SegmentFault 最新的问题
Google DeepMind News
Google DeepMind News
F
Fortinet All Blogs
A
About on SuperTechFans
美团技术团队
D
DataBreaches.Net
Stack Overflow Blog
Stack Overflow Blog
Jina AI
Jina AI
Y
Y Combinator Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Apple Machine Learning Research
Apple Machine Learning Research
J
Java Code Geeks
MongoDB | Blog
MongoDB | Blog
人人都是产品经理
人人都是产品经理
H
Hackread – Cybersecurity News, Data Breaches, AI and More
The Cloudflare Blog
U
Unit 42

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 scanning prompt snapshots · openclaw/ope...
vincentkoc · 2026-05-16 · via Recent Commits to openclaw:main

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

1+

import { spawnSync } from "node:child_process";

12

import fs from "node:fs";

23

import os from "node:os";

34

import path from "node:path";

4-

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

5+

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

56

import {

67

createFormattedPromptSnapshotFiles,

78

deleteStalePromptSnapshotFiles,

@@ -37,22 +38,104 @@ function renderedPromptSection(content: string, heading: string, nextHeading: st

3738

return content.slice(start, end);

3839

}

394041+

function listCommittedPromptSnapshotFiles(): string[] {

42+

const externalFiles = listExternalCommittedPromptSnapshotFiles();

43+

if (externalFiles) {

44+

return externalFiles;

45+

}

46+

return fs

47+

.readdirSync(CODEX_RUNTIME_HAPPY_PATH_PROMPT_SNAPSHOT_DIR)

48+

.filter((entry) => entry.endsWith(".md") || entry.endsWith(".json"))

49+

.map((entry) => path.join(CODEX_RUNTIME_HAPPY_PATH_PROMPT_SNAPSHOT_DIR, entry))

50+

.toSorted();

51+

}

52+53+

function listExternalCommittedPromptSnapshotFiles(): string[] | null {

54+

return listGitCommittedPromptSnapshotFiles() ?? listFindCommittedPromptSnapshotFiles();

55+

}

56+57+

function listGitCommittedPromptSnapshotFiles(): string[] | null {

58+

const result = spawnSync(

59+

"git",

60+

["ls-files", "--", CODEX_RUNTIME_HAPPY_PATH_PROMPT_SNAPSHOT_DIR],

61+

{

62+

cwd: process.cwd(),

63+

encoding: "utf8",

64+

maxBuffer: 1024 * 1024,

65+

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

66+

},

67+

);

68+

if (result.status !== 0) {

69+

return null;

70+

}

71+

return result.stdout

72+

.split("\n")

73+

.map((line) => line.trim())

74+

.filter((line) => line.endsWith(".md") || line.endsWith(".json"))

75+

.toSorted();

76+

}

77+78+

function listFindCommittedPromptSnapshotFiles(): string[] | null {

79+

const result = spawnSync(

80+

"find",

81+

[

82+

path.join(process.cwd(), CODEX_RUNTIME_HAPPY_PATH_PROMPT_SNAPSHOT_DIR),

83+

"-maxdepth",

84+

"1",

85+

"-type",

86+

"f",

87+

"(",

88+

"-name",

89+

"*.md",

90+

"-o",

91+

"-name",

92+

"*.json",

93+

")",

94+

],

95+

{

96+

cwd: process.cwd(),

97+

encoding: "utf8",

98+

maxBuffer: 1024 * 1024,

99+

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

100+

},

101+

);

102+

if (result.status !== 0) {

103+

return null;

104+

}

105+

return result.stdout

106+

.split("\n")

107+

.map((line) => line.trim())

108+

.filter((line) => line.length > 0)

109+

.map((filePath) => path.relative(process.cwd(), filePath).split(path.sep).join("/"))

110+

.toSorted();

111+

}

112+40113

describe("happy path prompt snapshots", () => {

41114

let generatedSnapshots: Awaited<ReturnType<typeof createFormattedPromptSnapshotFiles>>;

4211543116

beforeAll(async () => {

44117

generatedSnapshots = await createFormattedPromptSnapshotFiles();

45118

}, 300_000);

46119120+

it("lists committed Codex prompt snapshot artifacts without scanning directories in-process", () => {

121+

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

122+

try {

123+

const committed = listCommittedPromptSnapshotFiles();

124+125+

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

126+

expect(committed.every((file) => file.endsWith(".md") || file.endsWith(".json"))).toBe(true);

127+

expect(readDir).not.toHaveBeenCalled();

128+

} finally {

129+

readDir.mockRestore();

130+

}

131+

});

132+47133

it("matches the committed Codex prompt snapshot artifacts", async () => {

48134

const expectedPaths = new Set(generatedSnapshots.map((file) => file.path));

49135

for (const file of generatedSnapshots) {

50136

expect(fs.readFileSync(file.path, "utf8"), file.path).toBe(file.content);

51137

}

52-

const committed = fs

53-

.readdirSync(CODEX_RUNTIME_HAPPY_PATH_PROMPT_SNAPSHOT_DIR)

54-

.filter((entry) => entry.endsWith(".md") || entry.endsWith(".json"))

55-

.map((entry) => path.join(CODEX_RUNTIME_HAPPY_PATH_PROMPT_SNAPSHOT_DIR, entry));

138+

const committed = listCommittedPromptSnapshotFiles();

56139

expect(committed.toSorted()).toEqual([...expectedPaths].toSorted());

57140

});

58141