Repository navigation
feat(sqlite): transaction state per connection - #941
Merged
Merged
Conversation
A failed SQLite run now says whether the file's connection is still inside a transaction, read with is_autocommit() after the failure, as #917 does for a MySQL session. A failing statement does not end a transaction, so a script that ran BEGIN and then failed leaves one open. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WTypK4RjzzdjoFxd3qk14g
A SQLite file has one connection, shared by every tab on it, so a BEGIN in one tab is open in all of them. The transaction store now keeps that state per connection beside the per-tab MySQL state, and resultStore records what each SQLite run reports, failures included. Every tab bound to the file shows the TX badge, and the toolbar offers Commit and Rollback on it. Closing or re-pointing a tab asks only when it is the last tab on the file; confirming rolls the transaction back. Closing the file forgets it. The mock now tracks BEGIN, COMMIT and ROLLBACK per SQLite connection. MySQL tabs are unchanged. Closes #935 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WTypK4RjzzdjoFxd3qk14g
EVWorth
pushed a commit
that referenced
this pull request
Oct 31, 2026
A failed run on an editor session reports whether the session is still in a transaction (#917), and CommandError carries it since #941. The failure path still inferred the state from the statements that ran, which is wrong when the failing statement changed it itself (DDL's implicit commit, a deadlock's rollback) or when a transaction was opened where the SQL does not show it. Prefer the reported state and keep the inference only as the fallback. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WTypK4RjzzdjoFxd3qk14g
This was referenced Oct 31, 2026
Merged
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.
Done by the
implementer-frontendlane, with a small backend change.Closes #935
Design
All tabs on a SQLite file share one connection, so a
BEGINin one tab is open in every tab on that file. For SQLite, the transaction state belongs to the connection. MySQL keeps one state per tab, as before.Changes
QueryError.transaction, read from!is_autocommit()after the failure. MySQL got the same in fix: timeout and failure lose run results/state #917.bindings.tsis unchanged because the field already existed.transactionStoregainsopenConnections,setConnectionOpenandforgetConnection.hasOpenTransactionForTab(tab), which is true when either the tab or its SQLite connection has a transaction open.resultStoresets the connection flag from every SQLite run, including from the error after a failure.TransactionBadge.tsx) shows on every tab bound to the file. Its tooltip says the transaction is on the file's connection.sqlite-transactions.ts, modelled onserver-sessions.ts) runsROLLBACK. That makes "Roll back and close" do what it says. If the rollback fails, the flag stays.ROLLBACK TOkeeps the transaction open.Tests
a_failure_says_whether_a_transaction_is_still_open(mas-sqlite) anda_failure_reports_whether_the_connection_is_in_a_transaction(sqlpilot). Both fail without the fix.transactionStore.test.ts,transaction-prompt.test.ts,sqlite-transactions.test.ts, andEditorTabs.sqlite.test.tsx(runs against the real stores).npm run test:unit: 3784 passed.cargo fmt,clippy -D warnings, andcargo test -p mas-sqliteand-p sqlpilotare clean.Generated by Claude Code