Skip to content

feat: fix region be case insensitive and add user friendly message for org mismatch 403#426

Merged
dthampy merged 2 commits into
masterfrom
regression-bug-fix
Jun 2, 2026
Merged

feat: fix region be case insensitive and add user friendly message for org mismatch 403#426
dthampy merged 2 commits into
masterfrom
regression-bug-fix

Conversation

@dthampy
Copy link
Copy Markdown
Contributor

@dthampy dthampy commented Jun 2, 2026

Description

This PR includes two small bug fixes for aio runtime ip-list get:

  • Makes --region case-insensitive, so values like AMER, Amer, or amer are handled consistently.
  • Adds a friendlier error message when the IP list service returns a 403 because the resolved org is not accessible to the current IMS login.

Related Issue

ACNA-4652
ACNA-4653

Motivation and Context

Region input should not fail just because of casing and org/login mismatch errors should guide users toward the right recovery path instead of surfacing a raw 403

How Has This Been Tested?

Tested the plugin locally by aio plugins link .

aio runtime ip-list get --region amer
aio runtime ip-list get --region AMER
aio runtime ip-list get --region Amer

Three use cases for the mismatched org/ims login
Case 1- No local .aio config, where the command falls back to saved/global org config
Case 2 : Local .aio config points to an org that the current IMS login doesn't grant access to
Case 3: Happy path where the resolved org matches the current login

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 PR Reviewer

The changes are well-structured and thoroughly tested. The new resolveImsOrgId return shape, scope-aware error routing, case-insensitive region handling, and the oclif error passthrough guard are all implemented correctly with matching test coverage. One minor issue: the error message in run() still references flags.region (the original casing) after flags.region has been reassigned to the lowercase value, so the error will now show lowercase even though the intent (and the new test) expects the original user-supplied casing to be preserved.

📝 1 suggestion(s) - Please review inline comments below.

Findings (line numbers not in diff):

  • src/commands/runtime/ip-list/get.js (line 282): After flags.region = region the error still reads flags.region, which now holds the lowercased value. The user-supplied casing should be captured before it is overwritten so the error message matches what the user typed (and what the new test asserts).

💡 How to re-trigger

Comment /review or /pr-reviewer on this PR

@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 2, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@dthampy dthampy requested a review from pru55e11 June 2, 2026 19:13
@dthampy
Copy link
Copy Markdown
Contributor Author

dthampy commented Jun 2, 2026

🤖 PR Reviewer

The changes are well-structured and thoroughly tested. The new resolveImsOrgId return shape, scope-aware error routing, case-insensitive region handling, and the oclif error passthrough guard are all implemented correctly with matching test coverage. One minor issue: the error message in run() still references flags.region (the original casing) after flags.region has been reassigned to the lowercase value, so the error will now show lowercase even though the intent (and the new test) expects the original user-supplied casing to be preserved.

📝 1 suggestion(s) - Please review inline comments below.

Findings (line numbers not in diff):

  • src/commands/runtime/ip-list/get.js (line 282): After flags.region = region the error still reads flags.region, which now holds the lowercased value. The user-supplied casing should be captured before it is overwritten so the error message matches what the user typed (and what the new test asserts).

The re-assignment on flags.region = region on line 285 happens after this.error() call on the previous line. If this.error() were to throw when the validation fails, the assignment is unreachable and the error message keeps the user supplied casing

aio runtime ip-list get --region MARS
invalid region "MARS". Expected one of: amer, emea, apac, aus 

Hence dismissing this comment as not relevant

@dthampy dthampy dismissed github-actions[bot]’s stale review June 2, 2026 19:38

The re-assignment on flags.region = region on line 285 happens after this.error() call on the previous line. If this.error() were to throw when the validation fails, the assignment is unreachable and the error message keeps the user supplied casing

aio runtime ip-list get --region MARS
invalid region "MARS". Expected one of: amer, emea, apac, aus
Hence dismissing this comment as not relevant

@dthampy dthampy merged commit 6ded689 into master Jun 2, 2026
11 checks passed
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.

3 participants