Repository navigation
test(switch_picker): cursor-nav preview tests; remove dead row-count gate - #2769
Merged
Merged
Conversation
…dead row-count gate
The four `preview_panel_*` tests typed a filter query ("feature") to
narrow the picker to one row, then gated on `expected_rows: Some(1)`.
skim's matcher runs on a separate thread; under heavy parallel macOS
load its row redraw can lag the keystroke-driven prompt past the 30s
gate timeout, panicking with the `saw 2` diagnostic (#2334/#2729/#2767).
Select `feature` by Down-arrow navigation instead. The matcher only
runs on query changes, so cursor navigation never invokes it — the
selection is deterministic regardless of load. The `_list` snapshots
now show both worktrees with the cursor on `feature` (regenerated,
deterministic: empty prompt, redacted hash, no paths/timestamps).
With no remaining `Some(n)` call site, the entire `expected_rows`
machinery is dead: removed the third tuple element across all PTY-test
call sites, both helper signatures, the loop bindings,
`visible_list_rows()`, the `display_ready` branch, and the line-525
`saw N` timeout panic. `wait_for_stable_with_content` now gates only
on content + stability.
Also deletes `test_switch_picker_switch_to_existing_worktree` — a
strict subset of `test_switch_picker_emits_cd_directive_by_default`
(identical setup/inputs) whose `screen.contains("target-branch")`
assertion passed even on a wrong selection (the branch is in the
picker list). The cd-directive test verifies the real outcome.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
worktrunk-bot
approved these changes
May 15, 2026
This was referenced May 15, 2026
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.
Follow-up to #2767, which fixed the observed macOS picker flake on the target-selection tests by gating on preview-pane text instead of
expected_rows: Some(1). That left the same matcher-lag root cause live in the fourpreview_panel_*tests, and left theexpected_rowsgate machinery in place even though it had no remaining users.The
preview_panel_*tests typed"feature"to filter the picker to one row, then gated onexpected_rows: Some(1). skim's matcher runs on a separate thread; under heavy parallel macOS load its row redraw can lag the keystroke-driven prompt past the 30s gate timeout and panic with thesaw 2diagnostic. These tests selectfeatureby Down-arrow navigation instead — the matcher only runs on query changes, so cursor navigation never invokes it and the selection is deterministic regardless of load. The flake is structurally impossible here now, not papered over with a longer timeout.With no remaining
Some(n)call site, the entireexpected_rowsmachinery is dead. This removes the third tuple element across all PTY-test call sites, both PTY-helper signatures, the loop bindings,visible_list_rows(), thedisplay_readybranch, and the line-525saw Ntimeout panic (the historical #2334/#2345 flake site).wait_for_stable_with_contentnow gates only on content + stability.Also deletes
test_switch_picker_switch_to_existing_worktree: a strict subset oftest_switch_picker_emits_cd_directive_by_default(identical setup/inputs/default command) whosescreen.contains("target-branch") || "Switched" || "cd "assertion passed even on a wrong selection, sincetarget-branchis in the picker list itself. The cd-directive test already verifies the real switch outcome via the directive file.Reviewer note: the four
preview_panel_*_listsnapshots now show two rows (@ main+ cursor on+ feature) instead of one filtered row. That is the intended, deterministic consequence of dropping the filter query, not a regression — the tests assert preview-panel content; the list panel is incidental scaffolding.Net diff is a reduction (−173/+65 in the test file). Verified: all 18
switch_pickertests pass,cargo fmt --checkclean,cargo clippy --tests --features shell-integration-testsclean.