Repository navigation
fix(windows): stop the close crash, apply Safe Mode and keep tabs across Reconnect - #4176
Merged
Merged
Conversation
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.
Summary
Fixes from the 2026-11-10 code audit (wave 2) for the Windows app and the shared core.
Windows app
DatabaseSession.gate_run, overSafeModeLevel::gate): Confirm writes asks before any write, Off before a DROP, TRUNCATE, or an unfiltered DELETE or UPDATE. The dialog lists each statement, or the whole text when it reads stricter than every batch. Read only refuses the run. MySQLDELIMITERscripts are judged per statement.DatabaseSession.set_safe_mode). A change to Read only that the user declines to reconnect for applies Confirm writes until the next connect, with a bar saying so.async void.Program.Mainregisters it withAppInstance.FindOrRegisterForKey, and a second launch hands its activation over and exits. The hand-over is bounded at 5 s and retried, a null owner or a failed setup starts normally, and the key is released after the session is saved.Core
ConnectionStorere-readsconnections.jsonbefore every write and holds a lock file beside it, so a second process, a hand edit or a synced file is no longer overwritten from a stale cache. A lock the file system refuses (NFS, SMB) logs a warning and the write goes ahead on the re-read alone. A file broken by hand after loading blocks writes instead of being overwritten.readonly=1connects. The login request carries no setting and askssystem.settingswhich of the driver's settings this login may change; later requests send only those. At level 1 a read-only connection still sendsreadonly=1, which undoes a session'sSET readonly = 0. NaN or Inf in a non-Nullable Float column reads as out of range, never NULL. A login that cannot change a pinnedmutations_sync=0is refused a mutation rather than told it saved. Decimals keep their scale.Session::grammarkeeps the grammar of the engine it opened on, so the Safe Mode gate on Windows and the Linux editor's statement split use it while the link is down, instead of PostgreSQL's.Tests changed on purpose
client_factory::tests::a_login_with_a_readonly_level_of_its_own_keeps_it,no_read_asks_a_login_at_its_own_level_for_another,a_read_only_connection_asks_a_login_at_readonly_1_for_no_setting(replaced): readonly andallow_ddlat level 1.endpoint::tests::a_login_answer_reads_as_the_version_the_database_and_the_readonly_level,a_login_at_readonly_1_that_may_change_nothing_is_sent_only_its_own_level: the login query reads more columns.cell_seed::tests::numbers_keep_every_digit_quoted_or_bare: decimals carry their scale.Known gap
ShutDownand its window'sClosedopens nothing. Releasing the key earlier would let two processes writesession.json.Test plan
tablepro-storage337,tablepro-session153,tablepro-driver-clickhouse142 unit,tablepro-ffi97, all passing; clippy and rustfmt clean.restricted_loginssuite (readonly=1 with and without changeable settings,mutations_syncpinned at 0, a lifted readonly level put back). The 3 that fail on macOS (two TLS cases expecting Linux's verifier errors, the million-row export reading a cgroup file) touch no changed code; the Linux CI job runs them.TablePro.Appand its UI tests (including new close-while-running and Reconnect tests) build and run only on the Windows runners.