fix(env:deploy:type): update settings via direct PATCH#94
Open
pjcdawkins wants to merge 1 commit into
Open
Conversation
The command set the deployment type with $settings->update(), which runs the client's "edit" operation. That operation requires an "#edit" HAL link on the /settings resource, but the API only returns a "self" link, so the command failed with "Operation not available: edit". This was introduced when the command switched from $environment->setManualDeployments() to $settings->update(). Replace the update() call with a direct PATCH request to the settings endpoint. The mock API's /settings response previously included a fabricated "#edit" link, hiding the regression. Remove it so the mock matches the real API, and the integration test now exercises the failing path. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a regression in the legacy environment:deploy:type command where updating environment deployment settings failed because the /settings resource does not advertise an #edit HAL link, causing the client’s update() path to throw before issuing any PATCH request.
Changes:
- Update
environment:deploy:typeto PATCH the settings endpoint directly and wrap the response in aResultto preserve the existing activity-wait flow. - Adjust the mock API’s environment settings resource to only expose a
selflink (matching production behavior), removing the fabricated#editlink.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| pkg/mockapi/environments.go | Aligns mock /settings HAL links with production (self-only), ensuring tests exercise the real failure mode. |
| legacy/src/Command/Environment/EnvironmentDeployTypeCommand.php | Switches from $settings->update() to a direct PATCH and wraps the response in Result to keep activity waiting behavior consistent. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
env:deploy:type <type>fails withOperation not available: edit:The command set the deployment type with
$settings->update(), which runs the client'seditoperation. That operation requires an#editHAL link on the/settingsresource, but the API only returns aselflink:{ "id": "settings", "_links": { "self": {"href": ".../settings"} }, "enable_manual_deployments": false }So
operationAvailable('edit')was always false and the update threw before sending any PATCH.This was a regression introduced when the command switched from
$environment->setManualDeployments()to$settings->update().Fix
Replace the
update()call with a directPATCHrequest to the settings endpoint, wrapping the response in aResultso the existing activity-wait path is unchanged.Tests
The
TestEnvironmentDeployTypeintegration test previously passed only because the mock API fabricated an#editlink that the real API never sends. The mock's/settingsresponse is corrected to return onlyself, matching production, so the test now exercises the failing path. With the fix, the full integration suite passes.🤖 Generated with Claude Code