From f9ebb8d91beabc3233a4d55afc0bcaea38f57a4e Mon Sep 17 00:00:00 2001 From: Vincent Koc Date: Mon, 22 Jun 2026 15:33:01 +0800 Subject: [PATCH] chore(deadcode): remove unused plugin version validator --- scripts/lib/bundled-extension-manifest.ts | 11 +++++++++-- src/plugins/min-host-version.test.ts | 7 ++----- src/plugins/min-host-version.ts | 8 -------- 3 files changed, 11 insertions(+), 15 deletions(-) diff --git a/scripts/lib/bundled-extension-manifest.ts b/scripts/lib/bundled-extension-manifest.ts index 38d8dc6fb89..11ab1f0899e 100644 --- a/scripts/lib/bundled-extension-manifest.ts +++ b/scripts/lib/bundled-extension-manifest.ts @@ -1,5 +1,8 @@ // Bundled Extension Manifest script supports OpenClaw repository automation. -import { validateMinHostVersion } from "../../src/plugins/min-host-version.ts"; +import { + MIN_HOST_VERSION_FORMAT, + parseMinHostVersionRequirement, +} from "../../src/plugins/min-host-version.ts"; import { isRecord } from "../../src/utils.js"; export type ExtensionPackageJson = { @@ -35,7 +38,11 @@ export function collectBundledExtensionManifestErrors(extensions: BundledExtensi `bundled extension '${extension.id}' manifest invalid | openclaw.install.npmSpec must be a non-empty string`, ); } - const minHostVersionError = validateMinHostVersion(install?.minHostVersion); + const minHostVersionError = + install?.minHostVersion === undefined || + parseMinHostVersionRequirement(install.minHostVersion) + ? null + : MIN_HOST_VERSION_FORMAT; if (minHostVersionError) { errors.push(`bundled extension '${extension.id}' manifest invalid | ${minHostVersionError}`); } diff --git a/src/plugins/min-host-version.test.ts b/src/plugins/min-host-version.test.ts index a3a60c8f494..9db9adf278f 100644 --- a/src/plugins/min-host-version.test.ts +++ b/src/plugins/min-host-version.test.ts @@ -4,7 +4,6 @@ import { checkMinHostVersion, MIN_HOST_VERSION_FORMAT, parseMinHostVersionRequirement, - validateMinHostVersion, } from "./min-host-version.js"; const MIN_HOST_REQUIREMENT = { @@ -40,8 +39,7 @@ function expectHostCheckResult(params: { ).toEqual(params.expected); } -function expectInvalidMinHostVersion(minHostVersion: string | number) { - expect(validateMinHostVersion(minHostVersion)).toBe(MIN_HOST_VERSION_FORMAT); +function expectInvalidHostCheck(minHostVersion: string | number) { expectHostCheckResult({ currentVersion: "2026.3.22", minHostVersion, @@ -55,7 +53,6 @@ function expectInvalidMinHostVersion(minHostVersion: string | number) { describe("min-host-version", () => { it("accepts empty metadata", () => { - expect(validateMinHostVersion(undefined)).toBeNull(); expect(parseMinHostVersionRequirement(undefined)).toBeNull(); expectValidHostCheck("2026.3.22"); }); @@ -92,7 +89,7 @@ describe("min-host-version", () => { it.each(["2026.3.22", 123, ">=2026.3.22 garbage"] as const)( "rejects invalid floor syntax and host checks: %p", (minHostVersion) => { - expectInvalidMinHostVersion(minHostVersion); + expectInvalidHostCheck(minHostVersion); }, ); diff --git a/src/plugins/min-host-version.ts b/src/plugins/min-host-version.ts index 11ee7395339..dff5032b2f7 100644 --- a/src/plugins/min-host-version.ts +++ b/src/plugins/min-host-version.ts @@ -56,14 +56,6 @@ export function parseMinHostVersionRequirement( }; } -/** Validates a plugin minHostVersion manifest field for schema/reporting callers. */ -export function validateMinHostVersion(raw: unknown): string | null { - if (raw === undefined) { - return null; - } - return parseMinHostVersionRequirement(raw) ? null : MIN_HOST_VERSION_FORMAT; -} - /** Checks whether the current host satisfies a plugin minHostVersion requirement. */ export function checkMinHostVersion(params: { currentVersion: string | undefined;