fix(project): resolve -e/--env for all Admin-API commands#1257
Draft
Lena (moshimorschi) wants to merge 1 commit into
Draft
fix(project): resolve -e/--env for all Admin-API commands#1257Lena (moshimorschi) wants to merge 1 commit into
Lena (moshimorschi) wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1257 +/- ##
==========================================
+ Coverage 53.46% 54.22% +0.75%
==========================================
Files 303 303
Lines 23322 23342 +20
==========================================
+ Hits 12470 12657 +187
+ Misses 10848 10644 -204
- Partials 4 41 +37
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Lena (moshimorschi)
force-pushed
the
fix/project-env-flag-admin-api
branch
from
July 24, 2026 13:31
0350bac to
b992325
Compare
Only the executor-based commands resolved the -e/--env flag. Every Admin-API command (extension list/install/uninstall/activate/ deactivate/update/delete/outdated/upload, admin-api, clear-cache, upgrade-check) built its client straight from the base config, so -e staging silently targeted the default shop and an unknown environment name was not rejected. A mutating command could act on the wrong (possibly production) shop. Add Config.WithEnvironment, which applies the selected environment's URL and admin_api over the base config, and a readConfigWithEnvironment helper that every Admin-API command now uses. Unknown environment names fail with the same error the executor path already returns.
Lena (moshimorschi)
force-pushed
the
fix/project-env-flag-admin-api
branch
from
July 24, 2026 13:35
b992325 to
0c89454
Compare
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.
What changed?
All
projectcommands that talk to a shop now resolve the target environment from-e/--env, matching the executor-based commands. Previously only executor commands (admin-build,ci,dev, ...) honored the flag; the Admin-API commands built their client from the base config and ignored it.Behavior with the issue's config (base URL port 9,
environments.stagingport 29):extension list -e stagingextension uninstall -e staging Fooextension list -e nonexistentenvironment "nonexistent" not found in configextension list(no-e)Why?
-e stagingsilently targeting the default environment means a mutating command such asextension uninstall -e staging MyPlugincould act on the wrong, possibly production, shop, and environment-name typos passed silently. See #1226 for the full analysis.How was this tested?
Config.WithEnvironmentunit tests (override, base fallback, unknown-name error, no-op when no environments, no mutation of the original config).listend-to-end tests asserting-e stagingcontacts the staging URL and-e nonexistentis rejected.go test ./...passes;gofmtandgo vetclean.Related issue or discussion
Fixes #1226