























@@ -2,11 +2,8 @@ import { spawnSync } from "node:child_process";
22import fs from "node:fs";
33import os from "node:os";
44import path from "node:path";
5-import { beforeAll, describe, expect, it } from "vitest";
6-import {
7-createFormattedPromptSnapshotFiles,
8-deleteStalePromptSnapshotFiles,
9-} from "../../scripts/generate-prompt-snapshots.js";
5+import { describe, expect, it } from "vitest";
6+import { deleteStalePromptSnapshotFiles } from "../../scripts/prompt-snapshot-files.js";
107import {
118defaultCatalogPathCandidates,
129findDefaultCatalogPath,
@@ -18,17 +15,10 @@ import { toRepoRelativePath } from "../../src/test-utils/repo-files.js";
1815import {
1916CODEX_MODEL_PROMPT_FIXTURE_DIR,
2017CODEX_RUNTIME_HAPPY_PATH_PROMPT_SNAPSHOT_DIR,
21-} from "../helpers/agents/happy-path-prompt-snapshots.js";
18+} from "../helpers/agents/prompt-snapshot-paths.js";
221923-function requireGeneratedSnapshot(
24-generated: Array<{ path: string; content: string }>,
25-fileName: string,
26-): string {
27-const match = generated.find((file) => file.path.endsWith(fileName));
28-if (!match) {
29-throw new Error(`Missing generated prompt snapshot ${fileName}`);
30-}
31-return match.content;
20+function readCommittedSnapshot(fileName: string): string {
21+return fs.readFileSync(path.join(CODEX_RUNTIME_HAPPY_PATH_PROMPT_SNAPSHOT_DIR, fileName), "utf8");
3222}
33233424function renderedPromptSection(content: string, heading: string, nextHeading: string): string {
@@ -113,12 +103,6 @@ function listFindCommittedPromptSnapshotFiles(): string[] | null {
113103}
114104115105describe("happy path prompt snapshots", () => {
116-let generatedSnapshots: Awaited<ReturnType<typeof createFormattedPromptSnapshotFiles>>;
117-118-beforeAll(async () => {
119-generatedSnapshots = await createFormattedPromptSnapshotFiles();
120-}, 300_000);
121-122106it("lists committed Codex prompt snapshot artifacts without scanning directories in-process", () => {
123107expectNoReaddirSyncDuring(() => {
124108const committed = listCommittedPromptSnapshotFiles();
@@ -128,13 +112,16 @@ describe("happy path prompt snapshots", () => {
128112});
129113});
130114131-it("matches the committed Codex prompt snapshot artifacts", async () => {
132-const expectedPaths = new Set(generatedSnapshots.map((file) => file.path));
133-for (const file of generatedSnapshots) {
134-expect(fs.readFileSync(file.path, "utf8"), file.path).toBe(file.content);
135-}
136-const committed = listCommittedPromptSnapshotFiles();
137-expect(committed.toSorted()).toEqual([...expectedPaths].toSorted());
115+it("keeps the committed Codex prompt snapshot artifact set explicit", () => {
116+expect(listCommittedPromptSnapshotFiles().map((file) => path.basename(file))).toEqual([
117+"README.md",
118+"codex-dynamic-tools.discord-group.json",
119+"codex-dynamic-tools.heartbeat-turn.json",
120+"codex-dynamic-tools.telegram-direct.json",
121+"discord-group-codex-message-tool.md",
122+"telegram-direct-codex-message-tool.md",
123+"telegram-heartbeat-codex-tool.md",
124+]);
138125});
139126140127it("deletes stale generated snapshot artifacts", async () => {
@@ -160,10 +147,7 @@ describe("happy path prompt snapshots", () => {
160147});
161148162149it("renders the Codex model-bound prompt layers", async () => {
163-const telegram = requireGeneratedSnapshot(
164-generatedSnapshots,
165-"telegram-direct-codex-message-tool.md",
166-);
150+const telegram = readCommittedSnapshot("telegram-direct-codex-message-tool.md");
167151168152expect(telegram).toContain("## Reconstructed Model-Bound Prompt Layers");
169153expect(telegram).toContain("### System: Codex Model Instructions (gpt-5.5, pragmatic)");
@@ -183,18 +167,9 @@ describe("happy path prompt snapshots", () => {
183167});
184168185169it("keeps heartbeat guidance in heartbeat collaboration mode only", async () => {
186-const direct = requireGeneratedSnapshot(
187-generatedSnapshots,
188-"telegram-direct-codex-message-tool.md",
189-);
190-const group = requireGeneratedSnapshot(
191-generatedSnapshots,
192-"discord-group-codex-message-tool.md",
193-);
194-const heartbeat = requireGeneratedSnapshot(
195-generatedSnapshots,
196-"telegram-heartbeat-codex-tool.md",
197-);
170+const direct = readCommittedSnapshot("telegram-direct-codex-message-tool.md");
171+const group = readCommittedSnapshot("discord-group-codex-message-tool.md");
172+const heartbeat = readCommittedSnapshot("telegram-heartbeat-codex-tool.md");
198173const heartbeatPhrase = "Use heartbeats to create useful proactive progress";
199174200175expect(direct).toContain('"collaborationMode": {');
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。