feat: fix region be case insensitive and add user friendly message for org mismatch 403#426
Conversation
There was a problem hiding this comment.
🤖 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): Afterflags.region = regionthe error still readsflags.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 Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
The re-assignment on Hence dismissing this comment as not relevant |
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
Description
This PR includes two small bug fixes for aio runtime ip-list get:
--regioncase-insensitive, so values like AMER, Amer, or amer are handled consistently.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 .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
Checklist: