Repository navigation
feat(grid): save grid edits on the editor tab's session without committing its transaction - #762
Merged
Merged
Conversation
…tting its transaction (#735) Grid edits went to the shared pool, so an edit to rows the tab had locked waited on the tab itself, an edit made inside the tab's open transaction committed independently of it, and the refresh after a save read from a connection without the tab's temporary tables or session variables. Sending the old START TRANSACTION ... COMMIT batch to the session instead would have committed the user's open transaction implicitly. A new apply_grid_edits command holds the tab's one connection for the whole save and first asks whether a transaction is open: - none open: START TRANSACTION ... COMMIT, with an explicit ROLLBACK on failure so a failed save never leaves the tab inside a transaction; - one open: SAVEPOINT ... RELEASE inside it, so the edits join the user's transaction uncommitted and a failure rolls back only the save; - cannot tell: nothing is applied and the frontend falls back to the shared pool as before. The question is asked by reassigning the next transaction's isolation level its current session value: MySQL and MariaDB both refuse that with ER 1568 inside a transaction, and outside one it changes nothing. Unlike SET TRANSACTION READ WRITE it keeps a session's READ ONLY setting. Verified on MySQL 8.0 and MariaDB 11. The result store now remembers the session and database its results were read on, so the save and the refresh after it use them. A save inside an open transaction says so and tells the user to COMMIT or ROLLBACK. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WTypK4RjzzdjoFxd3qk14g
Merged
EVWorth
added a commit
that referenced
this pull request
Oct 20, 2026
* release: 1.3.0 Version bump across the three manifests and the two lockfile entries that record the app's own version. 1.2.0 and 1.2.1 were bumped but never tagged, so 1.3.0 is the first release since 1.1.0 and carries everything since it: Connections (#731) - Each editor tab runs on its own server session, so SET @var, SET SESSION, temporary tables and multi-run transactions carry over (#734) - Each agent session, and each backup or restore, has connections of its own, so none of them can hold up the editor or each other (#732, #770) - The Min/Max pool size setting and the status-bar pool counter are gone; connections are no longer something to size (#769) - A "busy" error says what is busy and what to wait for (#727) Grid - Grid edits save on the tab's session without committing its open transaction (#762) - Copy a long cell value without opening the viewer (#748) Fixes - Linux: WebKitGTK's DMABUF renderer is off under Wayland (#742) - rustls for RUSTSEC-2026-0285 and RUSTSEC-2026-0346..0349 (#728, #759) - Tauri 2.12.3, tauri-plugin-updater 2.13.3, tauri-plugin-shell 2.5.0 (#749, #747, #758), and dependency roll-ups Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WTypK4RjzzdjoFxd3qk14g * fix(deps): bump rustls-webpki and webpki-roots for RUSTSEC-2026-0381..0383 rustls-webpki 0.103.16, webpki-roots and webpki-root-certs 1.0.10. The advisories were published today: certificate verification could accept distrusted intermediates, and the bundled roots still trusted the distrusted emSign intermediates. cargo audit fails on all three, and a release should not ship them. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WTypK4RjzzdjoFxd3qk14g --------- Co-authored-by: Claude <[email protected]>
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.
Closes #735. Remaining item 1 of #731.
Problem
Grid cell edits (
src/hooks/useGridSave.ts) went throughrunStatementon the shared pool, not the editor tab's session:innodb_lock_wait_timeout;Moving the existing
START TRANSACTION; …; COMMIT;batch onto the session would have been worse:START TRANSACTIONimplicitly commits a transaction already open, so it would silently commit the user's work.Change
A new
apply_grid_editscommand (mas-core/src/query/grid_edits.rs) holds the tab's one connection for the whole save, so nothing else from the tab runs between the check and the edits. It first asks whether a transaction is open:START TRANSACTION … COMMITROLLBACK, so a failed save never leaves the tab inside a transactionSAVEPOINT … RELEASE SAVEPOINTinside it, uncommittedROLLBACK TO SAVEPOINT: undoes only the save, and the user's work and transaction stay as they werenullThis combines the issue's options 1 and 2: edits join the open transaction, and a savepoint keeps the save atomic inside it.
Detecting the transaction. The check assigns the next transaction's isolation level its current session value:
SET @@transaction_isolation = @@session.transaction_isolation. MySQL and MariaDB both refuse this with ER 1568 inside a transaction, and outside one it changes nothing. I triedSET TRANSACTION READ WRITEfirst: it detects transactions the same way, but it overrides a session'sREAD ONLYsetting for the next transaction, so a save could get past a read-only session. A test covers that.Tested against MySQL 8.0 and MariaDB 11:
START TRANSACTIONwith nothing runBEGINthen aSELECTautocommit = 0, then a writeautocommit = 0, nothing run yetCOMMIT; after a DDL implicit commitFrontend.
resultStorenow keepsresultSource(connection, database, tab session) for the results on screen. Only MySQL tabs carry a session.useGridSavesaves throughrunGridEdits, which records history with origingridlikerunStatementdoes. The refresh then reads on the same session and database. A save inside an open transaction tells the user: "Applied N change(s) inside your open transaction. COMMIT to keep them, or ROLLBACK to undo them."Tests
mas-core/tests/grid_edits.rs, 6 tests, passing on MySQL 8.0 and MariaDB 11):ROLLBACKundoes the user's insert and the edit together;READ ONLYsetting.useGridSave.test.ts(6 tests: routing, the open-transaction message, fallback when the session can't tell, a result with no session, a result on another connection, a failed save), andresultStoretests forresultSource.editor_sessionsalso on MariaDB;vitest: everything passes exceptsrc/__tests__/main.test.tsx, which hits a hook timeout in my container with or without this change;ResultsGrid.browser.test.tsx: 120 passed;-D warnings, rustfmt, dprint, eslint, and the vi.mock path check are clean.src/lib/bindings.tsis regenerated withjust bindings, not hand-edited.Notes
@@transaction_isolation), the save falls back to the old batch on the shared pool. Behaviour there is unchanged.Generated by Claude Code