Skip to content

test(switch): decline the picker approval with CR for Windows - #3230

Merged
max-sixty merged 1 commit into
mainfrom
skim-windows
Jun 25, 2026
Merged

max-sixty merged 1 commit into
mainfrom
skim-windows

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

Two follow-ups from #3221 (running the interactive picker tests on Windows).

test_switch_picker_pre_switch_hook_requires_approval on 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, n echoed, 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_line runs 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" left read_line blocked until the harness killed the hung process. Every other [y/N] read_line PTY test (approval_pty.rs, config_show's plugin_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: --help snapshot regen

Editing help text changes two generated artifacts — the doc mirrors (regenerated by test_docs_are_in_sync) and the rendered --help snapshots (test_help). Only docs/CLAUDE.md documented the second, so an agent following root CLAUDE.md or src/commands/CLAUDE.md would leave the help snapshots stale and fail required CI. Added the regen step to both.

This was written by Claude Code on behalf of max

@worktrunk-bot worktrunk-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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]>
@max-sixty
max-sixty merged commit d8fe755 into main Jun 25, 2026
34 checks passed
@max-sixty
max-sixty deleted the skim-windows branch June 25, 2026 06:22
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