mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-10 00:11:19 +00:00
test(scripts): gate runtime sidecar baseline changes
This commit is contained in:
parent
b06e2f9149
commit
d46b64df66
4 changed files with 78 additions and 9 deletions
|
|
@ -44,6 +44,8 @@ const PROMPT_SNAPSHOT_CHECK_PATH_RE =
|
|||
/^(?:scripts\/(?:generate-prompt-snapshots\.ts|prompt-snapshot-files\.ts|sync-codex-model-prompt-fixture\.ts)|test\/helpers\/agents\/(?:happy-path-prompt-snapshots|prompt-snapshot-paths)\.ts|test\/fixtures\/agents\/prompt-snapshots\/.+)$/u;
|
||||
const PROMPT_SNAPSHOT_OWNER_TEST_PATH_RE =
|
||||
/^(?:scripts\/(?:generate-prompt-snapshots\.ts|prompt-snapshot-files\.ts|sync-codex-model-prompt-fixture\.ts)|test\/helpers\/agents\/(?:happy-path-prompt-snapshots|prompt-snapshot-paths)\.ts|test\/fixtures\/agents\/prompt-snapshots\/codex-model-catalog\/.+)$/u;
|
||||
const RUNTIME_SIDECAR_BASELINE_PATH_RE =
|
||||
/^(?:scripts\/generate-runtime-sidecar-paths-baseline\.ts|scripts\/lib\/bundled-runtime-sidecar-paths\.json|src\/plugins\/runtime-sidecar-paths(?:-baseline)?\.ts)$/u;
|
||||
const CORE_OXLINT_TS_CONFIG = "config/tsconfig/oxlint.core.json";
|
||||
const TARGETED_CORE_LINT_PATH_LIMIT = 8;
|
||||
const LINTABLE_CORE_PATH_RE = /^(?:src|ui|packages)\/.+\.[cm]?[jt]sx?$/u;
|
||||
|
|
@ -185,6 +187,10 @@ export function shouldRunPromptSnapshotOwnerTest(paths) {
|
|||
return paths.some((changedPath) => PROMPT_SNAPSHOT_OWNER_TEST_PATH_RE.test(changedPath));
|
||||
}
|
||||
|
||||
export function shouldRunRuntimeSidecarBaselineCheck(paths) {
|
||||
return paths.some((changedPath) => RUNTIME_SIDECAR_BASELINE_PATH_RE.test(changedPath));
|
||||
}
|
||||
|
||||
export function shouldRunTestTempCreationReport(paths) {
|
||||
return paths.some((changedPath) => isChangedLaneTestPath(changedPath));
|
||||
}
|
||||
|
|
@ -277,6 +283,13 @@ export function createChangedCheckPlan(result, options = {}) {
|
|||
if (shouldRunPromptSnapshotOwnerTest(result.paths)) {
|
||||
add("prompt snapshot owner test", ["test:serial", "test/scripts/prompt-snapshots.test.ts"]);
|
||||
}
|
||||
if (shouldRunRuntimeSidecarBaselineCheck(result.paths)) {
|
||||
add("runtime sidecar baseline", ["runtime-sidecars:check"]);
|
||||
add("runtime sidecar owner test", [
|
||||
"test:serial",
|
||||
"src/plugins/bundled-plugin-metadata.test.ts",
|
||||
]);
|
||||
}
|
||||
add("package patch guard", ["deps:patches:check"]);
|
||||
|
||||
if (result.docsOnly) {
|
||||
|
|
|
|||
|
|
@ -423,6 +423,13 @@ const PLUGIN_SDK_ENTRY_METADATA_TEST_TARGETS = [
|
|||
"test/scripts/ts-topology.test.ts",
|
||||
TOOLING_VITEST_CONFIG,
|
||||
];
|
||||
const RUNTIME_SIDECAR_BASELINE_OWNER_TEST_TARGETS = ["src/plugins/bundled-plugin-metadata.test.ts"];
|
||||
const RUNTIME_SIDECAR_PATH_CONSUMER_TEST_TARGETS = [
|
||||
...RUNTIME_SIDECAR_BASELINE_OWNER_TEST_TARGETS,
|
||||
"src/infra/update-global.test.ts",
|
||||
"src/infra/update-runner.test.ts",
|
||||
"test/openclaw-npm-postpublish-verify.test.ts",
|
||||
];
|
||||
const OFFICIAL_EXTERNAL_CATALOG_TEST_TARGETS = [
|
||||
"src/plugins/official-external-plugin-catalog.test.ts",
|
||||
"test/release-check.test.ts",
|
||||
|
|
@ -663,6 +670,10 @@ const TOOLING_SOURCE_TEST_TARGETS = new Map([
|
|||
["scripts/check-deadcode-unused-files.mjs", ["test/scripts/check-deadcode-unused-files.test.ts"]],
|
||||
["scripts/check-dynamic-import-warts.mjs", ["test/scripts/check-dynamic-import-warts.test.ts"]],
|
||||
["scripts/generate-prompt-snapshots.ts", ["test/scripts/prompt-snapshots.test.ts"]],
|
||||
[
|
||||
"scripts/generate-runtime-sidecar-paths-baseline.ts",
|
||||
RUNTIME_SIDECAR_BASELINE_OWNER_TEST_TARGETS,
|
||||
],
|
||||
[
|
||||
"scripts/lib/config-boundary-guard.mjs",
|
||||
[
|
||||
|
|
@ -978,15 +989,7 @@ const TOOLING_SOURCE_TEST_TARGETS = new Map([
|
|||
"scripts/lib/bundled-plugin-source-utils.mjs",
|
||||
["test/scripts/bundled-plugin-source-utils.test.ts"],
|
||||
],
|
||||
[
|
||||
"scripts/lib/bundled-runtime-sidecar-paths.json",
|
||||
[
|
||||
"src/plugins/bundled-plugin-metadata.test.ts",
|
||||
"src/infra/update-global.test.ts",
|
||||
"src/infra/update-runner.test.ts",
|
||||
"test/openclaw-npm-postpublish-verify.test.ts",
|
||||
],
|
||||
],
|
||||
["scripts/lib/bundled-runtime-sidecar-paths.json", RUNTIME_SIDECAR_PATH_CONSUMER_TEST_TARGETS],
|
||||
["scripts/lib/changed-extensions.mjs", ["test/scripts/test-extension.test.ts"]],
|
||||
["scripts/lib/dev-tooling-safety.ts", ["test/scripts/dev-tooling-safety.test.ts"]],
|
||||
[
|
||||
|
|
@ -1869,6 +1872,8 @@ const SOURCE_TEST_TARGETS = new Map([
|
|||
"test/helpers/agents/happy-path-prompt-snapshots.ts",
|
||||
HAPPY_PATH_PROMPT_SNAPSHOT_HELPER_TEST_TARGETS,
|
||||
],
|
||||
["src/plugins/runtime-sidecar-paths-baseline.ts", RUNTIME_SIDECAR_BASELINE_OWNER_TEST_TARGETS],
|
||||
["src/plugins/runtime-sidecar-paths.ts", RUNTIME_SIDECAR_PATH_CONSUMER_TEST_TARGETS],
|
||||
["ui/config/control-ui-chunking.ts", ["ui/src/ui/control-ui-chunking.test.ts"]],
|
||||
[
|
||||
"src/plugin-sdk/test-helpers/directory-ids.ts",
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import {
|
|||
shouldDelegateChangedCheckToCrabbox,
|
||||
shouldRunPromptSnapshotCheck,
|
||||
shouldRunPromptSnapshotOwnerTest,
|
||||
shouldRunRuntimeSidecarBaselineCheck,
|
||||
shouldRunShrinkwrapGuard,
|
||||
shouldRunTestTempCreationReport,
|
||||
createShrinkwrapGuardCommand,
|
||||
|
|
@ -1336,6 +1337,29 @@ describe("scripts/changed-lanes", () => {
|
|||
});
|
||||
});
|
||||
|
||||
it("runs runtime sidecar baseline checks for baseline owner surfaces", () => {
|
||||
expect(
|
||||
shouldRunRuntimeSidecarBaselineCheck([
|
||||
"scripts/generate-runtime-sidecar-paths-baseline.ts",
|
||||
"scripts/lib/bundled-runtime-sidecar-paths.json",
|
||||
"src/plugins/runtime-sidecar-paths-baseline.ts",
|
||||
"src/plugins/runtime-sidecar-paths.ts",
|
||||
]),
|
||||
).toBe(true);
|
||||
|
||||
const result = detectChangedLanes(["scripts/lib/bundled-runtime-sidecar-paths.json"]);
|
||||
const plan = createChangedCheckPlan(result);
|
||||
|
||||
expect(plan.commands).toContainEqual({
|
||||
name: "runtime sidecar baseline",
|
||||
args: ["runtime-sidecars:check"],
|
||||
});
|
||||
expect(plan.commands).toContainEqual({
|
||||
name: "runtime sidecar owner test",
|
||||
args: ["test:serial", "src/plugins/bundled-plugin-metadata.test.ts"],
|
||||
});
|
||||
});
|
||||
|
||||
it("guards release metadata package changes to the top-level version field", () => {
|
||||
const dir = makeTempRepoRoot(tempDirs, "openclaw-release-metadata-");
|
||||
git(dir, ["init", "-q", "--initial-branch=main"]);
|
||||
|
|
|
|||
|
|
@ -3423,6 +3423,33 @@ describe("scripts/test-projects changed-target routing", () => {
|
|||
}
|
||||
});
|
||||
|
||||
it("routes runtime sidecar baseline edits to baseline owner tests", () => {
|
||||
for (const target of [
|
||||
"scripts/generate-runtime-sidecar-paths-baseline.ts",
|
||||
"src/plugins/runtime-sidecar-paths-baseline.ts",
|
||||
]) {
|
||||
expect(resolveChangedTestTargetPlan([target])).toEqual({
|
||||
mode: "targets",
|
||||
targets: ["src/plugins/bundled-plugin-metadata.test.ts"],
|
||||
});
|
||||
}
|
||||
|
||||
for (const target of [
|
||||
"scripts/lib/bundled-runtime-sidecar-paths.json",
|
||||
"src/plugins/runtime-sidecar-paths.ts",
|
||||
]) {
|
||||
expect(resolveChangedTestTargetPlan([target])).toEqual({
|
||||
mode: "targets",
|
||||
targets: [
|
||||
"src/plugins/bundled-plugin-metadata.test.ts",
|
||||
"src/infra/update-global.test.ts",
|
||||
"src/infra/update-runner.test.ts",
|
||||
"test/openclaw-npm-postpublish-verify.test.ts",
|
||||
],
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
it.each([
|
||||
"test/vitest/vitest.agents-core.config.ts",
|
||||
"test/vitest/vitest.agents-embedded-agent.config.ts",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue