Repository navigation
fix(completion): exclude remote branches when total exceeds 100 - #1442
Conversation
In repos with many remote branches, tab completion becomes unusable because shells like bash/zsh prompt "do you wish to see all N possibilities?" The threshold of 100 aligns with bash's default `completion-query-items`. Users can still reach remote branches via the interactive picker (`wt switch` without args). Closes #1415 Co-Authored-By: Claude Opus 4.6 <[email protected]>
worktrunk-bot
left a comment
There was a problem hiding this comment.
Missing test coverage for the threshold logic on line 323. The codecov/patch check will likely flag this — the new condition (branches.len() > 100 && branches.iter().any(...)) isn't exercised by any existing test.
An integration test that creates 100+ remote-tracking branches and verifies they're excluded from completions would cover it. The setup is a bit heavy but mirrors the real scenario from #1415.
|
CI is red — all three platform jobs fail at the I can push a fix commit if you'd like. |
Co-Authored-By: Claude Opus 4.6 <[email protected]>
The claude-mention bot created a duplicate PR (#1442) when #1416 already addressed the same issue, and shipped code without running cargo fmt — causing a CI failure and requiring a second commit. Both gaps exist because running-in-ci (loaded by all CI workflows) had no guidance on checking for existing PRs or formatting code before committing. The triage-issue skill had these checks but running-in-ci did not. Add two subsections under "PR Creation": - "Before creating a PR" — check open PRs and fix branches first - "Before committing code changes" — run cargo fmt at minimum Co-Authored-By: Claude Opus 4.6 <[email protected]>
|
add tests to satisfy codecov hourly checked — why didn't this wait until tests had completed to finish, so it could then fix tests? diagnose |
Tests that remote-only branches are excluded from completions when total branch count exceeds 100, and included when under the threshold. Co-Authored-By: Claude Opus 4.6 <[email protected]>
|
Pushed tests for the threshold logic — two tests covering both sides of the 100-branch boundary. Diagnosis — why it didn't wait for codecov: The original session used The running-in-ci skill's CI monitoring instructions say to use |
…1443) ## Summary - Add "Before creating a PR" guidance: check for existing PRs and fix branches before creating duplicates - Add "Before committing code changes" guidance: run `cargo fmt` (minimum) or full pre-merge before committing ## Evidence In [run 22946109451](https://github.com/max-sixty/worktrunk/actions/runs/22946109451) (`claude-mention` on issue #1415), the bot: 1. **Created a duplicate PR.** PR #1416 (created 2026-03-10) already addressed the same issue — excluding remote branches from switch completions. The bot created #1442 with a different approach without checking for existing work. Both PRs are authored by `worktrunk-bot`. The session log shows the bot went directly from reading the issue to editing code — no `gh pr list` or branch check. 2. **Skipped `cargo fmt` before committing.** The bot ran `cargo check` to verify compilation but not `cargo fmt`. CI failed on the pre-commit hook's format check, requiring a second "style: rustfmt" commit and another full CI polling cycle (~11 minutes of additional `sleep 60` polls). <details><summary>Session log: tool call sequence (run 22946109451)</summary> ``` Skill: running-in-ci Bash: gh issue view 1415 ... Read: src/completion.rs Edit: src/completion.rs ← code change Grep: complete_branches ← searched for tests, found none Bash: cargo check ← compilation only, no fmt Bash: git checkout -b ... Bash: git add && git commit ← committed unformatted code Bash: git push && gh pr create ← created PR #1442 (duplicate of #1416) ... 11 CI poll cycles ... Bash: gh run view --log-failed ← discovered fmt failure Bash: cargo fmt ← fixed formatting Bash: git add && git commit ← second commit ... 11 more CI poll cycles ... ``` </details> ## Root cause The `running-in-ci` skill (loaded by all CI workflows) had no guidance on either checking for existing PRs or formatting code before committing. The `triage-issue` skill already had both — Step 3 ("Check for duplicates") and Step 6.3 (`cargo run -- hook pre-merge --yes`) — but this guidance didn't extend to the `claude-mention` workflow. ## Test plan - [ ] Verify the skill file renders correctly - [ ] Observe future `claude-mention` runs for improved behavior (check for existing PRs, run `cargo fmt`) 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: worktrunk-bot <[email protected]> Co-authored-by: Claude Opus 4.6 <[email protected]>
change our repo-specific skill to say that we want to wait for required and codecov |
The CI monitoring instructions used `--required` filtering which missed codecov/patch since it's marked non-required in GitHub. This repo treats codecov/patch as mandatory per CLAUDE.md, so the skill now explicitly checks it after required checks pass. Closes #1442 (comment) Co-Authored-By: Claude Opus 4.6 <[email protected]>
|
Done — opened #1470 to update the |
## Summary - Update the `running-in-ci` skill's CI monitoring section to also wait for `codecov/patch` after required checks pass - Previously, `--required` filtering meant codecov was invisible to the bot, so it would report "CI green" before codecov completed - This was the root cause identified in #1442 — the bot declared success without checking codecov Addresses [this comment](#1442 (comment)). ## Test plan - [ ] Verify the skill file renders correctly - [ ] Next CI run that pushes to a PR should wait for codecov before reporting completion 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: worktrunk-bot <[email protected]> Co-authored-by: Claude Opus 4.6 <[email protected]>
Return all branch candidates to the shell instead of pre-filtering by prefix. This lets fish and zsh apply their native substring/fuzzy matching — e.g. `wt switch auth<TAB>` now surfaces `feature/user-auth` in fish. The >100 remote-only branch exclusion from #1442 is preserved to avoid overwhelming shells with thousands of candidates. Closes #1468 Co-Authored-By: Claude Opus 4.6 <[email protected]>
…hing (#1471) ## Summary - Stop prefix-filtering branch candidates in `BranchCompleter::complete()` — return all surviving candidates (after the >100 remote exclusion from #1442) and let the shell apply its own matching - Enables fish substring matching (`auth<TAB>` → `feature/user-auth`) and zsh fuzzy matching for `wt switch` completions - Adds dedicated test for the substring-matching use case from #1468 Closes #1468 ## Test plan - [x] All 46 completion tests pass (including updated `test_complete_with_partial_prefix_returns_all_branches` and new `test_complete_switch_returns_candidates_for_substring_matching`) - [x] Unit tests pass - [x] Lints pass - [ ] CI green across platforms 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: worktrunk-bot <[email protected]> Co-authored-by: Claude Opus 4.6 <[email protected]>
## Summary - When tab-completing `wt switch`, exclude remote-only branches if the total branch count exceeds 100 - This prevents the "do you wish to see all N possibilities?" prompt in bash/zsh for repos with many remote branches - Threshold of 100 aligns with bash's default `completion-query-items` - Repos with ≤100 branches are unaffected — remote branches still appear in completions - Users can always reach remote branches via the interactive picker (`wt switch` without args) Closes #1415 ## Test plan - [ ] Verify compilation and existing tests pass in CI - [ ] Manual: in a repo with >100 remote branches, `wt switch <TAB>` should show only local/worktree branches - [ ] Manual: in a repo with ≤100 branches, `wt switch <TAB>` should include remote branches as before 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: worktrunk-bot <[email protected]> Co-authored-by: Claude Opus 4.6 <[email protected]>
## Summary - Update the `running-in-ci` skill's CI monitoring section to also wait for `codecov/patch` after required checks pass - Previously, `--required` filtering meant codecov was invisible to the bot, so it would report "CI green" before codecov completed - This was the root cause identified in #1442 — the bot declared success without checking codecov Addresses [this comment](#1442 (comment)). ## Test plan - [ ] Verify the skill file renders correctly - [ ] Next CI run that pushes to a PR should wait for codecov before reporting completion 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: worktrunk-bot <[email protected]> Co-authored-by: Claude Opus 4.6 <[email protected]>
…hing (#1471) ## Summary - Stop prefix-filtering branch candidates in `BranchCompleter::complete()` — return all surviving candidates (after the >100 remote exclusion from #1442) and let the shell apply its own matching - Enables fish substring matching (`auth<TAB>` → `feature/user-auth`) and zsh fuzzy matching for `wt switch` completions - Adds dedicated test for the substring-matching use case from #1468 Closes #1468 ## Test plan - [x] All 46 completion tests pass (including updated `test_complete_with_partial_prefix_returns_all_branches` and new `test_complete_switch_returns_candidates_for_substring_matching`) - [x] Unit tests pass - [x] Lints pass - [ ] CI green across platforms 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: worktrunk-bot <[email protected]> Co-authored-by: Claude Opus 4.6 <[email protected]>
Summary
wt switch, exclude remote-only branches if the total branch count exceeds 100completion-query-itemswt switchwithout args)Closes #1415
Test plan
wt switch <TAB>should show only local/worktree brancheswt switch <TAB>should include remote branches as before🤖 Generated with Claude Code