Skip to content

CLI-1837: remote:ssh should accept environmentId - #2046

Open
danepowell wants to merge 3 commits into
acquia:mainfrom
danepowell:CLI-1837
Open

CLI-1837: remote:ssh should accept environmentId#2046
danepowell wants to merge 3 commits into
acquia:mainfrom
danepowell:CLI-1837

Conversation

@danepowell

@danepowell danepowell commented Sep 10, 2026

Copy link
Copy Markdown
Collaborator

Motivation

Fixes CLI-1837

Proposed changes

  • Accept standard environmentID
  • Improve test coverage for this command (renames alias download command)

@codecov

codecov Bot commented Sep 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.76%. Comparing base (09a000b) to head (8312a21).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #2046      +/-   ##
============================================
- Coverage     92.76%   92.76%   -0.01%     
  Complexity     2032     2032              
============================================
  Files           126      126              
  Lines          7338     7337       -1     
============================================
- Hits           6807     6806       -1     
  Misses          531      531              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions

Copy link
Copy Markdown
Contributor

Try the dev build for this PR: https://acquia-cli.s3.amazonaws.com/build/pr/2046/acli.phar

curl -OL https://acquia-cli.s3.amazonaws.com/build/pr/2046/acli.phar
chmod +x acli.phar

@danepowell
danepowell marked this pull request as ready for review September 10, 2026 02:22
Copilot AI lite review requested due to automatic review settings September 10, 2026 02:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The updated remote:ssh implementation likely regresses support for passing an environment alias (e.g. myapp.dev) because the new environment-resolution path does not validate/convert aliases before calling the Cloud API.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Updates remote:ssh to accept a standard Cloud Platform environmentId argument (UUID/legacy ID) by aligning the command with the shared environment-selection flow used across the CLI.

Changes:

  • Refactors remote:ssh to use acceptEnvironmentId() and determineEnvironment() instead of a required alias argument.
  • Updates/expands PHPUnit coverage for SSH command execution, including production environment selection and explicit environmentId UUID usage.
  • Updates composer.lock (notably bumping composer/composer from 2.10.2 to 2.10.3).
File summaries
File Description
src/Command/Remote/SshCommand.php Switches command input to environmentId + shared environment resolution logic.
tests/phpunit/src/Commands/Remote/SshCommandTest.php Renames and expands SSH command tests for the new argument/selection paths.
tests/phpunit/src/Commands/Remote/SshCommandTestBase.php Removes alias-specific mocking helper no longer used by updated tests.
composer.lock Locks updated dependency versions, including composer/composer 2.10.3.
Review details
  • Files reviewed: 3/4 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +33 to +34
$environment = $this->determineEnvironment($input, $output, true);
$alias = self::getEnvironmentAlias($environment);
Comment on lines +83 to 105
public function testRemoteSshCommandWithEnvUuid(): void
{
$this->mockRequest('getEnvironment', '24-a47ac10b-58cc-4372-a567-0e02b2c3d470');
[$process, $localMachineHelper] = $this->mockForExecuteCommand();
$localMachineHelper->checkRequiredBinariesExist(['ssh'])
->shouldBeCalled();
$sshCommand = [
'ssh',
'site.dev@sitedev.ssh.hosted.acquia-sites.com',
'-t',
'-o StrictHostKeyChecking=accept-new',
'-o AddressFamily inet',
'-o LogLevel=ERROR',
'cd /var/www/html/site.dev; exec $SHELL -l',
];
$localMachineHelper
->execute($sshCommand, Argument::type('callable'), null, true, null, null)
->willReturn($process->reveal())
->shouldBeCalled();

$this->command->sshHelper = new SshHelper($this->output, $localMachineHelper->reveal(), $this->logger);
$this->executeCommand(['environmentId' => '24-a47ac10b-58cc-4372-a567-0e02b2c3d470']);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants