CLI-1796: Productionize the v3 commands for CLI.#2013
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
|
Try the dev build for this PR: https://acquia-cli.s3.amazonaws.com/build/pr/2013/acli.phar |
There was a problem hiding this comment.
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.enabledfiltering to v3 operation inclusion logic (default include when missing). - Extend PHPUnit coverage to validate
enabled: false|true|missingbehavior. - Record the upstream
api-specsgit SHA toassets/acquia-v3-spec.versionduring spec build/update and always load the bundled v3 spec inbin/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.
|
I don't think we should pass version=2 for API v3. |
* 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>
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
enabledflag, with tests added to verify this behavior. Additionally, the API spec build process now records the git commit hash used.CLI operation filtering improvements:
shouldSkipOperationinApiV3CommandHelper.phpto skip operations that havex-acquia-exposure.channels.cli.enabledset tofalse, in addition to the existing audience filtering. The default is now to include operations unless explicitly disabled.ApiV3CommandHelperTest.phpto cover the new CLI channel filtering logic, including cases forenabled: false,enabled: true, and missingenabled(defaults to included).Build process improvements:
composer.jsonbuild scripts to write the git commit hash of the API spec toassets/acquia-v3-spec.versionduring the build process.assets/acquia-v3-spec.versionfile, which contains the commit hash for traceability.