Rename Codex runtime prompt snapshot directory (#76274)

* test: rename Codex runtime prompt snapshots

* test: refresh prompt snapshots with node24

* test: format prompt snapshot markdown in generator
This commit is contained in:
pashpashpash
2026-05-02 15:34:59 -07:00
committed by GitHub
parent dc005e1bcc
commit bcb2476ae7
12 changed files with 43 additions and 55 deletions

View File

@@ -5,8 +5,8 @@ import path from "node:path";
import { fileURLToPath, pathToFileURL } from "node:url";
import { promisify } from "node:util";
import {
CODEX_RUNTIME_HAPPY_PATH_PROMPT_SNAPSHOT_DIR,
createHappyPathPromptSnapshotFiles,
HAPPY_PATH_PROMPT_SNAPSHOT_DIR,
} from "../test/helpers/agents/happy-path-prompt-snapshots.js";
const repoRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
@@ -40,7 +40,7 @@ async function writeSnapshotFiles(root: string, files: PromptSnapshotFile[]) {
async function formatSnapshotFiles(root: string, files: PromptSnapshotFile[]) {
const filePaths = files
.filter((file) => file.path.endsWith(".json"))
.filter((file) => file.path.endsWith(".md") || file.path.endsWith(".json"))
.map((file) => path.resolve(root, file.path));
if (filePaths.length === 0) {
return;
@@ -62,7 +62,9 @@ async function readSnapshotFiles(root: string, files: PromptSnapshotFile[]) {
async function listCommittedSnapshotArtifactPaths(root: string): Promise<string[]> {
let committedEntries: string[];
try {
committedEntries = await fs.readdir(path.resolve(root, HAPPY_PATH_PROMPT_SNAPSHOT_DIR));
committedEntries = await fs.readdir(
path.resolve(root, CODEX_RUNTIME_HAPPY_PATH_PROMPT_SNAPSHOT_DIR),
);
} catch (error) {
if (!hasErrorCode(error, "ENOENT")) {
throw error;
@@ -71,7 +73,7 @@ async function listCommittedSnapshotArtifactPaths(root: string): Promise<string[
}
return committedEntries
.filter((entry) => entry.endsWith(".md") || entry.endsWith(".json"))
.map((entry) => path.join(HAPPY_PATH_PROMPT_SNAPSHOT_DIR, entry));
.map((entry) => path.join(CODEX_RUNTIME_HAPPY_PATH_PROMPT_SNAPSHOT_DIR, entry));
}
export async function deleteStalePromptSnapshotFiles(
@@ -100,7 +102,9 @@ export async function createFormattedPromptSnapshotFiles(): Promise<PromptSnapsh
async function writeSnapshots() {
const files = await createFormattedPromptSnapshotFiles();
await fs.mkdir(path.resolve(repoRoot, HAPPY_PATH_PROMPT_SNAPSHOT_DIR), { recursive: true });
await fs.mkdir(path.resolve(repoRoot, CODEX_RUNTIME_HAPPY_PATH_PROMPT_SNAPSHOT_DIR), {
recursive: true,
});
const deleted = await deleteStalePromptSnapshotFiles(repoRoot, files);
await writeSnapshotFiles(repoRoot, files);
const deletedSummary = deleted.length > 0 ? ` Deleted ${deleted.length} stale file(s).` : "";