fix(sqlite): handle turso StepResult::Sleep and bump to 0.8.0-pre.4 - #2306
Merged
Conversation
turso 0.8.0-pre.4 adds a `StepResult::Sleep { duration }` variant, which
breaks the engine's exhaustive match (E0004) and fails the whole build.
Treat `Sleep` like `IO`/`Yield`: drive pending completions and re-step.
The duration is deliberately not honoured — the engine is single-threaded
and driven synchronously, so nothing else can produce the progress the
sleep waits for, and std::thread::sleep is unavailable on the wasm targets
this builtin ships to. Upstream documents that callers which don't track
time may treat Sleep exactly like IO. Spinning stays bounded by the
wall-clock deadline (TM-SQL-005a) and the per-iteration execution budget.
The match stays exhaustive on purpose so a future variant breaks the build
and gets reviewed rather than silently falling into a catch-all.
Keeps the lockfile edit scoped to the four turso crates; pre.4 changes only
its internal version pins, so unrelated windows-sys/getrandom re-unification
is avoided.
Supersedes #2302.
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
bashkit | 09979d8 | Commit Preview URL Branch Preview URL |
Aug 16 2026, 10:08 AM |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Supersedes #2302.
What changed
Bumps
turso_core(andturso_ext/turso_macros/turso_parser) 0.8.0-pre.3 -> 0.8.0-pre.4, and teaches the sqlite engine's step loop about the newStepResult::Sleep { duration }variant.Sleepjoins theIO | Yieldarm: drive pending completions viaio_step()and re-step. The duration is deliberately not honoured. Blocking would be wrong here — the engine is single-threaded and driven synchronously, so nothing else can produce the progress the sleep is waiting for, andstd::thread::sleepis unavailable on the wasm targets this builtin also ships to. Upstream documents the fallback explicitly:Spinning stays bounded by the existing wall-clock deadline (TM-SQL-005a) and by the
ExecutionBudgetwork unit consumed on every loop iteration, so this cannot become an unbounded busy-wait.The match over
StepResultis kept exhaustive on purpose — that is exactly what surfaced this variant instead of letting it fall into a catch-all. Documented inknowledge/runtimes/sqlite-builtin.md.Why
Without this, turso 0.8.0-pre.4 does not compile:
That is what takes down 21 jobs on #2302 — every Rust, Python, Node, WASM and coverage job fails on the same build error.
Before / After
Build and tests:
Performance —
just bench-sqlite, same machine, pre.3 vs pre.4 across all 44 benchmarks:median −1.6%, mean +0.1% (n=44, range −7.9% to +15.7%) — noise on a 4-CPU VM, no regression.
Note for reviewers: do not diff this against
criterion-sqlite-vm-linux-x86_64-1777865268.md(May). That baseline reports ~780 µs for every row count including 10000, which is not comparable to the current bench shape and makes pre.4 look ~50x slower. The numbers above are a fresh same-machine A/B run of pre.3 against pre.4.Risk
Sleep. If a future workload genuinely depends on backing off (a contended busy handler), this spins instead of sleeping until the deadline or budget trips — bounded, never unbounded, and it returns the existingquery timed outerror rather than hanging. Honouring the duration would require a wasm-safe sleep and a non-synchronous driver, neither of which exists today.windows-sys0.52.0 /getrandom0.3.4 re-unification that chore(deps): bump turso_core from 0.8.0-pre.3 to 0.8.0-pre.4 #2302 carries is avoided. Verified withcargo metadata --locked.Checklist
Sleepis not reachable from bashkit's synchronous single-connection backends (it comes from a busy-handler retry under contention), so there is no deterministic way to assert it from a test; the exhaustive match is the compile-time guard, and the rationale is recorded in knowledge.Generated by Claude Code