Skip to content

CLI-1822: Update specs for environment and sites service.#2015

Open
deepakmishra2 wants to merge 2 commits into
mainfrom
CLI-1822
Open

CLI-1822: Update specs for environment and sites service.#2015
deepakmishra2 wants to merge 2 commits into
mainfrom
CLI-1822

Conversation

@deepakmishra2

@deepakmishra2 deepakmishra2 commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

This pull request improves how API commands handle server definitions from OpenAPI specs, ensuring compatibility with both new and old spec formats. It also adds comprehensive tests to verify this behavior and introduces a new functional test for the trusted proxies API command.

API Command Server Resolution Improvements:

  • Updated generateApiCommandsFromSpec in ApiCommandHelper.php to prioritize per-path servers over top-level servers, and to avoid setting servers if neither is defined. This ensures correct handling for both new and legacy API spec formats.

Testing Enhancements:

  • Added three new tests in ApiCommandHelperTest.php to verify:
    • Per-path servers are used when no top-level servers exist.
    • Top-level servers are used as a fallback when no per-path servers exist.
    • No servers are set when neither are defined, ensuring the property remains uninitialized.
  • Added ReflectionProperty import to support property inspection in tests.

Functional Command Test:

  • Added a new test in ApiCommandTest.php to verify that the api:environments:trusted-proxies command executes an HTTP GET request correctly and returns the expected JSON structure and status code.

Version Update:

  • Updated the acquia-spec.version file to reference a new spec version, likely reflecting upstream API changes.

**Quick smoke test **

  • ./bin/acli api:accounts:ssh-keys-list *

@deepakmishra2 deepakmishra2 added the breaking change Requires change record label Jul 2, 2026
Copilot AI review requested due to automatic review settings July 2, 2026 04:49

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.

Pull request overview

This pull request updates Acquia Cloud API specs and adjusts API command generation so CLI-created commands resolve servers correctly across both legacy specs (top-level servers) and newer specs (per-path servers), with added unit/functional test coverage to prevent regressions.

Changes:

  • Update ApiCommandHelper::generateApiCommandsFromSpec() to prefer per-path servers, fall back to top-level servers, and avoid calling setServers() when no servers are defined.
  • Add PHPUnit coverage validating server-resolution behavior, including the “do not initialize servers when absent” case.
  • Add a functional test covering api:environments:trusted-proxies request execution/output, and refresh vendored spec assets/version.

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/Command/Api/ApiCommandHelper.php Updates server resolution logic for generated API commands (per-path preferred, top-level fallback, no-op when absent).
tests/phpunit/src/Commands/Api/ApiCommandHelperTest.php Adds unit tests verifying server resolution and uninitialized-property behavior.
tests/phpunit/src/Commands/Api/ApiCommandTest.php Adds functional test for api:environments:trusted-proxies GET behavior and JSON output.
assets/acquia-spec.version Bumps pinned upstream spec commit reference.
assets/acquia-spec.json Updates the vendored OpenAPI spec (including per-path servers and new trusted proxies endpoint).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov

codecov Bot commented Jul 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.45%. Comparing base (9f76383) to head (2a6a83c).

Additional details and impacted files
@@            Coverage Diff            @@
##               main    #2015   +/-   ##
=========================================
  Coverage     92.45%   92.45%           
  Complexity     1960     1960           
=========================================
  Files           123      123           
  Lines          7114     7115    +1     
=========================================
+ Hits           6577     6578    +1     
  Misses          537      537           

☔ 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

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown

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

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

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking change Requires change record

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants