Skip to content

test(switch): fix post-starts typo so --no-hooks is actually verified - #2664

Merged
max-sixty merged 1 commit into
mainfrom
fix/issue-2663-post-start-typo
May 10, 2026
Merged

max-sixty merged 1 commit into
mainfrom
fix/issue-2663-post-start-typo

Conversation

@worktrunk-bot

Copy link
Copy Markdown
Collaborator

Problem

The two --no-hooks skip-post-start tests in tests/integration_tests/switch.rs were writing project config with post-starts = [...] (plural, array form). The valid key in [hooks] is post-start (singular, string-or-table), so serde silently ignored the field. The post-start hook was never registered, the snapshot showed no hook output regardless of --no-hooks, and the tests passed even when --no-hooks did nothing.

This was caught by the nightly drift sweep (item 4).

Solution

  • Rename post-starts = [...] → post-start = "..." in both tests.
  • Point both hooks at echo 'marker' > marker.txt and assert that marker.txt does not exist in the freshly-created worktree after wt switch ... --no-hooks. Sleep 500ms first per tests/CLAUDE.md "Testing absence" so a regression that incorrectly spawns the background hook has time to land the marker.

Testing

  • cargo test --test integration test_switch_no_config_commands → all 4 tests pass.
  • Verified the marker assertion is meaningful: temporarily removing --no-hooks from the args makes the snapshot diverge (Cannot prompt for approval in non-interactive environment — the hook is now detected). Restoring --no-hooks brings the test back to green.

Closes part of #2663 — automated triage. Items 1 (stale edit cli.rs banner), 2 (... vs --- in eval --dry-run example), and 3 (codename_index 32-bit truncation comment) from the issue are independent and left for separate PRs.

The two `--no-hooks` skip-post-start tests were writing project config
with `post-starts = [...]` (plural, array). The valid key is `post-start`
(singular, string-or-table), so deserialization silently ignored the
field. The post-start hook was never registered, the snapshot showed no
hook output regardless of `--no-hooks`, and the tests passed even when
`--no-hooks` did nothing.

Fix the key, point both hooks at a marker-file command, and assert the
marker does not exist after `wt switch --no-hooks`. Verified the
assertion is meaningful: removing `--no-hooks` causes the hook to be
detected (the snapshot diff shows `Cannot prompt for approval`), which
proves the corrected key wires the hook through.

Closes #2663 (item 4)

Co-Authored-By: Claude <[email protected]>
@worktrunk-bot worktrunk-bot added the automated-fix Automated CI fix label May 10, 2026
@max-sixty
max-sixty enabled auto-merge (squash) May 10, 2026 07:56
@max-sixty
max-sixty merged commit 2950358 into main May 10, 2026
31 of 39 checks passed
@max-sixty
max-sixty deleted the fix/issue-2663-post-start-typo branch May 10, 2026 07:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automated-fix Automated CI fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants