18f7ec02c0
WAL + busy_timeout were already enabled, so the issue's suggested fix was a no-op. The real causes, addressed here: - busy_timeout is now set first (before journal_mode) and lowered 120s -> 5s, so open-time pragmas wait out a lock instead of hanging for two minutes. - getCodeGraph no longer opens a second connection to the default project when a tool passes its own projectPath (the in-process lock amplifier). - The wasm fallback (no WAL) gets a bounded read-retry on SQLITE_BUSY. - New: node:sqlite backend, preferred over wasm, so installs whose native better-sqlite3 build fails land on a real-WAL backend instead of no-WAL wasm. - codegraph status / codegraph_status now report the effective journal mode, so a lock report is triageable (wal vs delete). - CLI hard-blocks Node < 20 to actually enforce the engines floor. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
70 lines
2.5 KiB
TypeScript
70 lines
2.5 KiB
TypeScript
/**
|
|
* Pin the Node-25 block banner content. The banner replaced a soft
|
|
* `console.warn` because the warning was scrolling off-screen before
|
|
* the OOM crash 30 seconds later, generating duplicate bug reports
|
|
* (#54, #81, #140). The recipe and override env var below are
|
|
* load-bearing — if any of them get edited away, this test catches it.
|
|
*/
|
|
|
|
import { describe, it, expect } from 'vitest';
|
|
import { buildNode25BlockBanner, buildNodeTooOldBanner, MIN_NODE_MAJOR } from '../src/bin/node-version-check';
|
|
|
|
describe('buildNode25BlockBanner', () => {
|
|
it('embeds the reported Node version in the header', () => {
|
|
expect(buildNode25BlockBanner('25.9.0')).toContain(
|
|
'Unsupported Node.js version: 25.9.0'
|
|
);
|
|
});
|
|
|
|
it('names the V8 turboshaft WASM root cause and the OOM symptom', () => {
|
|
const banner = buildNode25BlockBanner('25.7.0');
|
|
expect(banner).toContain('V8 WASM JIT');
|
|
expect(banner).toContain('turboshaft');
|
|
expect(banner).toContain('Fatal process out of memory: Zone');
|
|
});
|
|
|
|
it('points users to Node 22 LTS via nvm and Homebrew', () => {
|
|
const banner = buildNode25BlockBanner('25.7.0');
|
|
expect(banner).toContain('Node.js 22 LTS');
|
|
expect(banner).toContain('nvm install 22');
|
|
expect(banner).toContain('brew install node@22');
|
|
});
|
|
|
|
it('documents the CODEGRAPH_ALLOW_UNSAFE_NODE override', () => {
|
|
const banner = buildNode25BlockBanner('25.7.0');
|
|
expect(banner).toContain('CODEGRAPH_ALLOW_UNSAFE_NODE=1');
|
|
});
|
|
|
|
it('links to issue #81 for the root-cause writeup', () => {
|
|
expect(buildNode25BlockBanner('25.7.0')).toContain(
|
|
'github.com/colbymchenry/codegraph/issues/81'
|
|
);
|
|
});
|
|
});
|
|
|
|
describe('buildNodeTooOldBanner', () => {
|
|
it('embeds the reported Node version in the header', () => {
|
|
expect(buildNodeTooOldBanner('18.20.0')).toContain(
|
|
'Unsupported Node.js version: 18.20.0'
|
|
);
|
|
});
|
|
|
|
it('states the supported floor matching MIN_NODE_MAJOR', () => {
|
|
expect(MIN_NODE_MAJOR).toBe(20);
|
|
expect(buildNodeTooOldBanner('18.0.0')).toContain(
|
|
`requires Node.js ${MIN_NODE_MAJOR} or newer`
|
|
);
|
|
});
|
|
|
|
it('points users to Node 22 LTS via nvm and Homebrew', () => {
|
|
const banner = buildNodeTooOldBanner('16.0.0');
|
|
expect(banner).toContain('Node.js 22 LTS');
|
|
expect(banner).toContain('nvm install 22');
|
|
expect(banner).toContain('brew install node@22');
|
|
});
|
|
|
|
it('documents the CODEGRAPH_ALLOW_UNSAFE_NODE override', () => {
|
|
expect(buildNodeTooOldBanner('18.0.0')).toContain('CODEGRAPH_ALLOW_UNSAFE_NODE=1');
|
|
});
|
|
});
|