feat(ssh-config): adopt matching connections instead of creating duplicates#39
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.
What & why
The SSH Config Sync plugin scopes its deduplication to connections it owns (those tagged
ssh-config). A connection you created by hand — e.g. "Serv Oracle" — is untagged, so the plugin can't see it and creates a duplicate ("Oracle") when the same server appears in~/.ssh/config. This adds an opt-out setting (on by default) that lets the plugin adopt a matching untagged connection instead of duplicating it.Closes the duplicate-on-import behavior reported for hosts that already exist in Voltius under a different label.
Behavior
When a config host matches an existing untagged connection by
host+port+username:jump_hostsare preserved. Onlyhost/port/usernameedits from the config propagate.~/.ssh/config.Design notes
ssh-config; adopted ones are deliberately left untagged. So there's no new storage state, and "never delete" is structural — the removal pass only ever touches tagged connections.alias_mapby-id lookup is unconditional, so already-adopted connections stay managed even if the setting is later turned off.jump_hosts.New setting: Settings → SSH Config Sync → "Adopt matching connections" (on by default).
Tests
New
sync.test.ts(stateful mock harness) — 14 tests covering: adoption match/no-duplicate, field preservation, first-match-wins, setting-off duplicate, never-delete, re-find on second sync (isolated from the content fallback), host/port propagation, ProxyJump-not-overwritten-on-adopted vs written-on-tagged, and adopted-host-with-IdentityFile skip.npx vitest run src/plugins/ssh-config/→ 14/14;tsc --noEmitclean.Not yet verified
The new settings toggle has not been clicked in a running app — the headless UI environment was unavailable this session. The
sync()adoption logic is fully unit-tested; the UI is a straightforward mirror of the existing Notifications toggle, but the render/persist behavior is unverified live.