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: reject unsupported Node before pregate starts checks (#9379)

[._.]/ Adam Eivyf54b2802fa04
diff --git a/scripts/pregate.js b/scripts/pregate.js
index b0d75ffc69..45af1d2bc7 100644
--- a/scripts/pregate.js
+++ b/scripts/pregate.js
@@ -36,6 +36,7 @@ import { execFileSync } from 'child_process';
import { dirname, join } from 'path';
import { fileURLToPath } from 'url';
import { ALWAYS_RUN_TESTS } from './ci-test-plan.js';
+import { assertNodeVersion } from './checkNodeVersion.js';
import { isDirectlyInvoked } from './lib/directInvocation.js';
const REPO_ROOT = join(dirname(fileURLToPath(import.meta.url)), '..');
@@ -185,6 +186,8 @@ export function parseArgs(argv) {
}
function main() {
+ assertNodeVersion();
+
const unmerged = spawnSync('git', ['ls-files', '-u', '-z'], { cwd: REPO_ROOT, encoding: 'utf8' });
if (unmerged.status !== 0) {
console.error(`❌ Cannot inspect the Git index for unresolved conflicts: ${unmerged.stderr || 'git ls-files failed'}`);
diff --git a/scripts/pregate.test.js b/scripts/pregate.test.js
index 28c68e3ce5..c535328e2c 100644
--- a/scripts/pregate.test.js
+++ b/scripts/pregate.test.js
@@ -117,7 +117,7 @@ describe('pregate hidden-content invocation', () => {
// Copy the real builtin-only entrypoints so REPO_ROOT targets this fixture.
// No runners or test files: docs-only changes produce an empty test plan.
for (const path of [
- 'scripts/pregate.js', 'scripts/scan-diff-hidden-content.js',
+ 'scripts/pregate.js', 'scripts/checkNodeVersion.js', 'scripts/scan-diff-hidden-content.js',
'scripts/ci-test-plan.js', 'scripts/ci-base-sha.js',
'scripts/lib/directInvocation.js', 'scripts/lib/githubOutput.js',
'server/lib/diffHiddenContentScan.js', 'server/lib/modelAbuseGuard.js',
@@ -300,6 +300,29 @@ describe('UNCOVERED_SUITES', () => {
});
describe('the gate end to end', () => {
+ // This catches validation deferred until after Git/planning, even when no
+ // expensive check would run (plan-only). Every subprocess is a tripwire.
+ it.each([{ flags: [] }, { flags: ['--full'] }, { flags: ['--plan-only'] }])('rejects unsupported Node before any subprocess with flags $flags', ({ flags }) => {
+ const preload = `
+ import childProcess from 'node:child_process';
+ import { syncBuiltinESMExports } from 'node:module';
+ Object.defineProperty(process.versions, 'node', { value: '24.14.1' });
+ const unexpectedSubprocess = () => { throw new Error('Subprocess started before runtime validation'); };
+ childProcess.spawnSync = unexpectedSubprocess;
+ childProcess.execFileSync = unexpectedSubprocess;
+ syncBuiltinESMExports();
+ `;
+ const result = spawnSync(process.execPath, [
+ '--import', `data:text/javascript,${encodeURIComponent(preload)}`,
+ join(REPO_ROOT, 'scripts', 'pregate.js'), ...flags,
+ ], { cwd: REPO_ROOT, encoding: 'utf8' });
+ expect(result.status).toBe(1);
+ expect(result.stderr).toContain('required (found v24.14.1)');
+ expect(result.stderr).toContain('see .nvmrc');
+ expect(result.stderr).not.toContain('Subprocess started');
+ expect(result.stdout).toBe('');
+ });
+
it('passes an uncommitted new test through the planner override', () => {
const root = mkdtempSync(join(tmpdir(), 'portos-pregate-'));
const git = (...args) => execFileSync('git', args, { cwd: root, encoding: 'utf8' }).trim();
@@ -373,7 +396,7 @@ describe('the gate end to end', () => {
git('config', 'user.name', 'Example Contributor');
git('config', 'user.email', '[email protected]');
for (const path of [
- 'scripts/pregate.js', 'scripts/scan-diff-hidden-content.js',
+ 'scripts/pregate.js', 'scripts/checkNodeVersion.js', 'scripts/scan-diff-hidden-content.js',
'scripts/ci-test-plan.js', 'scripts/ci-base-sha.js',
'scripts/lib/directInvocation.js', 'scripts/lib/githubOutput.js',
'server/lib/diffHiddenContentScan.js', 'server/lib/modelAbuseGuard.js',