Skip to content

refactor(cmd): share spored-SSH options via helper (#303) - #358

Merged
scttfrdmn merged 1 commit into
mainfrom
refactor/303-spored-ssh-helper
Jul 15, 2026
Merged

scttfrdmn merged 1 commit into
mainfrom
refactor/303-spored-ssh-helper

Conversation

@scttfrdmn

Copy link
Copy Markdown
Contributor

Extracts the duplicated SSH -o option block from the four non-interactive spored-exec call sites into a single sporedSSHOptions() helper (cmd/utils.go).

Sites converted

  • cmd/status.go — spored status over SSH
  • cmd/config.go — spored config get/set/list
  • cmd/extend.go — spored reload
  • cmd/queue.go — remote cat of the queue state file

Each site keeps its own -i keyPath handling, ec2-user@host, and trailing command. queue still appends -i only when a key resolves.

Left alone (by design)

  • cmd/connect.go — interactive session, adds ControlMaster=no/ControlPath=none
  • cmd/launch.go — adds ControlMaster=no
  • pkg/plugin/push_ssh.go / cmd/plugin.go — accept-new + BatchMode=yes (different security posture)

Verification

Closes #303.

@codecov

codecov Bot commented Jul 15, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 50.00000% with 7 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
cmd/config.go 0.00% 2 Missing ⚠️
cmd/extend.go 0.00% 2 Missing ⚠️
cmd/status.go 0.00% 2 Missing ⚠️
cmd/queue.go 0.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

The four non-interactive spored-over-SSH call sites (status/config/extend/
queue) each repeated the same four ssh -o options. Extract them into a
sporedSSHOptions() helper in cmd/utils.go; each site keeps its own -i key
handling, host, and trailing command (queue still appends -i only when a key
resolves). The interactive connect path and the launch/plugin SSH paths are
deliberately left alone — they layer on ControlMaster / accept-new / BatchMode
for their own reasons.

Closes #303.
@scttfrdmn
scttfrdmn force-pushed the refactor/303-spored-ssh-helper branch from efe01e7 to bdd97a8 Compare July 15, 2026 20:29
@scttfrdmn
scttfrdmn merged commit 0caec2d into main Jul 15, 2026
7 checks passed
@scttfrdmn
scttfrdmn deleted the refactor/303-spored-ssh-helper branch July 15, 2026 20:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[audit] Dup: SSH option block copy-pasted across 4 spored-exec sites — extract buildSporedSSHArgs/runSpored

1 participant