apache / apache/maka

Node 23 satisfies engines >=22.19.0 but lacks node:sqlite isTransaction; every State Root open fails

Open
#5,290 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
5.4k
Forks
502
Avg merge
1d 2h
Merged PRs (30d)
715

Description

### What happened

Running Maka from source on Node.js 23.x (tested 23.7.0) fails to open any State Root. Every `createSessionStore()` / `acquireOperationalStateDatabase()` call throws:

```
OperationalStateMigrationBlockedError: cannot start a transaction within a transaction
at inspectAndMigrateOperationalState (packages/storage/dist/operational-state-store.js)
at new OperationalStateDatabaseOwner
at acquireOperationalStateDatabase
at new SqliteSessionStore
[cause]: Error: cannot start a transaction within a transaction (ERR_SQLITE_ERROR, errcode 1)
```

`npm run test:dist` reports several hundred failures across `@maka/storage`, `@maka/runtime`, and `@maka/runtime-host` with the same root cause.

**Root cause.** `inspectOperationalStateSchema` (`packages/storage/src/operational-state-store.ts`) guards its `BEGIN` with `if (database.isTransaction)`. `DatabaseSync.isTransaction` was added to `node:sqlite` in Node 22.16 and 24.0, but never landed on the 23.x line. On Node 23 the property is `undefined`, the guard is skipped, and the nested `BEGIN` fails.

**Why nothing warned.** The root `package.json` declares `"engines": { "node": ">=22.19.0" }`, which semver-accepts 23.x, so `npm install` is silent. CI only exercises 22.19.0 and 24, so the gap is invisible there. `scripts/release-cli-package.mjs` `validateNodeVersion()` has the same hole (`major < 22 || (major === 22 && minor < 19)`).

Expected: either the engines range excludes Node 23, or the storage layer does not depend on an API that is missing on a version the range accepts.

### How to reproduce

1. `nvm use 23` (any 23.x; 23.7.0 confirmed)
2. `node -e "const {DatabaseSync}=require('node:sqlite'); console.log(new DatabaseSync(':memory:').isTransaction)"` → prints `undefined`
3. `npm ci && npm run build && npm run test:dist`
4. Observe `cannot start a transaction within a transaction` from `operational-state-store` in storage / runtime / runtime-host suites.

### Environment

- Maka commit: fa25b3d01 (`main`)
- OS: macOS 15 (arm64)
- Surface: Runtime Host / from-source test run (`@maka/storage`)
- Node.js: v23.7.0, npm 10.9.2

### Additional context

Node 23 is EOL, so the pragmatic fix is to make the declared support range truthful rather than to add a fallback: `"node": "^22.19.0 || >=24.0.0"`, reject major 23 in `validateNodeVersion()`, and align README / CONTRIBUTING / CLI README wording. A PR with that change follows.

Contributor guide

Open the contributing guide

Research direction

Start with the root package.json engines range, packages/storage/src/operational-state-store.ts, and scripts/release-cli-package.mjs validateNodeVersion(); review the README, CONTRIBUTING, and CLI README wording as well. Reproduce with Node 23 and npm run test:dist, then make the supported-version declarations and validation consistent so Node 23 is rejected and the affected suites pass on supported versions.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
backend, cli, documentation, release
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.