Add Codex happy path prompt snapshots (#75807)

* Add Codex prompt snapshots

* Fix prompt snapshot scenario catalogs

* Harden prompt snapshot drift check

* Fix CLI compat build export

* fix: keep codex snapshots out of core plugin surface

* fix: harden prompt snapshot ci checks

* fix: accept readonly web search onboarding scopes

* fix: repair plugin sdk package boundary types

* fix: clear prompt snapshot ci regressions

* fix: clear latest main ci checks

* fix: resolve latest main discord helper overlap

* fix: refresh codex dynamic tool snapshots

* fix: align prompt snapshot branch with latest ci

* fix: isolate plugin auto enable tests

* test: refresh prompt dynamic tool snapshots

* fix: stabilize bundled channel auto enable

* fix: clean stale prompt snapshots
This commit is contained in:
pashpashpash
2026-05-02 08:59:55 -07:00
committed by GitHub
parent 4fb520d9b7
commit 563dca82f4
46 changed files with 7920 additions and 133 deletions

View File

@@ -0,0 +1,43 @@
import fs from "node:fs";
import os from "node:os";
import path from "node:path";
import { describe, expect, it } from "vitest";
import {
createFormattedPromptSnapshotFiles,
deleteStalePromptSnapshotFiles,
} from "../../scripts/generate-prompt-snapshots.js";
import { HAPPY_PATH_PROMPT_SNAPSHOT_DIR } from "../helpers/agents/happy-path-prompt-snapshots.js";
describe("happy path prompt snapshots", () => {
it("matches the committed Codex prompt snapshot artifacts", async () => {
const generated = await createFormattedPromptSnapshotFiles();
const expectedPaths = new Set(generated.map((file) => file.path));
for (const file of generated) {
expect(fs.readFileSync(file.path, "utf8"), file.path).toBe(file.content);
}
const committed = fs
.readdirSync(HAPPY_PATH_PROMPT_SNAPSHOT_DIR)
.filter((entry) => entry.endsWith(".md") || entry.endsWith(".json"))
.map((entry) => path.join(HAPPY_PATH_PROMPT_SNAPSHOT_DIR, entry));
expect(committed.toSorted()).toEqual([...expectedPaths].toSorted());
});
it("deletes stale generated snapshot artifacts", async () => {
const root = fs.mkdtempSync(path.join(os.tmpdir(), "openclaw-prompt-snapshot-stale-"));
try {
const snapshotDir = path.join(root, HAPPY_PATH_PROMPT_SNAPSHOT_DIR);
fs.mkdirSync(snapshotDir, { recursive: true });
const stalePath = path.join(HAPPY_PATH_PROMPT_SNAPSHOT_DIR, "stale-snapshot.md");
fs.writeFileSync(path.join(root, stalePath), "stale\n");
const deleted = await deleteStalePromptSnapshotFiles(root, [
{ path: path.join(HAPPY_PATH_PROMPT_SNAPSHOT_DIR, "current.md") },
]);
expect(deleted).toEqual([stalePath]);
expect(fs.existsSync(path.join(root, stalePath))).toBe(false);
} finally {
fs.rmSync(root, { recursive: true, force: true });
}
});
});

View File

@@ -227,7 +227,19 @@ describe("collectRootDependencyOwnershipCheckErrors", () => {
writeRepoFile(
repoRoot,
"package.json",
JSON.stringify({ dependencies: { "playwright-core": "1.59.1" } }),
JSON.stringify({
dependencies: { "@homebridge/ciao": "^1.3.7", "playwright-core": "1.59.1" },
}),
);
writeRepoFile(
repoRoot,
"extensions/bonjour/package.json",
JSON.stringify({ dependencies: { "@homebridge/ciao": "^1.3.7" } }),
);
writeRepoFile(
repoRoot,
"extensions/bonjour/src/advertiser.ts",
'const CIAO_MODULE_ID = "@homebridge/ciao";\nimport(CIAO_MODULE_ID);\n',
);
writeRepoFile(
repoRoot,
@@ -243,6 +255,11 @@ describe("collectRootDependencyOwnershipCheckErrors", () => {
const records = collectRootDependencyOwnershipAudit({ repoRoot, scanRoots: ["extensions"] });
expect(records).toMatchObject([
{
category: "root_owned_extension_runtime",
depName: "@homebridge/ciao",
sections: ["extensions"],
},
{
category: "root_owned_extension_runtime",
depName: "playwright-core",