Skip to content

Hide already registered clients in thv client setup#3889

Merged
JAORMX merged 8 commits intostacklok:mainfrom
carlos-gn:feat/hide-registered-clients-in-setup
Mar 11, 2026
Merged

Hide already registered clients in thv client setup#3889
JAORMX merged 8 commits intostacklok:mainfrom
carlos-gn:feat/hide-registered-clients-in-setup

Conversation

@carlos-gn
Copy link
Contributor

Summary

  • Filters out clients that are already registered in all selected groups from the client selection step in thv client setup
  • When all installed clients are already registered for the selected groups, exits early with a clear message
  • Handles both interactive group selection (multiple groups) and auto-selected groups (single group)

Closes #1308

Test plan

  • Unit tests for FilterClientsAlreadyRegistered covering all edge cases
  • Unit tests for setupModel.Update verifying group-to-client transition filtering
  • Unit tests for client selection toggle and confirmation behavior
  • Manual testing: verify clients already registered in all selected groups are hidden
  • Manual testing: verify clients registered in only some groups still appear
  • Manual testing: verify "all clients registered" message when no clients remain

🤖 Generated with Claude Code

@github-actions github-actions bot added the size/M Medium PR: 300-599 lines changed label Feb 18, 2026
When selecting clients in `thv client setup`, clients that are already
registered for all selected groups are now filtered out of the selection
list. If all installed clients are already registered, the command exits
with a clear message instead of showing an empty list.

Closes stacklok#1308

Signed-off-by: carlos <21148423+carlos-gn@users.noreply.github.com>
@carlos-gn carlos-gn force-pushed the feat/hide-registered-clients-in-setup branch from 8931db6 to fea2308 Compare February 18, 2026 20:50
@github-actions github-actions bot added size/M Medium PR: 300-599 lines changed and removed size/M Medium PR: 300-599 lines changed labels Feb 18, 2026
@codecov
Copy link

codecov bot commented Feb 18, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 68.53%. Comparing base (d7f5dae) to head (4324952).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3889      +/-   ##
==========================================
- Coverage   68.59%   68.53%   -0.06%     
==========================================
  Files         447      448       +1     
  Lines       45691    45709      +18     
==========================================
- Hits        31340    31328      -12     
- Misses      11934    11962      +28     
- Partials     2417     2419       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions github-actions bot added size/M Medium PR: 300-599 lines changed and removed size/M Medium PR: 300-599 lines changed labels Feb 20, 2026
@github-actions github-actions bot added size/M Medium PR: 300-599 lines changed and removed size/M Medium PR: 300-599 lines changed labels Feb 21, 2026
@github-actions github-actions bot added size/M Medium PR: 300-599 lines changed and removed size/M Medium PR: 300-599 lines changed labels Feb 23, 2026
@github-actions github-actions bot added size/M Medium PR: 300-599 lines changed and removed size/M Medium PR: 300-599 lines changed labels Mar 3, 2026
@github-actions github-actions bot added size/M Medium PR: 300-599 lines changed and removed size/M Medium PR: 300-599 lines changed labels Mar 9, 2026
@carlos-gn
Copy link
Contributor Author

hi @eleftherias pls let me know if makes sense to keep this PR open

@eleftherias
Copy link
Member

Hi @carlos-gn, thanks for the reminder. This slipped through our review process, we'll look at it in the next few days. Apologies for the delay.

@github-actions github-actions bot added size/M Medium PR: 300-599 lines changed and removed size/M Medium PR: 300-599 lines changed labels Mar 10, 2026
@github-actions github-actions bot added size/M Medium PR: 300-599 lines changed and removed size/M Medium PR: 300-599 lines changed labels Mar 11, 2026
Copy link
Collaborator

@JAORMX JAORMX left a comment

Choose a reason for hiding this comment

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

Nice work! The filtering logic is correct and well-tested. A few minor cleanup items (use slices.Contains, move the sentinel error to pkg/client/, deduplicate the group-collection logic) will be addressed in a follow-up PR.

@JAORMX JAORMX merged commit 42f1356 into stacklok:main Mar 11, 2026
38 checks passed
JAORMX added a commit that referenced this pull request Mar 11, 2026
Follow-up to #3889 with four mechanical refactors (no behavior change):

- Replace hand-rolled loop with slices.Contains in isClientRegisteredInAllGroups
- Move ErrAllClientsRegistered sentinel from cmd/thv/app/ui/ to pkg/client/
- Extract selectedGroups() helper to deduplicate map-to-slice logic
- Add bounds check on group indices before indexing m.Groups

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
JAORMX added a commit that referenced this pull request Mar 11, 2026
Follow-up to #3889 with four mechanical refactors (no behavior change):

- Replace hand-rolled loop with slices.Contains in isClientRegisteredInAllGroups
- Move ErrAllClientsRegistered sentinel from cmd/thv/app/ui/ to pkg/client/
- Extract selectedGroups() helper to deduplicate map-to-slice logic
- Add bounds check on group indices before indexing m.Groups

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
JAORMX added a commit that referenced this pull request Mar 12, 2026
Follow-up to #3889 with four mechanical refactors (no behavior change):

- Replace hand-rolled loop with slices.Contains in isClientRegisteredInAllGroups
- Move ErrAllClientsRegistered sentinel from cmd/thv/app/ui/ to pkg/client/
- Extract selectedGroups() helper to deduplicate map-to-slice logic
- Add bounds check on group indices before indexing m.Groups

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/M Medium PR: 300-599 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Hide already registered clients in thv client setup command

3 participants