Repository navigation
fix(startup): stop panicking before the window exists - #666
Merged
Merged
Conversation
Four `.expect()` calls ran before any window: the data directory, the log directory, the connection store and the history store. Each one turned an ordinary environment problem — a read-only home, a full disk, a corrupt SQLite file — into a process that vanishes, leaving a Rust panic in a terminal a desktop user does not have open. #278 fixed this shape for the keyring; these four were left. The worst of them was the history store. #585 put history in its own file specifically so that "a corrupt or oversized history cannot take the connection profiles down with it" — and the `.expect()` two lines below that comment did exactly that. Now each degrades and says so: - the data directory falls back to a temp directory, then to the working directory - the log directory failing means console logging only - either store falling back to an in-memory one, so the app runs with that part missing A corrupt file is left exactly as it is — the fallback is in memory precisely so nothing overwrites what still needs recovering. Each failure becomes a StartupProblem: a kind, a summary in the user's terms ("Your saved connections could not be opened... nothing you do now will overwrite it"), and the underlying error for a bug report. The status bar shows them and lets each be dismissed. ARCHITECTURE §7.4 was a diagram of three hypothetical degradations, two of which are not implemented. It now lists the eight that exist and the rule behind them. +6 Rust tests, +6 frontend tests.
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.
From the full-project review.
Four
.expect()calls ran before any window existed: the data directory, the log directory, the connection store, the history store. Each turned an ordinary environment problem — a read-only home, a full disk, a corrupt SQLite file — into a process that vanishes, leaving a Rust panic in a terminal a desktop user does not have open. #278 fixed this shape for the keyring; these four were left.The worst was the history store. #585 put history in its own file specifically so that "a corrupt or oversized history cannot take the connection profiles down with it" — and the
.expect()two lines below that comment did exactly that.What happens now
connections.dbhistory.dbA corrupt file is left exactly as it is — the fallback is in memory precisely so that nothing overwrites what still needs recovering. There is a test for that.
Each failure becomes a
StartupProblem: a kind, a summary in the user's terms ("Your saved connections could not be opened… nothing you do now will overwrite it"), and the underlying error for a bug report. The status bar shows them, each dismissible, with the detail in the title.Docs
ARCHITECTURE §7.4 was an ASCII diagram of three hypothetical degradations, two of which are not implemented (SSH, SSL fallback). It now lists the eight that exist — keyring, data dir, log dir, both stores, SSH refusal, AI, a server that has gone — and the rule behind them: nothing in startup panics.
Tests
+6 Rust (including that a corrupt file is byte-for-byte unchanged afterwards), +6 frontend. 2778 unit, 344 browser.