Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix: strip the v prefix before the pin shape test and when reporting the found version (#3863)

[._.]/ Adam Eivyda73cc3d0c4b
diff --git a/scripts/checkNodeVersion.js b/scripts/checkNodeVersion.js
index 855cdea972..ac57c3b9f6 100644
--- a/scripts/checkNodeVersion.js
+++ b/scripts/checkNodeVersion.js
@@ -57,7 +57,7 @@ export function satisfiesMinNode(version = process.versions.node) {
/** The one-line failure message, mirroring the shape the shell gates print. */
export function unsupportedNodeMessage(version = process.versions.node) {
- return `Node.js ${MIN_NODE}+ required (found v${String(version).replace(/^v/, '')}) — see .nvmrc`;
+ return `Node.js ${MIN_NODE}+ required (found v${String(version).trim().replace(/^v/, '')}) — see .nvmrc`;
}
/**
diff --git a/scripts/checkNodeVersion.test.js b/scripts/checkNodeVersion.test.js
index 6ebb18d061..5ba313a369 100644
--- a/scripts/checkNodeVersion.test.js
+++ b/scripts/checkNodeVersion.test.js
@@ -85,5 +85,6 @@ describe('assertNodeVersion', () => {
it('does not double up the v prefix', () => {
expect(unsupportedNodeMessage('v18.0.0')).toContain('found v18.0.0');
expect(unsupportedNodeMessage('18.0.0')).toContain('found v18.0.0');
+ expect(unsupportedNodeMessage(' v18.0.0 ')).toContain('found v18.0.0');
});
});
diff --git a/scripts/node-version-drift.test.js b/scripts/node-version-drift.test.js
index 4ba99edcd5..c015736938 100644
--- a/scripts/node-version-drift.test.js
+++ b/scripts/node-version-drift.test.js
@@ -37,7 +37,9 @@ const readJson = (rel) => JSON.parse(read(rel));
* and clears a 22.12 floor; `22.10.0` names a real version and does not.
*/
function pinSatisfiesFloor(pin) {
- const raw = String(pin).trim();
+ // Strip a leading `v` before the shape test below, or `v22.10.0` would read
+ // as "no explicit minor" and be waved through as a release-line pin.
+ const raw = String(pin).trim().replace(/^v/, '');
const [major] = parseVersion(raw);
if (major !== MIN_MAJOR) return major > MIN_MAJOR;
if (!/^\d+\.\d/.test(raw)) return true;
@@ -61,6 +63,7 @@ describe('Node version floor has exactly one owner (issue #3863)', () => {
expect(pinSatisfiesFloor('22')).toBe(true); // the 22 line resolves above 22.12
expect(pinSatisfiesFloor('22.12.0')).toBe(true);
expect(pinSatisfiesFloor('22.10.0')).toBe(false);
+ expect(pinSatisfiesFloor('v22.10.0')).toBe(false);
expect(pinSatisfiesFloor('20.19.0')).toBe(false);
expect(pinSatisfiesFloor('18')).toBe(false);
});