Repository navigation
test(switch): decline the picker approval with CR for Windows - #3230
Conversation
worktrunk-bot
left a comment
There was a problem hiding this comment.
The three red checks (test (macos), affected tests (windows, advisory), and the linux code-coverage job) all fail on the same unrelated test — test_switch_picker_alt_l_does_not_hscroll, snapshot switch_picker_alt_l_ignored_list — not on anything this PR touches. Leaving the approval in place: this is a pre-existing stale snapshot on main, not a regression from this PR.
Why it's not this PR: the linux code-coverage job fails on it too, and this PR's only code change is "n\r" plus removing a Windows-only #[cfg_attr(windows, ignore)] — both no-ops on Linux. A failure that reproduces on Linux can't be caused by a Windows-only edit.
Root cause (grounded): test_switch_picker_alt_l_does_not_hscroll's own doc comment says it snapshots "the same frame" as test_switch_picker_with_multiple_worktrees, but the two committed snapshots have diverged:
switch_picker_alt_l_ignored_list.snap (failing):
Branch Status HEAD± main↕ CI Age
> @ main ^ [TIME]
switch_picker_multiple_worktrees_list.snap (passing sibling):
Branch Status HEAD± main↕ Remote⇅ CI
> @ main ^
The column set changed (Remote⇅ added, Age/[TIME] dropped) and switch_picker_multiple_worktrees_list.snap was regenerated, but switch_picker_alt_l_ignored_list.snap was left at the old layout. It slipped onto main because every recent main ci run was cancelled by concurrency churn before the test suite completed, so nothing caught the stale snapshot.
Fix is a snapshot regen on main (cargo insta test --accept, or the pre-merge hook) — independent of this PR. Once main is green, a rebase/merge here will clear these checks. Not dismissing the approval, since this is unrelated and deterministic (a rerun fails identically).
Un-ignore test_switch_picker_pre_switch_hook_requires_approval on Windows and fix the real cause of its failure there. The test declined the approval prompt with "n\n". Once skim releases the terminal, the prompt's read_line runs in the OS line discipline (cooked mode), where Windows' console terminates a line on CR (the Enter key) and never on a bare LF — so read_line blocked until the PTY harness killed the hung process (exit 1, ~5s). This was a test input-convention bug, not a product gap: a real Windows user presses Enter (CR) and is unaffected. Send "n\r" instead: Windows reads it as Enter, and Unix's ICRNL maps it to LF. Verified on macOS (passes in ~3.5s, no hang); the Windows leg is confirmed by CI. Also document the --help snapshot regen step (test_help) in root CLAUDE.md and src/commands/CLAUDE.md. Only docs/CLAUDE.md mentioned it, so an agent editing help text per the other two would leave the rendered --help snapshots stale and fail required CI. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Two follow-ups from #3221 (running the interactive picker tests on Windows).
test_switch_picker_pre_switch_hook_requires_approvalon Windows#3221 landed this test
#[cfg_attr(windows, ignore)]with a TODO that suspected the picker's approval prompt couldn't read stdin after skim released the ConPTY. The actual cause, from the failing run's screen (prompt shown,nechoed, yet exit 1) and its timing (FAIL [ 7.963s]— the harness's 5s kill window plus setup): a hang, not an error.Once skim releases the terminal, the approval prompt's
read_lineruns in the OS line discipline (cooked mode). Windows' console line-input terminates a line on CR (the Enter key) and never on a bare LF — so the test's"n\n"leftread_lineblocked until the harness killed the hung process. Every other[y/N]read_linePTY test (approval_pty.rs,config_show'splugin_prompt_pty) is#[cfg(unix)]-gated, so this picker test was the first to drive one on Windows.This was a test input-convention bug, not a product gap — a real Windows user presses Enter (CR) and is unaffected. The fix sends
"n\r": Windows reads it as Enter, and Unix's ICRNL maps it to LF. Verified on macOS (passes in ~3.5s, no hang); the Windows leg is confirmed by this PR's CI.Doc:
--helpsnapshot regenEditing help text changes two generated artifacts — the doc mirrors (regenerated by
test_docs_are_in_sync) and the rendered--helpsnapshots (test_help). Onlydocs/CLAUDE.mddocumented the second, so an agent following rootCLAUDE.mdorsrc/commands/CLAUDE.mdwould leave the help snapshots stale and fail required CI. Added the regen step to both.