Skip to content

fix(cli): correct warnIfDeprecatedRegion message — --region is still honored, not ignored - #822

Merged
go-to-k merged 1 commit into
mainfrom
fix/818-region-warning-contradiction
Jun 13, 2026
Merged

fix(cli): correct warnIfDeprecatedRegion message — --region is still honored, not ignored#822
go-to-k merged 1 commit into
mainfrom
fix/818-region-warning-contradiction

Conversation

@go-to-k

@go-to-k go-to-k commented Jun 13, 2026

Copy link
Copy Markdown
Owner

Summary

warnIfDeprecatedRegion warned that --region is "deprecated for this command and has no effect" on non-bootstrap commands — but the flag IS honored everywhere: every command resolves region as options.region || process.env.AWS_REGION || 'us-east-1', feeding the provisioning/state-bucket SDK client region, the applyRoleArnIfSet STS hop, and (on deploy/destroy/import/export/orphan) process.env.AWS_REGION injected into the CDK synth subprocess. So --region is the highest-precedence region source, directly contradicting the "no effect" message.

Fix (option B — correct the warning, keep honoring the flag)

Changing behavior to actually ignore --region would silently break scripts that rely on it, so the least-surprising fix keeps the flag honored and corrects the message: now reads "deprecated and will be removed in a future release; still honored for now (it overrides AWS_REGION / your AWS profile); prefer AWS_REGION / your AWS profile." The option help text + JSDoc are updated to match.

No behavior change — purely the warning message + option description + docs. deploy.ts and all command files are untouched (no integ-gate scope affected).

Test plan

  • tests/unit/cli/options.test.ts: warning message updated; added assertions that neither the warning nor the description says "no effect" and both say "still honored".
  • Updated the 3 command tests (list / publish-assets / state-list) asserting the old wording.
  • Full suite 5728 tests pass.
  • Docs corrected: docs/cli-reference.md, docs/troubleshooting.md, .claude/rules/cli-internals.md.

Closes #818

warnIfDeprecatedRegion and the hidden deprecatedRegionOption help text
both claimed --region "has no effect" on non-bootstrap commands, but
every non-bootstrap command consumes options.region as the
highest-precedence region source (options.region || AWS_REGION ||
'us-east-1') for the SDK clients, the applyRoleArnIfSet STS hop, and
(deploy / destroy / import / export / orphan) the AWS_REGION env var
inherited by the synth subprocess. The warning and the code contradicted
each other.

Investigation confirmed --region IS legitimately honored everywhere
(option B in the issue), so the fix is purely in the warning text + the
option description -- no command implementation (deploy.ts etc.) is
touched, keeping the change out of the integ-broad merge-gate scope with
zero behavior-change risk. The warning now says the flag is deprecated
but still honored and steers users toward AWS_REGION / their AWS profile
without falsely claiming the flag did nothing.

Docs corrected to match: docs/cli-reference.md, docs/troubleshooting.md,
and the --region bullet in .claude/rules/cli-internals.md.

Tests: tests/unit/cli/options.test.ts updates the message assertion and
adds checks that neither the warning nor the option description contains
"no effect" and that both mention the flag is "still honored"; the three
command tests asserting the old wording (list / publish-assets /
state-list) are updated to the new message.

Closes #818
@go-to-k
go-to-k merged commit 4ec8230 into main Jun 13, 2026
5 checks passed
@go-to-k
go-to-k deleted the fix/818-region-warning-contradiction branch June 13, 2026 05:11
github-actions Bot pushed a commit that referenced this pull request Jun 13, 2026
## [0.220.2](v0.220.1...v0.220.2) (2026-06-13)

### Bug Fixes

* **cli:** correct warnIfDeprecatedRegion message — --region is still honored, not ignored ([#822](#822)) ([4ec8230](4ec8230))
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 0.220.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

warnIfDeprecatedRegion claims --region 'has no effect' but deploy.ts still consumes options.region (contradiction)

1 participant