Skip to content

fix(init): align main menu order and styling#355

Merged
rianjs merged 3 commits into
mainfrom
fix/354-init-main-menu-style
Jun 20, 2026
Merged

fix(init): align main menu order and styling#355
rianjs merged 3 commits into
mainfrom
fix/354-init-main-menu-style

Conversation

@rianjs

@rianjs rianjs commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Summary

  • moves the cr init root menu to secrets-management-first ordering
  • adds a custom Bubble Tea root-menu renderer using the existing initLinearTheme styling
  • keeps TERM=dumb / non-TTY on the accessible huh.Select fallback with matching numeric order
  • moves counts/context into secondary description rows and removes old title suffixes like (1)

Closes #354

Verification

  • go test -count=1 ./internal/cmd/credentialcmd
  • go test -count=1 ./...
  • make lint
  • tmux 120x40 plain capture: order is secrets management, LLM runtimes, reviewer entities, review profiles, global settings, commit, discard
  • tmux 120x40 ANSI capture: title blue/bold, caret magenta, selected row green, descriptions/help muted
  • tmux navigation capture: j moves selected row from secrets management to LLM runtimes
  • tmux 80x40 capture: no obvious clipping/wrapping in the main menu
  • tmux q capture: returns cleanly to shell without commit

@rianjs

rianjs commented Jun 20, 2026

Copy link
Copy Markdown
Contributor Author

Major

  • internal/cmd/credentialcmd/init_menu.go:173: The primary Bubble Tea path’s disabled-selection behavior is not covered. Current tests only reject disabled actions through the accessible huh.Select fallback, but the new TTY path has separate logic for disabled rows and error rendering. Add deterministic model tests that press Enter on disabled LLM/reviewer/save rows and assert no quit, no result, and the reason is shown.

Minor

  • internal/cmd/credentialcmd/init_menu.go:161: ctrl+c and esc now map to the discard action and return success, but the product request only specified the explicit discard menu item. q is documented in help and verified; either keep only that shortcut or add explicit tests/docs for ctrl+c/esc as intentional discard semantics.

Ran: go test -count=1 ./internal/cmd/credentialcmd.

@rianjs

rianjs commented Jun 20, 2026

Copy link
Copy Markdown
Contributor Author

No findings.

The revised PR now matches the agreed architecture: primary TTY rendering uses the shared ordered item data and initLinearTheme, accessible fallback remains title-only with matching numeric order, disabled rows are exercised through deterministic Bubble Tea tests, and only the documented q shortcut maps to discard.

Verified locally: go test -count=1 ./internal/cmd/credentialcmd.

@rianjs

rianjs commented Jun 20, 2026

Copy link
Copy Markdown
Contributor Author

Findings

  • Blocker: the new tests never execute the real terminal path in runInitMenu() or a terminal-backed ChooseAction(). Everything either hits the extracted model directly or forces the accessible fallback with TERM=dumb / non-file streams ([credentialcmd_test.go](/Users/rianjs/dev/codereview-cli/internal/cmd/credentialcmd/credentialcmd_test.go#L12068), [credentialcmd_test.go](/Users/rianjs/dev/codereview-cli/internal/cmd/credentialcmd/credentialcmd_test.go#L12205)), so a broken Bubble Tea menu, wrong initial selection, or tmux-only regression could still merge. The new TTY branch in [init_menu.go](/Users/rianjs/dev/codereview-cli/internal/cmd/credentialcmd/init_menu.go#L30) is effectively unproven.
  • Major: TestInitMenuUseAccessibleFallback only proves the true branch. For the TERM=xterm case it still uses strings.NewReader and bytes.Buffer, which already force fallback, so the term.IsTerminal logic in [init_menu.go](/Users/rianjs/dev/codereview-cli/internal/cmd/credentialcmd/init_menu.go#L44) could be wrong or even always return true and the test would still pass.
  • Minor: TestInitMenuStyledViewShowsRootMenuOrder checks menu titles and that a caret exists, but it does not assert that the secondary description rows are actually rendered or attached to the right items. A bug in renderItem() or View() that drops/misplaces descriptions would still satisfy [credentialcmd_test.go](/Users/rianjs/dev/codereview-cli/internal/cmd/credentialcmd/credentialcmd_test.go#L12122).

@monit-reviewer

Copy link
Copy Markdown

PR review failed and the daemon has stopped retrying for this commit. I am removing my pending review request to stop the automated review cycle. Re-request @monit-reviewer to retry, or push a new commit and re-request.

@monit-reviewer monit-reviewer 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.

Automated PR Review

Reviewed commit: 3fcf44d

Manually approved via CLI.

@rianjs

rianjs commented Jun 20, 2026

Copy link
Copy Markdown
Contributor Author

No findings.

No architectural drift found. The daemon-era additions stay tied to the accepted design: the PTY-backed test verifies the TTY branch of the fallback gate, the direct Bubble Tea execution test is scoped to the new renderer, and the production menu behavior remains secrets-first with title-only accessible fallback labels and q as the only discard shortcut.

Verified locally: go test -count=1 ./internal/cmd/credentialcmd.

@rianjs rianjs merged commit 6044347 into main Jun 20, 2026
10 checks passed
@rianjs rianjs deleted the fix/354-init-main-menu-style branch June 20, 2026 17:58
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.

True up cr init main menu ordering and styling

2 participants