CLI-1837: remote:ssh should accept environmentId - #2046
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
|
Try the dev build for this PR: https://acquia-cli.s3.amazonaws.com/build/pr/2046/acli.phar |
There was a problem hiding this comment.
🟡 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:sshto useacceptEnvironmentId()anddetermineEnvironment()instead of a requiredaliasargument. - Updates/expands PHPUnit coverage for SSH command execution, including production environment selection and explicit
environmentIdUUID usage. - Updates
composer.lock(notably bumpingcomposer/composerfrom 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.
| $environment = $this->determineEnvironment($input, $output, true); | ||
| $alias = self::getEnvironmentAlias($environment); |
| 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']); | ||
|
|
Motivation
Fixes CLI-1837
Proposed changes