gemini catch to trust#400
Conversation
| private hasNodeSqlite(): boolean { | ||
| const major = parseInt(process.versions.node.split('.')[0], 10); | ||
| return major >= 22; | ||
| } |
There was a problem hiding this comment.
🟡 hasNodeSqlite() checks only major version, not minor, despite comment stating Node 22.5+ requirement
The hasNodeSqlite() method only checks major >= 22 but the comment and inline documentation explicitly state that node:sqlite requires Node 22.5+. On Node 22.0 through 22.4, node:sqlite is not available, yet this method returns true.
Root Cause and Impact
The method at packages/storage/src/sqlite-adapter.ts:76-79 says:
/** node:sqlite is only available in Node 22.5+ */
private hasNodeSqlite(): boolean {
const major = parseInt(process.versions.node.split('.')[0], 10);
return major >= 22;
}
This is used in init() at line 123 (const canUseNodeSqlite = this.hasNodeSqlite()) to decide whether to include the node driver in attempts and whether to filter it out (lines 135, 139-141). On Node 22.0–22.4, canUseNodeSqlite is incorrectly true, so 'node' is included in the attempts list and NOT filtered out.
The same incorrect pattern is replicated in the test file at packages/storage/src/sqlite-adapter.test.ts:19-22 and line 25, where tests use major >= 22 to decide whether to skip node:sqlite–related tests.
Impact: On Node 22.0–22.4, the adapter will attempt to load node:sqlite (which doesn't exist), trigger an error log ([storage] SQLite driver "node" failed: ...), and fall back to the next driver. The try/catch in openDatabase prevents a crash, but this produces confusing error output. In the test file, the 'can force node sqlite driver' test would not be skipped and would fail on those versions.
| private hasNodeSqlite(): boolean { | |
| const major = parseInt(process.versions.node.split('.')[0], 10); | |
| return major >= 22; | |
| } | |
| /** node:sqlite is only available in Node 22.5+ */ | |
| private hasNodeSqlite(): boolean { | |
| const [majorStr, minorStr] = process.versions.node.split('.'); | |
| const major = parseInt(majorStr, 10); | |
| const minor = parseInt(minorStr, 10); | |
| return major > 22 || (major === 22 && minor >= 5); | |
| } |
Was this helpful? React with 👍 or 👎 to provide feedback.
Uh oh!
There was an error while loading. Please reload this page.