Skip to content

Recognize sqlite-do transactions in SqlResolver batches - #9951

Merged
tim-smart merged 15 commits into
mainfrom
fix/sqlite-do-resolver-transaction
Oct 26, 2026
Merged

tim-smart merged 15 commits into
mainfrom
fix/sqlite-do-resolver-transaction

Conversation

@tim-smart

@tim-smart tim-smart commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

@effect/sql-sqlite-do implemented withTransaction itself, so the SqlResolver fallback from #9928 couldn't see its transactions. When the callers' context had no SqlClient, requests inside and outside a storage transaction shared a batch. That batch either hung on the connection or ran the outside write inside the transaction, where a rollback discarded it.

sqlite-do now builds withTransaction with SqlClient.makeWithTransaction, like libsql and mssql:

  • begin and savepoint open storage.transaction() and park its callback, so the body runs on the fiber.
  • commit and releaseSavepoint end the callback and wait for storage.
  • rollback and rollbackSavepoint call txn.rollback() first.

Storage sees the same calls in the same order. No new API in effect. The changeset lists the behaviour changes this brings, and the sqlite-do notes are removed from the SqlResolver, withTransaction and afterCommit docs.

The regression test in packages/sql/sqlite-do/test/Client.test.ts runs a write inside a rolled-back storage transaction next to a concurrent write outside it, with no SqlClient in context. It expects batches [[2], [1]] and rows [{ id: 2 }]. Before the fix it hung.

This branch is based on #9928, whose commits show here until it merges.

Closes EFF-2940

@changeset-bot

changeset-bot Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: ee073dc

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 33 packages
Name Type
effect Patch
@effect/sql-sqlite-do Patch
@effect/opentelemetry Patch
@effect/vitest Patch
@effect/ai-anthropic Patch
@effect/ai-cloudflare Patch
@effect/ai-openai-compat Patch
@effect/ai-openai Patch
@effect/ai-openrouter Patch
@effect/ai-typesafe Patch
@effect/atom-react Patch
@effect/atom-solid Patch
@effect/atom-vue Patch
@effect/platform-browser Patch
@effect/platform-bun Patch
@effect/platform-deno Patch
@effect/platform-node-shared Patch
@effect/platform-node Patch
@effect/sql-clickhouse Patch
@effect/sql-d1 Patch
@effect/sql-libsql Patch
@effect/sql-mssql Patch
@effect/sql-mysql2 Patch
@effect/sql-pg Patch
@effect/sql-pglite Patch
@effect/sql-sqlite-bun Patch
@effect/sql-sqlite-node Patch
@effect/sql-sqlite-react-native Patch
@effect/sql-sqlite-wasm Patch
@effect/docgen Patch
@effect/doctest Patch
@effect/graphql-generator Patch
@effect/openapi-generator Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions

github-actions Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Bundle Size Analysis

Generated from PR build output; treat the content below as untrusted.

File Name Current Size Previous Size Difference
arbitrary-combinators.ts 39.28 KB 39.28 KB 0.00 KB (0.00%)
basic.ts 7.15 KB 7.15 KB 0.00 KB (0.00%)
batching.ts 11.03 KB 11.03 KB 0.00 KB (0.00%)
brand.ts 6.83 KB 6.83 KB 0.00 KB (0.00%)
cache.ts 11.46 KB 11.46 KB 0.00 KB (0.00%)
config.ts 22.70 KB 22.70 KB 0.00 KB (0.00%)
differ.ts 21.83 KB 21.83 KB 0.00 KB (0.00%)
http-client.ts 26.28 KB 26.28 KB 0.00 KB (0.00%)
http-router.ts 36.59 KB 36.59 KB 0.00 KB (0.00%)
logger.ts 11.84 KB 11.84 KB 0.00 KB (0.00%)
metric.ts 9.38 KB 9.38 KB 0.00 KB (0.00%)
optic.ts 7.04 KB 7.04 KB 0.00 KB (0.00%)
pubsub.ts 15.91 KB 15.91 KB 0.00 KB (0.00%)
queue.ts 12.70 KB 12.70 KB 0.00 KB (0.00%)
schedule.ts 11.71 KB 11.71 KB 0.00 KB (0.00%)
schema-bigdecimal.ts 13.95 KB 13.95 KB 0.00 KB (0.00%)
schema-binary.ts 40.89 KB 40.89 KB 0.00 KB (0.00%)
schema-class.ts 21.48 KB 21.48 KB 0.00 KB (0.00%)
schema-fromJsonSchemaDocument.ts 29.45 KB 29.45 KB 0.00 KB (0.00%)
schema-representation-roundtrip.ts 27.83 KB 27.83 KB 0.00 KB (0.00%)
schema-string-transformation.ts 15.20 KB 15.20 KB 0.00 KB (0.00%)
schema-string.ts 12.20 KB 12.20 KB 0.00 KB (0.00%)
schema-template-literal.ts 16.14 KB 16.14 KB 0.00 KB (0.00%)
schema-toArbitrary.ts 38.80 KB 38.80 KB 0.00 KB (0.00%)
schema-toCodeDocument.ts 26.01 KB 26.01 KB 0.00 KB (0.00%)
schema-toCodecJson.ts 20.76 KB 20.76 KB 0.00 KB (0.00%)
schema-toEquivalence.ts 20.90 KB 20.90 KB 0.00 KB (0.00%)
schema-toFormatter.ts 21.00 KB 21.00 KB 0.00 KB (0.00%)
schema-toJsonSchemaDocument.ts 26.03 KB 26.03 KB 0.00 KB (0.00%)
schema-toRepresentation.ts 21.08 KB 21.08 KB 0.00 KB (0.00%)
schema.ts 20.68 KB 20.68 KB 0.00 KB (0.00%)
stm.ts 14.04 KB 14.04 KB 0.00 KB (0.00%)
stream.ts 10.26 KB 10.26 KB 0.00 KB (0.00%)

@tim-smart
tim-smart enabled auto-merge (squash) October 26, 2026 23:17
@tim-smart
tim-smart merged commit 8450ad5 into main Oct 26, 2026
13 checks passed
@tim-smart
tim-smart deleted the fix/sqlite-do-resolver-transaction branch October 26, 2026 23:19
tim-smart added a commit that referenced this pull request Oct 27, 2026
The tests added on main in #9951 pass plain arrays to sql.insert, which requires a non-empty array on v4/next-minor since #9453.
@effect-bot effect-bot mentioned this pull request Oct 27, 2026
effect-bot pushed a commit that referenced this pull request Oct 27, 2026
The tests added on main in #9951 pass plain arrays to sql.insert, which requires a non-empty array on v4/next-minor since #9453.
effect-bot pushed a commit to yordis/effect that referenced this pull request Oct 27, 2026
The tests added on main in Effect-TS#9951 pass plain arrays to sql.insert, which requires a non-empty array on v4/next-minor since Effect-TS#9453.
effect-bot pushed a commit that referenced this pull request Oct 27, 2026
The tests added on main in #9951 pass plain arrays to sql.insert, which requires a non-empty array on v4/next-minor since #9453.
effect-bot pushed a commit that referenced this pull request Oct 27, 2026
The tests added on main in #9951 pass plain arrays to sql.insert, which requires a non-empty array on v4/next-minor since #9453.
effect-bot pushed a commit that referenced this pull request Oct 27, 2026
The tests added on main in #9951 pass plain arrays to sql.insert, which requires a non-empty array on v4/next-minor since #9453.
tim-smart added a commit that referenced this pull request Oct 27, 2026
The tests added on main in #9951 pass plain arrays to sql.insert, which requires a non-empty array on v4/next-minor since #9453.
effect-bot pushed a commit that referenced this pull request Oct 27, 2026
The tests added on main in #9951 pass plain arrays to sql.insert, which requires a non-empty array on v4/next-minor since #9453.
effect-bot pushed a commit that referenced this pull request Oct 27, 2026
The tests added on main in #9951 pass plain arrays to sql.insert, which requires a non-empty array on v4/next-minor since #9453.
tim-smart added a commit that referenced this pull request Oct 27, 2026
The tests added on main in #9951 pass plain arrays to sql.insert, which requires a non-empty array on v4/next-minor since #9453.
tim-smart added a commit that referenced this pull request Oct 27, 2026
The tests added on main in #9951 pass plain arrays to sql.insert, which requires a non-empty array on v4/next-minor since #9453.
effect-bot pushed a commit that referenced this pull request Oct 27, 2026
The tests added on main in #9951 pass plain arrays to sql.insert, which requires a non-empty array on v4/next-minor since #9453.
effect-bot pushed a commit that referenced this pull request Oct 27, 2026
The tests added on main in #9951 pass plain arrays to sql.insert, which requires a non-empty array on v4/next-minor since #9453.
tim-smart added a commit that referenced this pull request Oct 27, 2026
The tests added on main in #9951 pass plain arrays to sql.insert, which requires a non-empty array on v4/next-minor since #9453.
effect-bot pushed a commit that referenced this pull request Oct 27, 2026
The tests added on main in #9951 pass plain arrays to sql.insert, which requires a non-empty array on v4/next-minor since #9453.
effect-bot pushed a commit to wmaurer/effect that referenced this pull request Oct 27, 2026
The tests added on main in Effect-TS#9951 pass plain arrays to sql.insert, which requires a non-empty array on v4/next-minor since Effect-TS#9453.
effect-bot pushed a commit to wmaurer/effect that referenced this pull request Oct 27, 2026
The tests added on main in Effect-TS#9951 pass plain arrays to sql.insert, which requires a non-empty array on v4/next-minor since Effect-TS#9453.
effect-bot pushed a commit to wmaurer/effect that referenced this pull request Oct 27, 2026
The tests added on main in Effect-TS#9951 pass plain arrays to sql.insert, which requires a non-empty array on v4/next-minor since Effect-TS#9453.
effect-bot pushed a commit to wmaurer/effect that referenced this pull request Oct 27, 2026
The tests added on main in Effect-TS#9951 pass plain arrays to sql.insert, which requires a non-empty array on v4/next-minor since Effect-TS#9453.
effect-bot pushed a commit to wmaurer/effect that referenced this pull request Oct 28, 2026
The tests added on main in Effect-TS#9951 pass plain arrays to sql.insert, which requires a non-empty array on v4/next-minor since Effect-TS#9453.
effect-bot pushed a commit to wmaurer/effect that referenced this pull request Oct 28, 2026
The tests added on main in Effect-TS#9951 pass plain arrays to sql.insert, which requires a non-empty array on v4/next-minor since Effect-TS#9453.
effect-bot pushed a commit to wmaurer/effect that referenced this pull request Oct 28, 2026
The tests added on main in Effect-TS#9951 pass plain arrays to sql.insert, which requires a non-empty array on v4/next-minor since Effect-TS#9453.
effect-bot pushed a commit to wmaurer/effect that referenced this pull request Oct 28, 2026
The tests added on main in Effect-TS#9951 pass plain arrays to sql.insert, which requires a non-empty array on v4/next-minor since Effect-TS#9453.
effect-bot pushed a commit that referenced this pull request Oct 28, 2026
The tests added on main in #9951 pass plain arrays to sql.insert, which requires a non-empty array on v4/next-minor since #9453.
effect-bot pushed a commit to wmaurer/effect that referenced this pull request Oct 28, 2026
The tests added on main in Effect-TS#9951 pass plain arrays to sql.insert, which requires a non-empty array on v4/next-minor since Effect-TS#9453.
effect-bot pushed a commit that referenced this pull request Oct 28, 2026
The tests added on main in #9951 pass plain arrays to sql.insert, which requires a non-empty array on v4/next-minor since #9453.
tim-smart added a commit that referenced this pull request Oct 28, 2026
The tests added on main in #9951 pass plain arrays to sql.insert, which requires a non-empty array on v4/next-minor since #9453.
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.

3 participants