Skip to content

fix: shell precedence, missing escaping, and license badge drift#1584

Open
worktrunk-bot wants to merge 2 commits intomainfrom
nightly/clean-23181835484
Open

fix: shell precedence, missing escaping, and license badge drift#1584
worktrunk-bot wants to merge 2 commits intomainfrom
nightly/clean-23181835484

Conversation

@worktrunk-bot
Copy link
Collaborator

Summary

Three fixes found during nightly code quality survey:

  • Shell operator precedence in build_remove_command (process.rs): The || true for fsmonitor stop had incorrect precedence — it could swallow failures from the entire sleep 1 && git ... chain. Wrapped in { ...; } brace group to scope correctly.
  • Missing shell escaping in WorktreePathOccupied hint (error.rs): Branch name and path in the suggested cd ... && git switch ... command were not shell-escaped, unlike other error hints that use shell_escape::escape().
  • README license badge drift: Badge said "MIT" but Cargo.toml declares "MIT OR Apache-2.0".

Also opened issues for items that need more design consideration:

Test plan

  • Unit tests pass (test_build_remove_command, snapshot_worktree_path_occupied)
  • cargo fmt and cargo clippy pass
  • CI passes on all platforms

🤖 Generated with Claude Code

…r hint, license badge

Three fixes found during nightly code quality survey:

1. build_remove_command (process.rs): The `|| true` for fsmonitor stop had
   incorrect shell operator precedence — it could swallow failures from the
   entire left chain. Wrapped in brace group to scope correctly.

2. WorktreePathOccupied hint (error.rs): Branch name and path in the
   suggested `cd ... && git switch ...` command were not shell-escaped,
   unlike other error hints that use shell_escape::escape().

3. README license badge: Said "MIT" but Cargo.toml declares "MIT OR Apache-2.0".

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@worktrunk-bot worktrunk-bot added the nightly-cleanup Issues found by nightly code quality sweep label Mar 17, 2026
Copy link
Collaborator Author

@worktrunk-bot worktrunk-bot left a comment

Choose a reason for hiding this comment

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

Shell precedence fix and license badge are correct. One issue with the escaping fix:

format_path_for_display converts absolute paths to tilde-relative (/home/user/repo~/repo). shell_escape::escape treats ~ as unsafe (not in [A-Za-z0-9@%+=:,./-]), so ~/repo becomes '~/repo' — which prevents tilde expansion and breaks the cd command.

Fix: escape the raw path instead of path_display for the command, while keeping path_display for the descriptive text.

…hint

format_path_for_display converts absolute paths to tilde-relative form
(~/repo), but shell_escape quotes the ~ character, breaking tilde
expansion in the suggested cd command. Use the raw path instead.

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

nightly-cleanup Issues found by nightly code quality sweep

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant