Repository navigation
Share saved connections between Stroke and Stroke Nightly - #417
Merged
Merged
Conversation
Stable and Nightly each kept connections.json in their own data folder but share one keychain vault. A connection added in Nightly was missing in Stable, and Stable then deleted Nightly's passwords twice over: at startup it pruned every vault id missing from its own list, and every save rewrote the whole vault from its own cache. - connections.json lives in Stable's folder for both apps. Nightly's own file is merged in once (newer lastConnectedAt wins per id) and renamed to connections.json.merged. - Every write merges with the file on disk: rows the other app added are kept, and a tombstone in `deleted` wins over a stale copy. `revived` lifts one for an explicit re-add. - Connection secrets are written with conn_secrets_merge, which reads the vault fresh and only touches this app's ids and deleted ids. Startup prunes only tombstoned ids. - On window focus the list and passwords are re-read, so what the other app saved shows up without a restart.
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Bug: add a connection in Nightly, open Stable, go back to Nightly, and Nightly's connection has lost its saved password.
Cause: Stable and Nightly kept
connections.jsonin separate data folders (com.broisnischal.strokeandcom.broisnischal.stroke.nightly) but share one keychain vault (app.stroke.desktop). Stable removed Nightly's passwords in two places:hydrateConnectionSecretspruned every vault id missing from its own list.Fix:
connections.jsonin Stable's folder (connection_store::shared_dir). On first read, Nightly's own file is merged in, with the newerlastConnectedAtwinning per id, then renamed toconnections.json.merged.deletedwins over a stale copy, andrevivedlifts one for an explicit re-add (the sample database).conn_secrets_mergereads the vault fresh from the keychain and changes only this app's ids and the deleted ids. Startup prunes only tombstoned ids.refreshConnectionsFromDiskre-reads the list and passwords (conn_secrets_read_fresh), so the other app's changes show up without a restart.Testing
cargo test --libpasses, 521 tests. New ones cover a write keeping the other app's rows, a delete beating a stale copy, revive, the tombstone cap, the one-time Nightly-to-shared merge, writes from both folders landing in one file, and a secrets merge leaving the other track's ids alone.npm testpasses (2009 node tests, 20 DOM tests). New tests cover startup pruning only deleted ids, a save keeping the other track's password, the focus refresh picking up a new connection with its password (and ignoring key order), and a revive reaching the disk copy.svelte-checkshows 0 errors, the design lint has no new violations, and the build passes.