feat: add multi-region context scopes - #234
Conversation
|
Warning Review limit reached
Next review available in: 37 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (9)
WalkthroughThe change separates authentication settings from resource-region settings. Context loading supports structured and legacy fields. AWS repositories can switch regions while reusing credentials. The TUI adds a multi-region picker and ChangesMulti-region resource contexts
Estimated code review effort: 4 (Complex) | ~45 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 5
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
internal/app/context_add.go (1)
20-53: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winKeep the focused context-add input on screen for short terminals.
viewContextAddrenders completed fields, the current input, a confirmation line, and the help bar as one block. For the expanded SSO form, add windowing that reserves the appropriate screen chrome and keepsm.addFieldIdxin the visible area, usingvisibleLines := max(m.height-N, 5).🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@internal/app/context_add.go` around lines 20 - 53, Update viewContextAdd to window the expanded SSO form instead of rendering all fields unconditionally. Reserve space for the confirmation line and help bar, calculate visibleLines as max(m.height-N, 5) with the appropriate chrome count, and choose the field slice so m.addFieldIdx remains visible while preserving the current input and completed-field rendering.Sources: Coding guidelines, Path instructions
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@internal/app/app.go`:
- Around line 531-541: Update the region-switch eligibility logic used by the R
shortcut in app.go and help.go to use the same shared helper. The helper must
require non-nil m.cfg, multiple configured regions, no focused input or
text-entry screen, and must reject every active-request screen, including
screenLoading and screenInspectorScanning; use it both to open the picker and to
show the shortcut in help.
In `@internal/app/screen_region_test.go`:
- Around line 12-63: The region-picker tests currently omit updateRegionPicker
navigation and error paths. Extend coverage around updateRegionPicker to verify
q and esc restore regionPrevScreen, cursor movement updates the selected index,
selecting the active region completes the switch, and repository-creation
failures are handled; inject a mock repository/client seam for the failure test
rather than relying on AWS configuration.
In `@internal/app/screen_region.go`:
- Around line 84-92: Update the region-row rendering in the surrounding region
list function to write the region text with its existing row style and render
the “(active)” marker separately with dimStyle. Preserve cursor and selected-row
styling for the region text while ensuring the active label remains dimmed in
both selected and unselected rows.
In `@internal/auth/setup.go`:
- Around line 355-358: Update the Resources initialization in the generated SSO
context setup to persist only the regions after the normalized default region,
rather than the full base.Regions list. Keep DefaultRegion assigned from region
and slice base.Regions past its index when setting Regions.
In `@README.md`:
- Around line 173-185: Synchronize the preferred structured SSO example under
the production configuration with the required-fields table: verify the actual
CLI/TUI SSO configuration contract, then either add auth.profile to the example
if required or update the sso row to mark profile optional. Keep the
documentation consistent with the implemented behavior.
---
Outside diff comments:
In `@internal/app/context_add.go`:
- Around line 20-53: Update viewContextAdd to window the expanded SSO form
instead of rendering all fields unconditionally. Reserve space for the
confirmation line and help bar, calculate visibleLines as max(m.height-N, 5)
with the appropriate chrome count, and choose the field slice so m.addFieldIdx
remains visible while preserving the current input and completed-field
rendering.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 0279db6e-4625-4969-b331-21d8c9fe52f8
📒 Files selected for processing (17)
README.mddocs/architecture.en.mddocs/architecture.ko.mdinternal/app/app.gointernal/app/context_add.gointernal/app/context_add_test.gointernal/app/help.gointernal/app/messages.gointernal/app/screen_context.gointernal/app/screen_region.gointernal/app/screen_region_test.gointernal/app/styles.gointernal/auth/setup.gointernal/config/config.gointernal/config/config_test.gointernal/services/aws/repository.gointernal/services/aws/repository_test.go
📜 Review details
⏰ Context from checks skipped due to timeout. (1)
- GitHub Check: test
🧰 Additional context used
📓 Path-based instructions (6)
**/*.go
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.go: Use lipgloss for styled TUI output — column-aligned tables with dimmed labels in Go implementation files
Implement scroll windowing with formula:visibleLines := max(m.height-N, 5)in Go TUI implementation
Files:
internal/app/context_add_test.gointernal/app/screen_context.gointernal/app/screen_region.gointernal/config/config_test.gointernal/app/screen_region_test.gointernal/app/styles.gointernal/services/aws/repository.gointernal/app/help.gointernal/services/aws/repository_test.gointernal/auth/setup.gointernal/app/context_add.gointernal/app/app.gointernal/config/config.gointernal/app/messages.go
⚙️ CodeRabbit configuration file
**/*.go: For Go reviews, look beyond compilation and prioritize nil pointer risks,
context propagation, AWS SDK pagination, error wrapping, deterministic
sorting, and stable table/detail rendering. For new AWS service work,
verify that repository interfaces, model mapping, app integration, and
tests are updated together.
Files:
internal/app/context_add_test.gointernal/app/screen_context.gointernal/app/screen_region.gointernal/config/config_test.gointernal/app/screen_region_test.gointernal/app/styles.gointernal/services/aws/repository.gointernal/app/help.gointernal/services/aws/repository_test.gointernal/auth/setup.gointernal/app/context_add.gointernal/app/app.gointernal/config/config.gointernal/app/messages.go
**/*_test.go
📄 CodeRabbit inference engine (CLAUDE.md)
Tests use mock client interfaces (see
rds_test.gopattern) in Go test files
Files:
internal/app/context_add_test.gointernal/config/config_test.gointernal/app/screen_region_test.gointernal/services/aws/repository_test.go
⚙️ CodeRabbit configuration file
**/*_test.go: Check that tests cover API errors, mapping edge cases, and navigation
state transitions, not only happy paths. Prefer mock-based tests that do
not depend on external AWS calls.
Files:
internal/app/context_add_test.gointernal/config/config_test.gointernal/app/screen_region_test.gointernal/services/aws/repository_test.go
internal/app/**
⚙️ CodeRabbit configuration file
internal/app/**: For Bubble Tea screen changes, verify message routing, key handling,
filter target resets, height-based windowing, help text, and back/home
navigation against the existing screen patterns.
Files:
internal/app/context_add_test.gointernal/app/screen_context.gointernal/app/screen_region.gointernal/app/screen_region_test.gointernal/app/styles.gointernal/app/help.gointernal/app/context_add.gointernal/app/app.gointernal/app/messages.go
docs/**
⚙️ CodeRabbit configuration file
docs/**: Documentation must match implemented behavior. When both English and
Korean docs are updated, verify that they preserve the same meaning.
Files:
docs/architecture.en.mddocs/architecture.ko.md
internal/services/aws/**
⚙️ CodeRabbit configuration file
internal/services/aws/**: For AWS integration code, focus on SDK client interface mockability,
paginator usage, nil/empty response handling, AWS pointer conversion,
stable list ordering, and user-facing error messages.
Files:
internal/services/aws/repository.gointernal/services/aws/repository_test.go
README.md
📄 CodeRabbit inference engine (CLAUDE.md)
README.md: When adding, modifying, or deleting features, always updateREADME.mdin parallel with code changes
UpdateCurrently Implemented Featurestable in README.md: add new services/features, update status changes (🚧→✅), remove deleted items
UpdateTUI Key Bindingstable in README.md when key bindings are added, changed, or deleted
UpdateUsagesection in README.md when new CLI commands or flags are added
UpdateConfigurationsection in README.md when configuration format changes
Files:
README.md
⚙️ CodeRabbit configuration file
README.md: Verify that README changes match actual CLI/TUI behavior and that
Currently Implemented Features, TUI Key Bindings, Usage, and
Configuration content stay aligned with code changes.
Files:
README.md
🔇 Additional comments (16)
internal/config/config.go (1)
64-77: LGTM!Also applies to: 80-96, 112-112, 160-223, 255-310, 343-358, 418-439
internal/config/config_test.go (1)
6-6: LGTM!Also applies to: 279-334
README.md (1)
215-227: LGTM!Also applies to: 354-354
docs/architecture.en.md (1)
196-198: LGTM!docs/architecture.ko.md (1)
196-198: LGTM!internal/app/context_add.go (1)
128-170: LGTM!internal/app/context_add_test.go (1)
39-43: LGTM!internal/auth/setup.go (1)
321-335: LGTM!Also applies to: 346-354, 363-393
internal/app/styles.go (1)
112-116: LGTM!internal/services/aws/repository.go (1)
377-415: LGTM!internal/services/aws/repository_test.go (1)
8-10: LGTM!Also applies to: 44-65
internal/app/app.go (1)
109-109: LGTM!Also applies to: 188-189, 573-574, 733-734
internal/app/help.go (1)
723-728: LGTM!Also applies to: 974-975
internal/app/messages.go (1)
68-71: LGTM!internal/app/screen_context.go (1)
66-72: LGTM!internal/app/screen_region.go (1)
13-78: LGTM!Also applies to: 94-97
Summary
Separate AWS authentication identity from resource location and let one context switch between multiple configured regions.
authandresourcescontext sectionsRregion picker that keeps account and role unchangedCloses #233
Configuration
The default region is automatically included in the selectable list. Contexts without a region list retain the existing single-region behavior.
Verification
go vet ./...make testmake buildgit diff --checkSummary by CodeRabbit
New Features
R.Documentation