fix(zsh): isolate generated completion options#686
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Central YAML (base), Organization UI (inherited) Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (4)
📒 Files selected for processing (3)
📝 WalkthroughWalkthrough
ChangesZsh emulate -L fix and regression test
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Greptile SummaryThis PR fixes a bug where user shell options (e.g.
Confidence Score: 5/5Safe to merge — the change is a one-liner in two well-isolated spots, all snapshots and the checked-in asset are updated, and a targeted regression test guards the exact failure mode. The fix is minimal and well-understood: No files require special attention. Important Files Changed
Reviews (1): Last reviewed commit: "fix(zsh): isolate generated completion o..." | Re-trigger Greptile |
Summary
emulate -L zshto generated zsh completion functions_usagecompletion assetKSH_ARRAYSleaking into generated completionsRoot Cause
Generated zsh completions parse
complete-word --shell zshrows into arrays and index those arrays using normal zsh one-based semantics. If a user's shell has options such asKSH_ARRAYSenabled, those semantics can leak into the completion function and shift or empty the parsed insert values, causing tab-delimited completion rows to be inserted incorrectly.Validation
cargo build --allcargo test -p usage-lib complete::zsh --all-featurescargo test -p usage-cli test_zsh_completion_ignores_ksh_arrays_option --all-featuresmise run render:usage-cli-completions(includescargo clippy --all --all-features --fix --allow-dirty --allow-staged -- -D warnings,cargo fmt --all, andprettier -w .)This PR was generated by an AI coding assistant.
Note
Low Risk
Localized change to generated zsh shell scripts and test/snapshot updates; no runtime CLI or auth/data paths affected.
Overview
Generated zsh completion scripts now start each completion function with
emulate -L zshso user shell options (notablyKSH_ARRAYS) do not change how tab-splitcomplete-wordrows are indexed intoparts[1..3]and passed tocompadd.The generator in
lib/src/complete/zsh.rsapplies this to per-binary_{bin}handlers and the shebang_usage_default_completeinit path; snapshots,cli/assets/completions/_usage, and a new integration test assert completions still work whenKSH_ARRAYSis enabled.Reviewed by Cursor Bugbot for commit fba8bf3. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by CodeRabbit
Bug Fixes
Tests