From bb06a8d4144178a10dc9deb8102b4b367bd064ac Mon Sep 17 00:00:00 2001 From: fangliquanflq Date: Tue, 18 Aug 2026 17:28:29 +0800 Subject: [PATCH] fix(dashboard): harden Node engine alignment checks --- contributors/emails/agent@agents-Mac-mini.local | 1 + scripts/install.ps1 | 8 ++++---- scripts/install.sh | 10 +++++----- tests-js/node-engine-alignment.test.ts | 5 +++++ 4 files changed, 15 insertions(+), 9 deletions(-) create mode 100644 contributors/emails/agent@agents-Mac-mini.local diff --git a/contributors/emails/agent@agents-Mac-mini.local b/contributors/emails/agent@agents-Mac-mini.local new file mode 100644 index 0000000000..850e0a4eb0 --- /dev/null +++ b/contributors/emails/agent@agents-Mac-mini.local @@ -0,0 +1 @@ +momomojo diff --git a/scripts/install.ps1 b/scripts/install.ps1 index 93a5933d83..f790c4ff39 100644 --- a/scripts/install.ps1 +++ b/scripts/install.ps1 @@ -1643,10 +1643,10 @@ function Set-GitBashEnvVar { Write-Info "If needed, set HERMES_GIT_BASH_PATH manually to your bash.exe path." } -# The dependency tree supports Node 22.22+, 24, and 26+. nanoid 6 deliberately -# excludes odd-numbered Node releases, so accepting Node 23/25 here only defers -# the failure to `npm ci` under engine-strict. Keep this in sync with the root -# package.json. +# The dependency tree supports Node 22.22+, 24, and 26+. nanoid 6 excludes +# Node 23 and 25 while its >=26 arm accepts later releases, so accepting 23/25 +# only defers the failure to `npm ci` under engine-strict. Keep this in sync +# with the root package.json. function Test-NodeVersionOk { param([string]$Version) try { diff --git a/scripts/install.sh b/scripts/install.sh index 2fb5d68016..67e326842e 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -882,11 +882,11 @@ check_cxx_compiler() { return 1 } -# The dependency tree supports Node 22.22+, 24, and 26+. nanoid 6 deliberately -# excludes odd-numbered Node releases, so accepting Node 23/25 here only defers -# the failure to `npm ci` under engine-strict. Keep this in sync with the root -# package.json. Anything outside the supported lines is replaced with the -# Hermes-managed Node $NODE_VERSION. +# The dependency tree supports Node 22.22+, 24, and 26+. nanoid 6 excludes +# Node 23 and 25 while its >=26 arm accepts later releases, so accepting 23/25 +# here only defers the failure to `npm ci` under engine-strict. Keep this in +# sync with the root package.json. Anything outside the supported lines is +# replaced with the Hermes-managed Node $NODE_VERSION. node_satisfies_build() { local ver="${1#v}" local major="${ver%%.*}" diff --git a/tests-js/node-engine-alignment.test.ts b/tests-js/node-engine-alignment.test.ts index ec91ac3c2b..b944f0903f 100644 --- a/tests-js/node-engine-alignment.test.ts +++ b/tests-js/node-engine-alignment.test.ts @@ -36,6 +36,11 @@ function compare(left: string, right: string): number { } function satisfiesClause(version: string, clause: string): boolean { + assert.match( + clause, + /^(?:\^|>=|<=|>|<|=)?\d+(?:\.\d+){0,2}$/, + `unsupported semver clause: ${clause}` + ) if (clause.startsWith('^')) { const bound = clause.slice(1) return parseVersion(version)[0] === parseVersion(bound)[0] && compare(version, bound) >= 0