Fix flaky TestHuhPrompterMultiSelectWithSearchPersistence on slow architectures#13675
Fix flaky TestHuhPrompterMultiSelectWithSearchPersistence on slow architectures#13675pdostal wants to merge 1 commit into
Conversation
|
Thanks for your pull request! Unfortunately, it doesn't meet the requirements for review:
Please update your PR to address the above. This PR will be automatically closed in 4 days if these requirements are not met. Full contribution requirements
|
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR improves the reliability of Bubble Tea-based prompt tests by replacing fixed sleeps with a deterministic synchronization hook that waits for async search completion.
Changes:
- Add a test-only
onSearchDonecallback hook tomultiSelectSearchField, invoked when async search results are applied. - Extend the test interaction harness to support blocking “wait” steps (
waitFn) in addition to time-based delays. - Update the multi-select-with-search persistence test to wait for async search completion before submitting.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| internal/prompter/multi_select_with_search.go | Adds a callback hook fired on search completion to enable deterministic test synchronization. |
| internal/prompter/huh_prompter_test.go | Adds wait-capable interaction steps and uses them to remove timing flakiness in async search tests. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
58f5399 to
5c33128
Compare
…tures Replace fixed-duration sleep with a channel-based synchronization hook so the test waits for the async search to genuinely complete before sending the next keystroke. The previous 50ms waitForOptions() was too short on slow architectures such as s390x under QEMU emulation, causing the enter key to be dropped while the field was still loading.
5c33128 to
300cae9
Compare
|
Hello @williammartin, I remember we already did similar fixes together, can you help here? |
The test was using a fixed 50ms sleep (
waitForOptions()) to wait for an async bubbletea search goroutine before sending the next keystroke. On slow architectures such as s390x under QEMU emulation, the goroutine scheduling and event loop round-trip can exceed 50ms, causing theenterkey to arrive whilem.loadingis stilltrue. In that state the field silently drops all keystrokes, the form never advances, and the 5s overall deadline fires with "form.Run() did not complete in time".The fix replaces the blind sleep with proper channel-based synchronization. An
onSearchDone func()hook is added tomultiSelectSearchField(nil in production, set only in tests) and called at the end ofapplySearchResult. A new test helperwaitForSearch(field)wires a one-shotsync.Once-guarded channel into that hook and blocks until it fires - guaranteeing the search is truly complete before the next step is sent, regardless of scheduler timing or machine speed.Error log