fix(setup): align Node runtime checks with package engines
This commit is contained in:
@@ -19,13 +19,27 @@ describe("doctor", () => {
|
||||
result.checks.map(({ name, remediation }) => [name, remediation]),
|
||||
),
|
||||
).toEqual({
|
||||
node: "Install Node.js 22.19+ or 24.11+.",
|
||||
node: "Install Node.js 22.x (>=22.19), 24.x (>=24.11), or 26+.",
|
||||
host: "REA supports macOS 12+, Ubuntu 24.04+, Fedora 41+, 64-bit Arch Linux, and the experimental Windows x64 Ghidra P0 boundary.",
|
||||
hopper: "Run rea setup to install Hopper, or set HOPPER_LAUNCHER_PATH.",
|
||||
target: "Supply a readable local app or program path.",
|
||||
});
|
||||
});
|
||||
|
||||
it("reports Node 25 as unsupported", async () => {
|
||||
const result = await runDoctor(undefined, host({ nodeVersion: "25.1.0" }));
|
||||
|
||||
expect(result.healthy).toBe(false);
|
||||
expect(result.checks).toContainEqual(
|
||||
expect.objectContaining({
|
||||
name: "node",
|
||||
ok: false,
|
||||
detail: "25.1.0",
|
||||
classification: "missing_dependency",
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
it.each(["11.7", undefined])(
|
||||
"rejects unsupported macOS version %s",
|
||||
async (version) => {
|
||||
|
||||
@@ -92,7 +92,7 @@ export const doctorHealthy = (
|
||||
|
||||
const nodeCheck = (host: DoctorHost): DoctorCheck =>
|
||||
check("node", supportsNodeVersion(host.nodeVersion), host.nodeVersion, {
|
||||
remediation: "Install Node.js 22.19+ or 24.11+.",
|
||||
remediation: "Install Node.js 22.x (>=22.19), 24.x (>=24.11), or 26+.",
|
||||
classification: "missing_dependency",
|
||||
});
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ import type { ClientRegistrationStatus } from "./ClientRegistrationStatus.js";
|
||||
/** Recording setup host for service-level planning and recovery tests. */
|
||||
export class FakeSetupHost implements SetupHost {
|
||||
readonly platform: NodeJS.Platform;
|
||||
nodeVersion = "25.1.0";
|
||||
nodeVersion = "24.18.0";
|
||||
version: string | undefined = "14.5";
|
||||
distribution: LinuxDistribution | undefined;
|
||||
hopper: string | undefined;
|
||||
|
||||
@@ -4,6 +4,23 @@ import { FakeSetupHost, options } from "./Setup.fixture.js";
|
||||
import { runSetup } from "./Setup.js";
|
||||
|
||||
describe("setup workflow", () => {
|
||||
it("rejects Node 25 before applying setup actions", async () => {
|
||||
const host = new FakeSetupHost();
|
||||
host.nodeVersion = "25.1.0";
|
||||
host.clients = [{ name: "codex", configPath: "/codex.toml" }];
|
||||
|
||||
const result = await runSetup(
|
||||
{ ...options(true, true), installSkill: true, clientIds: ["codex"] },
|
||||
host,
|
||||
);
|
||||
|
||||
expect(result.status).toBe("needs_human");
|
||||
expect(result.appliedActions).toEqual([]);
|
||||
expect(host.hopperInstalls).toBe(0);
|
||||
expect(host.configurations).toBe(0);
|
||||
expect(host.skillInstalls).toBe(0);
|
||||
});
|
||||
|
||||
it("records every detected client outcome after an earlier failure", async () => {
|
||||
const host = new FakeSetupHost();
|
||||
host.hopper = "/Applications/Hopper";
|
||||
@@ -105,7 +122,7 @@ describe("setup scoped readiness", () => {
|
||||
const nodeHost = new FakeSetupHost();
|
||||
nodeHost.nodeVersion = "20.0.0";
|
||||
expect((await runSetup(options(true), nodeHost)).remediation).toBe(
|
||||
"Install Node.js 22.19+ or 24.11+ and rerun setup.",
|
||||
"Install Node.js 22.x (>=22.19), 24.x (>=24.11), or 26+ and rerun setup.",
|
||||
);
|
||||
|
||||
const macHost = new FakeSetupHost();
|
||||
|
||||
@@ -63,7 +63,7 @@ export const hostRemediation = async (
|
||||
installHopper: boolean,
|
||||
): Promise<string | undefined> => {
|
||||
if (!supportsNodeVersion(host.nodeVersion))
|
||||
return "Install Node.js 22.19+ or 24.11+ and rerun setup.";
|
||||
return "Install Node.js 22.x (>=22.19), 24.x (>=24.11), or 26+ and rerun setup.";
|
||||
if (!installHopper) return undefined;
|
||||
if (host.platform !== "darwin" && host.platform !== "linux")
|
||||
return "REA supports Hopper on macOS and selected 64-bit Linux distributions.";
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { supportsNodeVersion } from "./runtimeVersion.js";
|
||||
|
||||
describe("supported Node.js versions", () => {
|
||||
it.each([
|
||||
["20.0.0", false],
|
||||
["22.18.9", false],
|
||||
["22.19.0", true],
|
||||
["22.99.0", true],
|
||||
["23.0.0", false],
|
||||
["24.10.9", false],
|
||||
["24.11.0", true],
|
||||
["24.99.0", true],
|
||||
["25.1.0", false],
|
||||
["26.0.0", true],
|
||||
["27.0.0", true],
|
||||
["24.11.0-rc.1", false],
|
||||
["26.0.0-nightly.20261001", false],
|
||||
["24.11", false],
|
||||
["24.11.invalid", false],
|
||||
["invalid", false],
|
||||
])("classifies %s as supported=%s", (version, expected) => {
|
||||
expect(supportsNodeVersion(version)).toBe(expected);
|
||||
});
|
||||
});
|
||||
@@ -1,10 +1,8 @@
|
||||
import { satisfies } from "semver";
|
||||
|
||||
/** Supported runtime range, kept in sync with the published package engines. */
|
||||
export const SUPPORTED_NODE_VERSION_RANGE = "^22.19.0 || ^24.11.0 || >=26.0.0";
|
||||
|
||||
/** Return whether a Node.js version satisfies REA's tested runtime families. */
|
||||
export const supportsNodeVersion = (version: string): boolean => {
|
||||
const [majorText = "", minorText = ""] = version.split(".");
|
||||
const major = Number.parseInt(majorText, 10);
|
||||
const minor = Number.parseInt(minorText, 10);
|
||||
return (
|
||||
(major === 22 && minor >= 19) ||
|
||||
(major >= 24 && (major !== 24 || minor >= 11))
|
||||
);
|
||||
};
|
||||
export const supportsNodeVersion = (version: string): boolean =>
|
||||
satisfies(version, SUPPORTED_NODE_VERSION_RANGE);
|
||||
|
||||
Reference in New Issue
Block a user