Skip to content

test(switch_picker): cursor-nav preview tests; remove dead row-count gate - #2769

Merged
max-sixty merged 1 commit into
mainfrom
picker-macos-flake
May 15, 2026
Merged

max-sixty merged 1 commit into
mainfrom
picker-macos-flake

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

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 four preview_panel_* tests, and left the expected_rows gate 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 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 and panic with the saw 2 diagnostic. These tests select feature by 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 entire expected_rows machinery is dead. This removes the third tuple element across all PTY-test call sites, both PTY-helper signatures, the loop bindings, visible_list_rows(), the display_ready branch, and the line-525 saw N timeout panic (the historical #2334/#2345 flake site). 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/default command) whose screen.contains("target-branch") || "Switched" || "cd " assertion passed even on a wrong selection, since target-branch is 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_* _list snapshots 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_picker tests pass, cargo fmt --check clean, cargo clippy --tests --features shell-integration-tests clean.

…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]>
@max-sixty
max-sixty merged commit 1ad14b2 into main May 15, 2026
33 checks passed
@max-sixty
max-sixty deleted the picker-macos-flake branch May 15, 2026 22:43
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.

2 participants