Skip to content

fix(database): make effect-db Node-native#13

Merged
relsunkaev merged 27 commits into
mainfrom
fix/node-effect-db-cli
Jul 23, 2026
Merged

fix(database): make effect-db Node-native#13
relsunkaev merged 27 commits into
mainfrom
fix/node-effect-db-cli

Conversation

@relsunkaev

Copy link
Copy Markdown
Owner

Makes the published packages Node-native across 26 files; local build, type, package, and Node 22/24 integration gates pass. Next step is v0.21.0 after merge.

Why

effect-db consumers currently inherit Bun requirements from the CLI and several published runtime paths even though Effect supports Node directly.

  • The binary should run with Node without requiring Bun on the consumer's PATH.
  • Host I/O should stay behind Effect Platform so another runtime can provide the same services.
  • Bun remains the workspace package manager and build/test tool.
  • CLI logs need stable stdout/stderr behavior and Effect CLI log-level control.

Key Changes

Node runtime:

  • runs the published CLI through Effect's Node runtime and services
  • removes published Bun.* runtime dependencies
  • keeps Promise APIs compatible through one Node platform adapter
  • typechecks production sources without Bun ambient globals

Portable host services:

  • routes filesystem, path, crypto, and terminal access through Effect Platform
  • keeps Node-specific implementations at the application/runtime boundary
  • preserves source discovery behavior, including dot files and followed symlinks

CLI behavior:

  • reserves stdout for plans and status output
  • sends info, warning, debug, and fatal diagnostics to stderr
  • supports Effect CLI's built-in --log-level, including debug and none
  • preserves process exit codes while avoiding duplicate fatal logging

Verification:

  • exercises the built CLI with a real PostgreSQL database under Node
  • installs packed tarballs and runs an actual packed CLI database command with Bun absent from PATH
  • runs the integration suite on Node 22 and Node 24
  • adds injected-service tests for config, migration reads/writes, and pull writes

Mechanical changes:

  • pins the workspace Bun version used by CI
  • adds Node-only production typecheck configuration
  • records the Bun tooling and Node consumer boundaries in repository instructions

Risks & Testing Needed

Effect v4 beta APIs: the runtime and CLI use beta.98 platform primitives.
→ Keep the packed consumer and Node matrix checks required in CI.

Integration cost: the live suite now runs twice, once for each supported Node major.
→ The jobs run in parallel; Node 22 took about two minutes locally.

Source loading: discovery still uses dynamic module imports and tinyglobby for existing glob semantics.
→ Review changes to config/source loading carefully if supported extensions change later.

Not tested:

  • Windows runtime behavior
  • Node versions outside 22 and 24

Build status: pass locally on Node 22 and Node 24

Test Plan

bun test
bun run build
bun run test:types
bun run test:pack
bun run test:integration
mise x node@22 -- bun run test:integration

Expected:

  • 538 behavior tests pass
  • 56 live integration tests pass on both Node majors
  • packed effect-db loads config, reads/writes migrations, applies pull output, and plans PostgreSQL changes
  • fatal CLI failures write nothing to stdout and report on stderr

Rollback

git revert -m 1 <merge-commit>

This restores the Bun-bound published runtime and the previous single-version CI coverage.

Use Effect Node services and Node-compatible filesystem operations so published commands no longer require Bun. Keep Bun limited to workspace tooling and remove it from consumer engine metadata.
Exercise the packed config, migration, pull, and CLI paths under Node.js with Bun excluded from the CLI PATH.
@relsunkaev
relsunkaev merged commit 80bc6d7 into main Jul 23, 2026
5 checks passed
@relsunkaev
relsunkaev deleted the fix/node-effect-db-cli branch July 23, 2026 00:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant