goharbor / goharbor/harbor-cli

[bug]: TUI selection cancel returns empty or zero-value choice instead of aborting

Open
#947 1 comment 0 reactions 0 assignees View on GitHub
bug status/needs-feedback status/needs-info
Dominant language
Go
Stars
163
Forks
211
Avg merge
1m
Merged PRs (30d)
1

Description

## Description
Interactive selection views do not consistently handle user cancellation. The shared selection model has an `Aborted` state, but it is not set when users press `q`, `esc`, or `ctrl+c`.
As a result, some selection wrappers may return an empty choice or zero-value ID instead of a clear cancellation error.

## Steps to Reproduce
1. Run command: `harbor project view`
2. With no project argument, so the CLI opens the interactive project selection view
3. Press `q`, `esc`, or `ctrl+c` to cancel the selection

## Expected Behavior
The selection view should mark the selection as aborted and return a clear cancellation error. Commands should not continue with an empty selection or zero-value resource ID.

## Actual Behavior
The shared selection model does not set `Aborted`, so callers may treat the result as an empty selection. In some wrappers, this can become an empty string or ID `0`.

## Environment
- OS: macOS
- Tool version: Harbor CLI main branch
- Other relevant details: Applies to shared TUI selection flows using `pkg/views/base/selection`.

## Additional Context
This is related to improving consistency in TUI state handling before introducing a unified loading/list/table abstraction.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.