Skip to content

CLI-1796: Productionize the v3 commands for CLI.#2013

Merged
deepakmishra2 merged 5 commits into
CLI-1793from
CLI-1796
Jun 29, 2026
Merged

CLI-1796: Productionize the v3 commands for CLI.#2013
deepakmishra2 merged 5 commits into
CLI-1793from
CLI-1796

Conversation

@deepakmishra2

@deepakmishra2 deepakmishra2 commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

This pull request updates the logic for filtering OpenAPI operations exposed to the CLI, adds corresponding tests, and improves the reproducibility of API spec builds. The main change is that operations can now be explicitly disabled for the CLI channel using the enabled flag, with tests added to verify this behavior. Additionally, the API spec build process now records the git commit hash used.

CLI operation filtering improvements:

  • Updated shouldSkipOperation in ApiV3CommandHelper.php to skip operations that have x-acquia-exposure.channels.cli.enabled set to false, in addition to the existing audience filtering. The default is now to include operations unless explicitly disabled.
  • Added unit tests in ApiV3CommandHelperTest.php to cover the new CLI channel filtering logic, including cases for enabled: false, enabled: true, and missing enabled (defaults to included).

Build process improvements:

  • Updated the composer.json build scripts to write the git commit hash of the API spec to assets/acquia-v3-spec.version during the build process.
  • Added the generated assets/acquia-v3-spec.version file, which contains the commit hash for traceability.

@codecov

codecov Bot commented Jun 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.49%. Comparing base (1b5aa97) to head (922e9ad).

Additional details and impacted files
@@             Coverage Diff             @@
##             CLI-1793    #2013   +/-   ##
===========================================
  Coverage       92.49%   92.49%           
- Complexity       1982     1984    +2     
===========================================
  Files             126      126           
  Lines            7169     7172    +3     
===========================================
+ Hits             6631     6634    +3     
  Misses            538      538           

☔ 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

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

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

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 PR productionizes Cloud API v3 command generation by adding explicit channel-based operation filtering, ensuring v3 commands are always loaded at runtime, and improving spec traceability by recording the upstream spec commit.

Changes:

  • Add channels.cli.enabled filtering to v3 operation inclusion logic (default include when missing).
  • Extend PHPUnit coverage to validate enabled: false|true|missing behavior.
  • Record the upstream api-specs git SHA to assets/acquia-v3-spec.version during spec build/update and always load the bundled v3 spec in bin/acli.

Reviewed changes

Copilot reviewed 4 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/phpunit/src/Commands/Api/ApiV3CommandHelperTest.php Adds unit tests covering channels.cli.enabled filtering behavior.
src/Command/Api/ApiV3CommandHelper.php Updates v3 skip logic to honor channels.cli.enabled: false in operation exposure.
composer.json Writes the upstream v3 spec git SHA to assets/acquia-v3-spec.version during the spec update script.
bin/acli Always loads v3 API commands from assets/acquia-v3-spec.json (removes optional file gate).
assets/acquia-v3-spec.version Adds the tracked spec-version stamp file for v3 spec traceability.

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

Comment thread composer.json
@vishalkhode1

Copy link
Copy Markdown
Contributor

I don't think we should pass version=2 for API v3.

@deepakmishra2 deepakmishra2 merged commit 1952f94 into CLI-1793 Jun 29, 2026
28 of 29 checks passed
@deepakmishra2 deepakmishra2 deleted the CLI-1796 branch June 29, 2026 13:34
deepakmishra2 added a commit that referenced this pull request Jun 30, 2026
* Bump the dependencies group with 2 updates (#2010)

Bumps the dependencies group with 2 updates: [guzzlehttp/guzzle](https://github.com/guzzle/guzzle) and [ramsey/uuid](https://github.com/ramsey/uuid).


Updates `guzzlehttp/guzzle` from 7.11.1 to 7.12.1
- [Release notes](https://github.com/guzzle/guzzle/releases)
- [Changelog](https://github.com/guzzle/guzzle/blob/7.12/CHANGELOG.md)
- [Commits](guzzle/guzzle@7.11.1...7.12.1)

Updates `ramsey/uuid` from 4.9.2 to 4.9.3
- [Release notes](https://github.com/ramsey/uuid/releases)
- [Changelog](https://github.com/ramsey/uuid/blob/4.x/CHANGELOG.md)
- [Commits](ramsey/uuid@4.9.2...4.9.3)

---
updated-dependencies:
- dependency-name: guzzlehttp/guzzle
  dependency-version: 7.12.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: dependencies
- dependency-name: ramsey/uuid
  dependency-version: 4.9.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* CLI-1793: Spike — POC to consume Cloud API v3 OpenAPI spec in ACLI

Adds a parallel command-generation path for v3 specs sourced from
`acquia/api-specs`, without touching the existing v2 or ACSF pipelines.

- composer.json: new `update-acquia-v3-spec` script that bundles
  site-service-php + environment-service-php via redocly, then
  translates legacy `x-cli-name` to ARB-550's
  `x-acquia-exposure.channels.cli.command` at the consumption boundary.
- src/Command/Api/ApiCommandHelper.php: extracted `getCliCommandName()`
  and `normalizePath()` as protected template methods. v2 behavior
  unchanged (defaults return legacy key / input path).
- src/Command/Api/ApiV3CommandHelper.php: subclass with strict ARB-550
  key lookup (no legacy fallback) and `/v3/` path prefixing for
  env-service endpoints (site-service endpoints are not prefixed on
  the live gateway and are left untouched).
- bin/acli: register `api:v3:*` commands under a `file_exists` guard,
  reusing the existing `ApiCommandFactory`.
- assets/acquia-v3-spec.json: first v3 bundle (20 operations across
  site-service-php + environment-service-php).
- docs/poc/acquia-v3-spec-ingestion.md: findings doc with go/no-go
  recommendation, upstream dependency tracking (API-1678 KaaS server,
  API-1674 CLI directive, acquia/api-specs PR #46 bundling fixes),
  and a cleanup plan for each jq transform once upstream catches up.

Tests: 32 pass / 159 assertions. 4 ARB-550 key cases, 4 path
normalization cases, 6 spec-file sanity checks, 5 real-bundle E2E
tests, plus v2 regression coverage via ApiCommandHelperTest and
ApiListCommandTest.

Live-verified end-to-end:
- `api:v3:environments:find <uuid>` returns 200 OK with real MEO env
  data from the production Cloud Platform gateway.
- `api:v3:sites:duplicate` accepted (202) and created a real
  duplicated site.
- No regressions on `api:*` (378 v2 commands) or `acsf:*` (128 commands).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* fix mutation testing.

* fix test and v3 changes.

* fix site instance issue.

* Fix gateway url and logic update.

* mutation test added

* fix cves.

* fix test.

* fix test

* feedback changes.

* update spec.

* add more test.

* add stability flag

* mutation testing fix.

* mutation test fix.

* logic for audience added.

* mutation fix again

* update make redocly call

* CLI-1796: Productionize the v3 commands for CLI. (#2013)

* CLI-1796: Productionize the v3 commands for CLI.

* fix CI.

* remove CI logic.

* ran composer command to update spec.

* update git ssh url.

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

3 participants