Skip to content

fix(variable:create): forward --level when handing off to variable:update - #199

Merged
pjcdawkins merged 1 commit into
mainfrom
cli-194-forward-level-on-update
Oct 2, 2026
Merged

pjcdawkins merged 1 commit into
mainfrom
cli-194-forward-level-on-update

Conversation

@dephekt

@dephekt dephekt commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

variable:create --update --level <level> loses the level when the variable already exists. create resolves the variable at the requested level, then hands off to variable:update, but excludes --level from the forwarded options (VariableCreateCommand.php, the handoff loop). So update looks the name up with no level, and two cases fail:

  • A name present at both project and environment level fails with "Variable found at both project and environment levels", even with --level given.
  • --level project without --environment fails with "No environment specified", because update only waives the environment requirement for an explicit project level.

The fix removes --level from the exclusion list. variable:update has accepted --level since the handoff was added in #1247, so the exclusion appears to have been grouped with --prefix by mistake.

TestVariableCreateUpdateWithLevel covers both failures, plus the no-level path as a guard. Before the fix, the first three cases fail with the messages above; after it, all four pass. Putting --level back in the list makes them fail again. make integration-test, make lint and the legacy tests pass.

CLI-194

…date

With --update, an existing variable is handed to variable:update, but
--level was dropped from the forwarded options, so update looked the
variable up with no level. A name present at both project and
environment level then failed with "Variable found at both project and
environment levels", and --level project without --environment failed
with "No environment specified", although create had already resolved
the variable.

The exclusion was introduced in c0c6774 (#1247) next to --prefix and
carried through f5b7f32 (#1426), with no rationale given in either.
variable:update has accepted --level throughout.
@pjcdawkins
pjcdawkins merged commit 6f794ef into main Oct 2, 2026
6 checks passed
@pjcdawkins
pjcdawkins deleted the cli-194-forward-level-on-update branch October 2, 2026 22:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants