Repository navigation
test(switch): fix post-starts typo so --no-hooks is actually verified - #2664
Merged
Merged
Conversation
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]>
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.
Problem
The two
--no-hooksskip-post-start tests intests/integration_tests/switch.rswere writing project config withpost-starts = [...](plural, array form). The valid key in[hooks]ispost-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-hooksdid nothing.This was caught by the nightly drift sweep (item 4).
Solution
post-starts = [...]→post-start = "..."in both tests.echo 'marker' > marker.txtand assert thatmarker.txtdoes not exist in the freshly-created worktree afterwt switch ... --no-hooks. Sleep 500ms first pertests/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.--no-hooksfrom the args makes the snapshot diverge (Cannot prompt for approval in non-interactive environment— the hook is now detected). Restoring--no-hooksbrings the test back to green.Closes part of #2663 — automated triage. Items 1 (stale
edit cli.rsbanner), 2 (...vs---ineval --dry-runexample), and 3 (codename_index32-bit truncation comment) from the issue are independent and left for separate PRs.