From d46b64df6663ccfd436b51296ca68d7acfd0fa90 Mon Sep 17 00:00:00 2001 From: Vincent Koc Date: Sun, 21 Jun 2026 08:24:56 +0200 Subject: [PATCH] test(scripts): gate runtime sidecar baseline changes --- scripts/check-changed.mjs | 13 +++++++++++++ scripts/test-projects.test-support.mjs | 23 +++++++++++++--------- test/scripts/changed-lanes.test.ts | 24 +++++++++++++++++++++++ test/scripts/test-projects.test.ts | 27 ++++++++++++++++++++++++++ 4 files changed, 78 insertions(+), 9 deletions(-) diff --git a/scripts/check-changed.mjs b/scripts/check-changed.mjs index 15c58f98844..5cd3c1324df 100644 --- a/scripts/check-changed.mjs +++ b/scripts/check-changed.mjs @@ -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) { diff --git a/scripts/test-projects.test-support.mjs b/scripts/test-projects.test-support.mjs index b9b5e1be10c..8f5fb72e1bd 100644 --- a/scripts/test-projects.test-support.mjs +++ b/scripts/test-projects.test-support.mjs @@ -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", diff --git a/test/scripts/changed-lanes.test.ts b/test/scripts/changed-lanes.test.ts index 9723b2e9238..9ad3f6fb207 100644 --- a/test/scripts/changed-lanes.test.ts +++ b/test/scripts/changed-lanes.test.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"]); diff --git a/test/scripts/test-projects.test.ts b/test/scripts/test-projects.test.ts index 94235942b01..8a573dbe762 100644 --- a/test/scripts/test-projects.test.ts +++ b/test/scripts/test-projects.test.ts @@ -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",