fix: sync picker hint + worktree list perf and output leak#41
Merged
fix: sync picker hint + worktree list perf and output leak#41
Conversation
`gum choose --no-limit` exits 0 with empty stdout when the user presses ENTER without first toggling items with SPACE. The single-select source picker right before it accepts ENTER on its own, so muscle memory makes this trivially easy to do — and the wizard previously returned 1 silently in the targets case and printed only a bare "No types selected." in the types case, leaving users to think the picker was broken. Both empty-selection paths now print the same SPACE/ENTER hint to stderr before returning 1. Adds two regression tests exercising the fallback path (CKIPPER_NO_GUM=1) which mirrors the gum empty-stdout branch.
Two bugs surface together in `ckipper worktree list`: 1. Slow scan. `find` recursed unbounded under $CKIPPER_WORKTREES_DIR with only `*/node_modules/*` excluded, so the heavy build/cache trees (`dist`, `.next`, `target`, `__pycache__`, etc.) were walked in full. On a 6 GB / 380k-file worktrees tree the scan took ~700 ms. Pruning the known-heavy directory names brings it to ~30 ms (≈25× faster); bounding by depth was not viable because branches contain slashes (e.g. `feature/OGD-320-…`). 2. Spurious `branch='…'` lines under each bullet. `local branch` (no `=value`) inside the per-iteration loop body behaves like `typeset -p branch` once the variable already carries a value from a prior iteration. Hoist `branch` (and the other loop locals) above the `while` and assign without `local` inside, matching the existing precedent in lib/account/sync/preview.zsh. Adds three regression tests: - pruning skips `.git` files inside node_modules / dist / __pycache__ - branches with slashes still resolve (no depth bound) - output never contains literal `branch=` lines
4 tasks
This was referenced May 5, 2026
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.
Summary
Three bugs across two commands — kept in one PR per request.
1.
ckipper account syncinteractive wizard exited silentlygum choose --no-limitexits 0 with empty stdout when ENTER is pressed without first SPACE-toggling items. The single-select source picker right before it accepts ENTER on its own, so muscle memory made this trivially easy to do — and the wizard returned 1 silently in the targets case and printed a bareNo types selected.in the types case, leaving users to think the picker was broken.Both empty-selection paths now print the same SPACE/ENTER hint to stderr before returning 1.
2.
ckipper worktree listwas slow — ≈25× fasterfindrecursed unbounded under$CKIPPER_WORKTREES_DIRwith only*/node_modules/*excluded, so heavy build/cache trees (dist,.next,target,__pycache__, etc.) were walked in full. On a 6 GB / 380k-file worktrees tree the scan took ~700 ms. Pruning the known-heavy directory names brings it to ~30 ms. Bounding by depth was not viable because branches contain slashes (e.g.feature/OGD-320-…).3.
ckipper worktree listleaked spuriousbranch='…'lineslocal branch(no=value) inside the per-iteration loop body behaves liketypeset -p branchonce the variable already carries a value from a prior iteration, leaking literal lines under each bullet. Hoisted the loop locals above thewhile, matching the existing precedent for the same hazard inlib/account/sync/preview.zsh.Test plan
bats lib/account/sync/dispatcher_test.bats— 19/19 pass (incl. 2 new regressions for the picker hint)bats lib/worktree/worktree_test.bats— 15/15 pass (incl. 3 new regressions for pruning, slash-branches, leak)make test-unit— 504/504 shell tests passmake lint-shell lint-zsh lint-fmt lint-merge-guards— all cleanckipper account syncshows hint when ENTER pressed without SPACE-selectingckipper worktree listis visibly instant and shows nobranch=lines