fix(tui): guard live-list panic and refresh stale wizard hint bar#25
Merged
Conversation
Two correctness fixes surfaced by an adversarial review of the keybinding/live-list work on this branch: - liveListModel.Update now early-returns on liveListUpdateMsg once a selection is chosen. bubbletea drains queued messages after tea.Quit, so a pumped update could refilter and empty matched, panicking View's chosen branch (index out of range). Added regression test. - compositeModel.Update re-reads prompt.Hints() after forwarding a key, instead of relying on the one-time snapshot taken in setPrompt. Prompt hint labels are dynamic (e.g. esc flips to "clear filter" while filtering), so the wizard bottom bar went stale. Added regression test. Also clarify the refilter allocation comment and document the testing.Prompter.LiveList drain-goroutine lifecycle contract. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two correctness fixes surfaced by an adversarial review of the keybinding/live-list TUI work (the feature itself already landed on
main).liveListModel.Updatenow early-returns onliveListUpdateMsgonce a selection is chosen. bubbletea drains queued messages aftertea.Quit, so a pumped update could refilter and emptymatched, panickingView's chosen branch (index out of range).compositeModel.Updatere-readsprompt.Hints()after forwarding a key instead of relying on the one-time snapshot fromsetPrompt. Prompt hint labels are dynamic (e.g.escflips toclear filterwhile filtering), so the wizard bottom bar went stale.Also clarifies the
refilterallocation comment and documents thetesting.Prompter.LiveListdrain-goroutine lifecycle contract.Test plan
TestLiveList_NoPanicOnUpdateAfterChosen,TestComposite_HintBar_RefreshesOnFilter(both fail before the fix, pass after).go build ./...,go test ./...,make lintall green.🤖 Generated with Claude Code