Skip to content

Unify SQLite client import for bun/node and ensure setup layer receives SQLite client#6

Merged
Josh-wt merged 2 commits intomainfrom
codex/fix-service-not-found-error-9ckusd
Apr 11, 2026
Merged

Unify SQLite client import for bun/node and ensure setup layer receives SQLite client#6
Josh-wt merged 2 commits intomainfrom
codex/fix-service-not-found-error-9ckusd

Conversation

@Josh-wt
Copy link
Copy Markdown
Owner

@Josh-wt Josh-wt commented Apr 11, 2026

Motivation

  • Ensure the SQLite setup code runs with an actual SqlClient available and unify the SQLite client import across runtimes.

Description

  • Replace the bun-specific import with the shared NodeSqliteClient loader so both bun and node use the same client module.
  • Create a sqliteLayer and merge it with setup while explicitly providing sqliteLayer to setup so the PRAGMA calls and migrations run with a real SqlClient.
  • Apply the same merge/provide pattern for the in-memory persistence layer (:memory:) to ensure consistent behavior.

Testing

  • Ran the project typecheck and build (tsc) and the test suite (pnpm test); both completed successfully.

Codex Task


Summary by cubic

Fixes the "service not found" error during SQLite setup by providing a real SqlClient, unifying the client import for bun/node, and reducing layer conflicts. Migrations and PRAGMA now run reliably in both runtimes.

  • Bug Fixes

    • Use the shared NodeSqliteClient loader for both bun and node.
    • Provide the runtime SQLite layer to setup so PRAGMA and migrations run with a real SqlClient, including for :memory:.
  • Refactors

    • Reordered Layer.provideMerge so the runtime SQLite layer is merged before setup to reduce service conflicts.

Written for commit 1367f54. Summary will update on new commits.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 11, 2026

Warning

Rate limit exceeded

@Josh-wt has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 0 minutes and 53 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 0 minutes and 53 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d8ff17b1-9397-49b5-a438-500c56d10b16

📥 Commits

Reviewing files that changed from the base of the PR and between 6d1c5d1 and 1367f54.

📒 Files selected for processing (1)
  • apps/server/src/persistence/Layers/Sqlite.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/fix-service-not-found-error-9ckusd

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3a2ca3ae7c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

};
const defaultSqliteClientLoaders = {
bun: () => import("@effect/sql-sqlite-bun/SqliteClient"),
bun: () => import("../NodeSqliteClient.ts"),
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Use Bun-compatible SQLite client for bun runtime

Changing the bun loader to ../NodeSqliteClient.ts makes Bun executions take the Node path that imports node:sqlite, which is not available in Bun, so the server can fail at startup in the default Bun dev flow (apps/server uses bun run src/bin.ts). This is a runtime regression introduced by this commit: previously the Bun branch loaded @effect/sql-sqlite-bun/SqliteClient, which is the Bun-targeted client.

Useful? React with 👍 / 👎.

@Josh-wt Josh-wt merged commit b62aeb4 into main Apr 11, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant