Skip to content

Add standalone SSH session profile planning#133

Merged
qarlus merged 1 commit intodevfrom
feature/standalone-session-profiles
Apr 9, 2026
Merged

Add standalone SSH session profile planning#133
qarlus merged 1 commit intodevfrom
feature/standalone-session-profiles

Conversation

@qarlus
Copy link
Copy Markdown
Collaborator

@qarlus qarlus commented Apr 9, 2026

Objective

Implement config-backed session profile selection for standalone bootstrap so iris --profile <name> can plan SSH sessions from saved profile data instead of requiring ad-hoc --ssh arguments each run.

Scope

  • Added --profile <name> CLI support in crates/iris-standalone/src/cli.rs.
  • Extended standalone config model in crates/iris-standalone/src/config.rs with typed SSH profile support:
    • SshConfig
    • SshProfile (name, host, user, port)
    • profile destination rendering (user@host)
    • case-insensitive profile lookup via Config::ssh_profile_by_name(...).
  • Added config validation for SSH profiles in config.rs:
    • non-empty profile name
    • non-empty host
    • duplicate-name rejection (case-insensitive).
  • Extended session launch planning in crates/iris-standalone/src/session.rs:
    • resolves --profile from config into SSH launch targets
    • supports profile-provided SSH port via ssh -p <port>
    • supports -e/--command as SSH remote command in profile mode
    • rejects invalid flag combinations (--profile with --ssh/--serial) and unknown profiles.
  • Updated docs/phases/06.md status/checklist and CHANGELOG.md entries.

API and Behavior Changes

  1. API surface change
  • Added standalone config types and helpers in config.rs:
    • SshConfig
    • SshProfile
    • SshProfile::destination()
    • Config::ssh_profile_by_name(...).
  • Added Args.profile in cli.rs.
  1. Runtime behavior change
  • iris --profile production now resolves config-defined SSH profile settings into PTY launch planning.
  • Profile-based SSH planning now includes configured user and optional port.
  • -e/--command is forwarded as remote command when profile mode selects SSH.
  1. Error behavior change
  • Added explicit session planning errors for:
    • blank profile names
    • unknown profiles
    • profile combined with --ssh or --serial.
  • Added explicit config validation errors for malformed SSH profile definitions.

Backward Compatibility

  • additive/non-breaking (existing shell/SSH/serial behavior remains; profile mode adds new CLI/config path)

Test Coverage

Added/updated tests in crates/iris-standalone:

  • cli::tests::parses_cli_flags_and_subcommand (now covers --profile parsing)
  • config profile tests:
    • load_from_path_parses_ssh_profiles
    • load_from_path_rejects_empty_ssh_profile_name
    • load_from_path_rejects_empty_ssh_profile_host
    • load_from_path_rejects_duplicate_ssh_profile_names_case_insensitively
    • ssh_profile_lookup_is_case_insensitive
  • session profile planning tests:
    • uses_ssh_profile_mode_when_profile_is_supplied
    • profile_mode_accepts_command_override_as_remote_command
    • rejects_blank_profile_name
    • rejects_unknown_profile
    • rejects_combining_profile_with_ssh_or_serial
    • ssh_arguments_include_port_when_present
    • existing launch-target tests updated for new resolver signature.

Strategy:

  • happy-path coverage: profile resolution, destination/port planning, remote command forwarding.
  • error/edge coverage: malformed profile definitions and conflicting CLI combinations.
  • regression coverage: existing shell/ssh/serial planning paths remain tested.

Verification

  • cargo fmt --all (pass)
  • cargo clippy -p iris-standalone --all-targets -- -D warnings (pass)
  • cargo test -p iris-standalone (pass; 53 tests)

Files Changed

  • crates/iris-standalone/src/cli.rs
  • crates/iris-standalone/src/config.rs
  • crates/iris-standalone/src/session.rs
  • docs/phases/06.md
  • CHANGELOG.md

Notes

  • This is an intentionally bundled standalone increment (325 changed lines) to deliver complete profile parsing/config validation/session planning behavior in one materially useful review unit.

Summary by CodeRabbit

Release Notes

  • New Features
    • Added --profile <name> flag to launch SSH sessions using preconfigured profiles from configuration
    • Profiles support hostname, username, and port configuration
    • Case-insensitive profile name matching for convenience
    • Automatic SSH port forwarding when profile includes a port setting

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 9, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 00382d88-9da9-4c2f-a0da-495066e2dbf0

📥 Commits

Reviewing files that changed from the base of the PR and between b0c65bb and 0482144.

📒 Files selected for processing (5)
  • CHANGELOG.md
  • crates/iris-standalone/src/cli.rs
  • crates/iris-standalone/src/config.rs
  • crates/iris-standalone/src/session.rs
  • docs/phases/06.md

📝 Walkthrough

Walkthrough

The PR adds SSH profile support to the iris-standalone crate. It introduces a --profile <NAME> CLI argument, defines SSH configuration models with validation (non-empty names/hosts, case-insensitive duplicate detection), and integrates profile resolution into session planning to construct SSH launch targets with optional port forwarding.

Changes

Cohort / File(s) Summary
CLI Argument
crates/iris-standalone/src/cli.rs
Added optional --profile <NAME> CLI argument to Args struct; updated parsing tests to verify profile argument handling.
SSH Configuration Models
crates/iris-standalone/src/config.rs
Introduced SshConfig and SshProfile structures with fields for name, host, user, and port. Implemented SshProfile::destination() for formatted connection strings. Extended Config::validate() to enforce non-empty profile names/hosts and detect duplicate profiles case-insensitively. Added Config::ssh_profile_by_name() for case-insensitive profile lookup.
Session Planning Integration
crates/iris-standalone/src/session.rs
Extended SessionPlanError with profile-specific variants (empty profile, unknown profile, mode conflict). Modified resolve_launch_target() to accept config, validate --profile argument, and resolve it to SSH launch targets. Updated SessionLaunchTarget::Ssh to carry optional port and modified ssh_arguments() to inject -p <port> when present.
Documentation
CHANGELOG.md, docs/phases/06.md
Updated changelog and phase documentation to reflect SSH profile support, including profile lookup, validation, and port forwarding behavior.

Sequence Diagram(s)

sequenceDiagram
    participant CLI as CLI Parser
    participant Args as Args Struct
    participant Config as Config
    participant Session as resolve_launch_target()
    participant Target as SSH Launch Target

    CLI->>Args: Parse --profile <name>
    Args->>Session: Pass args with profile
    Session->>Session: Trim & validate profile name
    Session->>Config: ssh_profile_by_name(name)
    Config->>Config: Case-insensitive lookup
    Config-->>Session: Return SshProfile
    Session->>Session: Extract destination & port
    Session->>Target: Construct SessionLaunchTarget::Ssh
    Target->>Target: Store destination + Optional<port>
    Session-->>CLI: Return launch target
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

Possibly related PRs

Poem

🐰 A profile unfolds, SSH takes flight,
Case-insensitive matches shine so bright,
With ports in tow and hosts in hand,
The rabbit's launch plans now are planned!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding SSH session profile planning support to the standalone CLI. It is concise, clear, and reflects the core functionality introduced across config, CLI, and session planning modules.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/standalone-session-profiles

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@qarlus qarlus merged commit a98186e into dev Apr 9, 2026
7 checks passed
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.

1 participant