Skip to content

Commit ebbc76d

Browse files
acmoreclaude
andcommitted
refactor: remove dead sshSpec parameter from ensureSSHConfigEntry
Keepalive values are now hardcoded, so the sshSpec parameter was unused. Removed from function signature and all call sites. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 0823297 commit ebbc76d

4 files changed

Lines changed: 5 additions & 7 deletions

File tree

internal/cli/ports.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ func newPortsCmd(opts *Options) *cobra.Command {
6262
return fmt.Errorf("wait for sshd ready: %w", err)
6363
}
6464
alias := sshHostAlias(sn)
65-
changed, err := ensureSSHConfigEntry(alias, sn, ns, cfg.Spec.SSH.User, effectiveSSHPort, keyPath, cfgPath, cfg.Spec.Ports, cfg.Spec.SSH)
65+
changed, err := ensureSSHConfigEntry(alias, sn, ns, cfg.Spec.SSH.User, effectiveSSHPort, keyPath, cfgPath, cfg.Spec.Ports)
6666
if err != nil {
6767
return fmt.Errorf("update ~/.ssh/config for managed forwards: %w", err)
6868
}

internal/cli/ssh.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ func newSSHCmd(opts *Options) *cobra.Command {
123123
sshHost := sshHostAlias(sn)
124124
cfgPath, _ := config.ResolvePath(opts.ConfigPath)
125125
stopSSHConfig := startTransientStatus(errOut, "Preparing SSH config")
126-
if _, cfgErr := ensureSSHConfigEntry(sshHost, sn, ns, user, remotePort, keyPath, cfgPath, cfg.Spec.Ports, cfg.Spec.SSH); cfgErr != nil {
126+
if _, cfgErr := ensureSSHConfigEntry(sshHost, sn, ns, user, remotePort, keyPath, cfgPath, cfg.Spec.Ports); cfgErr != nil {
127127
stopSSHConfig()
128128
fmt.Fprintf(errOut, "warning: failed to update ~/.ssh/config: %v\n", cfgErr)
129129
} else {
@@ -410,7 +410,7 @@ func sshHostAlias(sessionName string) string {
410410
return "okdev-" + sessionName
411411
}
412412

413-
func ensureSSHConfigEntry(hostAlias, sessionName, namespace, user string, remotePort int, keyPath, okdevConfigPath string, forwards []config.PortMapping, sshSpec config.SSHSpec) (bool, error) {
413+
func ensureSSHConfigEntry(hostAlias, sessionName, namespace, user string, remotePort int, keyPath, okdevConfigPath string, forwards []config.PortMapping) (bool, error) {
414414
home, err := os.UserHomeDir()
415415
if err != nil {
416416
return false, err

internal/cli/ssh_config_test.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ func TestEnsureSSHConfigEntryIncludesNamespaceInProxyCommand(t *testing.T) {
2828
"/tmp/id_ed25519",
2929
"/tmp/.okdev.yaml",
3030
[]config.PortMapping{{Local: 8080, Remote: 8080}},
31-
config.SSHSpec{KeepAliveInterval: 30, KeepAliveCountMax: 10},
3231
)
3332
if err != nil {
3433
t.Fatalf("ensureSSHConfigEntry: %v", err)
@@ -61,7 +60,7 @@ func TestEnsureSSHConfigEntryUsesProxyKeepaliveValues(t *testing.T) {
6160
_ = os.Setenv("HOME", origHome)
6261
}()
6362

64-
// Pass config defaults (10/30)the written config should still use 5/10
63+
// Keepalive values are hardcodedverify they're 5/10 regardless of config defaults
6564
_, err := ensureSSHConfigEntry(
6665
"okdev-test2",
6766
"test-session2",
@@ -71,7 +70,6 @@ func TestEnsureSSHConfigEntryUsesProxyKeepaliveValues(t *testing.T) {
7170
"/tmp/id_ed25519",
7271
"/tmp/.okdev.yaml",
7372
nil,
74-
config.SSHSpec{KeepAliveInterval: 10, KeepAliveCountMax: 30},
7573
)
7674
if err != nil {
7775
t.Fatalf("ensureSSHConfigEntry: %v", err)

internal/cli/up.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ func newUpCmd(opts *Options) *cobra.Command {
174174
sshSummary = "degraded (sshd not ready)"
175175
}
176176
alias := sshHostAlias(sn)
177-
if _, cfgErr := ensureSSHConfigEntry(alias, sn, ns, cfg.Spec.SSH.User, effectiveSSHPort, keyPath, cfgPath, cfg.Spec.Ports, cfg.Spec.SSH); cfgErr != nil {
177+
if _, cfgErr := ensureSSHConfigEntry(alias, sn, ns, cfg.Spec.SSH.User, effectiveSSHPort, keyPath, cfgPath, cfg.Spec.Ports); cfgErr != nil {
178178
ui.warnf("failed to update ~/.ssh/config: %v", cfgErr)
179179
sshSummary = "degraded (ssh config update failed)"
180180
} else {

0 commit comments

Comments
 (0)