Skip to content

feat: add favorite contexts#228

Merged
nathanhuh merged 2 commits into
mainfrom
feat/favorite-contexts
Jun 18, 2026
Merged

feat: add favorite contexts#228
nathanhuh merged 2 commits into
mainfrom
feat/favorite-contexts

Conversation

@nathanhuh

@nathanhuh nathanhuh commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds favorite context support to the context picker so users can pin frequently used AWS contexts the same way they can pin AWS services.

Related Issues

Closes #227

Validation

  • make test
  • make build

Checklist

  • Scope is focused
  • Branch name follows docs/branch-naming-harness.md
  • Documentation harness reviewed (docs/documentation-harness.md)
  • README updated if user-facing behavior changed
  • Relevant docs/ pages updated if architecture, auth, config, or workflow changed
  • Tests/validation included
  • Breaking changes documented

Summary by CodeRabbit

Release Notes

  • New Features
    • Context favoriting: Mark contexts as favorites using the f key in the context picker. Favorited contexts automatically sort to the top of the list for easier navigation. Favorite selections are saved to the configuration and persist across sessions.

- persist favorite context names in config alongside favorite services
- group favorite contexts first in the picker without changing configured ordering
- render favorite contexts with favorite styling and cover toggle behavior
@coderabbitai

coderabbitai Bot commented Jun 18, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@nathanhuh, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 46 minutes and 14 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate.

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, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: d20b5b65-6f96-4ec7-8cbc-1fa8670e4de5

📥 Commits

Reviewing files that changed from the base of the PR and between 3515fd7 and 68c69d9.

📒 Files selected for processing (2)
  • internal/app/context_list.go
  • internal/app/screen_context_test.go

Walkthrough

Adds favorite-context support to the TUI context picker. The config schema gains favorites.contexts with load/save functions. The Model tracks a favoriteContexts map initialized from config, backed by a new context_list.go with sort, filter, toggle, and persistence helpers. The context picker wires the f key, updates rendering, help text, and includes three new tests. README is updated accordingly.

Changes

Favorite Contexts Feature

Layer / File(s) Summary
Config schema, normalization, and persistence
internal/config/config.go, internal/config/config_test.go
fileFavorites gains a Contexts field; Config gains FavoriteContexts []string; ContextInfo gains Favorite bool. Load/LoadNamedContext normalize and populate FavoriteContexts. Contexts marks each entry's Favorite flag. normalizeFavoriteServices now delegates to a shared normalizeFavoriteNames helper alongside a new normalizeFavoriteContexts. New exported SetFavoriteContexts writes favorites.contexts to disk. Tests cover load, write, and existing context-order assertions.
Model state initialization and context list management
internal/app/app.go, internal/app/context_list.go, internal/app/filter.go
Model gains a favoriteContexts map[string]struct{} field initialized in New from cfg.FavoriteContexts. New context_list.go implements contextsWithFavoriteState, sortFavoriteContextsFirst, applyContextListFilter, toggleFavoriteContext (with persistence and adjacent-selection fallback), adjacentContextName, selectContextByName, and favoriteContextNames. filter.go delegates context refresh to applyContextListFilter.
TUI key handling, rendering, help, and tests
internal/app/screen_context.go, internal/app/context_table.go, internal/app/help.go, internal/app/screen_context_test.go
contextsLoadedMsg applies favorite state and sorts on load. A new case "f" in the context picker key handler calls toggleFavoriteContext and routes errors to screenError. contextTableRows renders the name with favoriteServiceStyle when ctx.Favorite is true. Help bar strings and the help shortcut list include the f action. shouldStartContextIncrementalFilter allows "f" to begin filtering. Three new tests validate sort-first rendering, persistence toggling, and cursor-adjacent-selection behavior.
README documentation
README.md
Config YAML example adds a favorites.contexts entry. Global f shortcut description is broadened to include contexts. Context Picker help row is expanded to document favorites.contexts, favorite rendering, and ordering behavior.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested reviewers

  • YoungJinJung
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The PR title uses the conventional 'feat:' prefix and clearly describes the main feature addition of favorite contexts.
Description check ✅ Passed The PR description includes all required sections: Summary, Related Issues, Validation, and a completed Checklist with one unchecked item appropriately documented.
Linked Issues check ✅ Passed The implementation fully addresses all three objectives from issue #227: adds favoriting support, persists favorites in config, and groups/displays favorites with order preservation.
Out of Scope Changes check ✅ Passed All changes are focused on adding favorite contexts support across config, TUI, filtering, and tests with no unrelated modifications detected.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/favorite-contexts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@amazon-q-developer amazon-q-developer Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The favorite contexts implementation looks solid. The code follows established patterns from the existing favorite services feature, includes comprehensive test coverage, and properly handles edge cases like cursor positioning after favoriting. No blocking issues identified.


You can now have the agent implement changes and create commits directly on your pull request's source branch. Simply comment with /q followed by your request in natural language to ask the agent to make changes.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 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/context_list.go`:
- Around line 64-80: The favorite toggle operation is not atomic because
in-memory state is modified before persisting to disk. If the
configSetFavoriteContextsFn call fails, the in-memory state (m.favoriteContexts
and m.cfg.FavoriteContexts) has already been changed while the file state
remains unchanged. Reorder the operations to persist to disk first by calling
configSetFavoriteContextsFn with the new favorites list before modifying
m.favoriteContexts and m.cfg.FavoriteContexts, ensuring that in-memory state
only changes if persistence succeeds.

In `@internal/app/screen_context_test.go`:
- Around line 107-187: Add a new test function following the pattern of
TestContextPickerFavoriteTogglePersists and
TestContextPickerFavoriteToggleSelectsNextContext to cover the error case where
configSetFavoriteContextsFn returns an error. In this test, stub
configSetFavoriteContextsFn to return a non-nil error, perform the favorite
toggle action (pressing 'f'), and then assert that the error is properly
captured in the model's error state (check the screenError field or equivalent),
that an appropriate error message is displayed, and that the favorite state in
the config and model remains unchanged, ensuring the error prevents the favorite
from being committed.
🪄 Autofix (Beta)

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: 39de31d7-2340-4a95-a3cc-74c6b604d045

📥 Commits

Reviewing files that changed from the base of the PR and between 0b33442 and 3515fd7.

📒 Files selected for processing (10)
  • README.md
  • internal/app/app.go
  • internal/app/context_list.go
  • internal/app/context_table.go
  • internal/app/filter.go
  • internal/app/help.go
  • internal/app/screen_context.go
  • internal/app/screen_context_test.go
  • internal/config/config.go
  • internal/config/config_test.go
📜 Review details
🧰 Additional context used
📓 Path-based instructions (5)
**/*.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_list.go
  • internal/app/context_table.go
  • internal/app/app.go
  • internal/app/filter.go
  • internal/app/help.go
  • internal/app/screen_context.go
  • internal/app/screen_context_test.go
  • internal/config/config.go
  • internal/config/config_test.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_list.go
  • internal/app/context_table.go
  • internal/app/app.go
  • internal/app/filter.go
  • internal/app/help.go
  • internal/app/screen_context.go
  • internal/app/screen_context_test.go
  • internal/config/config.go
  • internal/config/config_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_list.go
  • internal/app/context_table.go
  • internal/app/app.go
  • internal/app/filter.go
  • internal/app/help.go
  • internal/app/screen_context.go
  • internal/app/screen_context_test.go
**

⚙️ CodeRabbit configuration file

**: # unic — Roles

Developer

You — All implementation, code review, testing, and releases.

Advisor (Kiro)

Senior engineer role. Responsibilities:

  • Architecture decisions and trade-off analysis
  • Code review guidance when asked
  • Debugging help and troubleshooting
  • AWS SDK / API usage advice
  • Bubbletea / TUI pattern recommendations
  • Suggest approaches, never write code autonomously

Rule: Advisor does not write or modify code unless explicitly asked. All code is written by the developer.

Documentation Harness

When implementation changes affect user-visible behavior, config/auth behavior, service coverage, TUI flow, or contributor workflow:

A feature change is not considered complete until the related docs are reviewed and updated when needed.

Branch Naming Harness

When creating a working branch for repository work, prefer the convention defined in docs/branch-naming-harness.md.

Expected format:

  • <work-type>/<issue-number>-<short-description>

Examples:

  • feature/58-s3-browser
  • bugfix/76-s3-region-error-handling
  • docs/79-documentation-harness

Worktree Isolation Rule

All repository work must start from main in a fresh git worktree.

  • Before editing files, fetch or otherwise verify the intended main base.
  • Create a new worktree and branch from main or origin/main.
  • Do not implement new work directly in the primary checkout or on an existing
    feature branch.
  • Keep one worktree per task, issue, or PR-sized change.
  • If follow-up work appears to depend on another unmerged branch, still create a
    fresh worktree from main first, then explicitly document and apply the
    dependency only when it is unavoidable.

Files:

  • internal/app/context_list.go
  • internal/app/context_table.go
  • internal/app/app.go
  • internal/app/filter.go
  • internal/app/help.go
  • internal/app/screen_context.go
  • internal/app/screen_context_test.go
  • README.md
  • internal/config/config.go
  • internal/config/config_test.go
**/*_test.go

📄 CodeRabbit inference engine (CLAUDE.md)

Tests use mock client interfaces (see rds_test.go pattern) in Go test files

Files:

  • internal/app/screen_context_test.go
  • internal/config/config_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/screen_context_test.go
  • internal/config/config_test.go
README.md

📄 CodeRabbit inference engine (CLAUDE.md)

README.md: When adding, modifying, or deleting features, always update README.md in parallel with code changes
Update Currently Implemented Features table in README.md: add new services/features, update status changes (🚧→✅), remove deleted items
Update TUI Key Bindings table in README.md when key bindings are added, changed, or deleted
Update Usage section in README.md when new CLI commands or flags are added
Update Configuration section 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 (8)
internal/config/config.go (1)

39-40: LGTM!

Also applies to: 90-91, 125-126, 211-212, 258-259, 275-299, 313-317, 329-330, 347-353, 674-701

internal/config/config_test.go (1)

114-136: LGTM!

Also applies to: 185-222, 473-476, 500-502

internal/app/screen_context.go (1)

19-21: LGTM!

Also applies to: 190-198, 336-343, 352-353

internal/app/help.go (1)

668-669: LGTM!

README.md (1)

150-151: LGTM!

Also applies to: 336-337, 363-367

internal/app/app.go (1)

174-174: LGTM!

Also applies to: 231-235, 244-244

internal/app/filter.go (1)

176-176: LGTM!

internal/app/context_table.go (1)

110-119: LGTM!

Comment thread internal/app/context_list.go
Comment thread internal/app/screen_context_test.go
- persist favorite context changes before mutating model state
- add regression coverage for favorite persistence failures
@nathanhuh nathanhuh merged commit 0543b0c into main Jun 18, 2026
2 checks passed
@nathanhuh nathanhuh deleted the feat/favorite-contexts branch June 18, 2026 06:46
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.

Add favorite contexts

2 participants