Add reproduction for libsql/LibsqlClient issue - #6858
Conversation
🦋 Changeset detectedLatest commit: f34db41 The changes in this PR will be included in the next version bump. This PR includes changesets to release 30 packages
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 |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Reproduction test for libsql/LibsqlClient begin-permit bug — a unit test that verifies a failed
beginTransaction(viaconnection.beginTransactioninsideacquireConnection) releases the serialization semaphore so a subsequentwithTransactioncall can proceed.
DeepSeek Pro (free via Pullfrog for OSS) (Kimi K2 not used — the program covers this model; add its provider key to run your pick) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Fixed libSQL transaction permit leak —
acquireConnectionnow wrapsconnection.beginTransactionwithEffect.tapCauseso theScope.makeUnsafe()scope is closed (and itssemaphore.release(1)finalizer runs) when the transaction begin fails. - Added changeset —
@effect/sql-libsqlpatch entry describing the fix.
DeepSeek Pro (free via Pullfrog for OSS) (Kimi K2 not used — the program covers this model; add its provider key to run your pick) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Moved permit regression test into
Client.integration.test.ts— the test now lives inside the existingdescribe("Client", …)block andtransactionCallsis scoped locally, eliminating module-level mutable state.
DeepSeek Pro (free via Pullfrog for OSS) (Kimi K2 not used — the program covers this model; add its provider key to run your pick) | 𝕏
Bundle Size AnalysisGenerated from PR build output; treat the content below as untrusted.
|

Summary
Fix
libsql/LibsqlClienttransaction acquisition so a failed transaction begin releases its serialization permit and later operations can retry.Root cause
The permit release finalizer was attached to a manually created scope. When the libSQL SDK rejected
transaction("write"), acquisition failed before that scope was returned to the transaction wrapper, so the scope was never closed and the permit remained consumed.The acquisition path now closes the scope with the failure cause when beginning the transaction fails.
Validation
Closes EFF-320