Release 0.6.2 — completion fixes + test coverage#31
Merged
Conversation
Two issues reported on bash 3.2 macOS: 1. ANSI suffix in completions, e.g. "x/dotfile/diff^[[0m" Root cause: __xsh_help (xsh.sh:705) unconditionally piped through awk that wraps every line in \033[1m...\033[0m, regardless of whether stdout is a TTY. Pipe consumers — like the completer's awk $2 — got garbage. Fix: gate the formatter on [ -t 1 ]; pass through cat otherwise. This is the standard Unix-tools convention (don't emit escapes to non-TTY). Tested: piped output is clean, terminal output still bolded. 2. ~500ms delay on every TAB press Root cause: completer ran 'xsh list "*"' on every TAB, walking every loaded library directory. Fix: cache the LPUE list in a shell-global var (_XSH_COMPLETE_LPUE_CACHE), populated lazily on first need. Helper is called directly (not via $(...)) so the assignment lands in the caller's shell rather than a lost subshell. Empirical: cold 581ms → warm 1ms (500x). Cache survives until manual unset; documented refresh after xsh load/unload/update is: unset _XSH_COMPLETE_LPUE_CACHE The defensive ANSI-strip sed in the completer is kept even though it's a no-op once the xsh.sh fix lands, so the completer stays correct during mixed-version installs / upgrades. Behavior change (very low impact): tooling that grepped ANSI bold sequences from piped 'xsh help' output now sees plain text. The old behavior was a misfeature. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add error/guard-branch tests to spec/xsh_func_spec.sh: null-argument paths, git-clone/git-force-update option and failure handling, lib-manager and lib-get-cfg-property errors, __xsh_help_self cache rebuild, scripts-type util import/exec/unimport, the init runtime decorator, load cleanup-on-link-failure, and environment guards. Library line coverage rises from ~76% to ~90%. Scope kcov --include-path to xsh.sh in .shellspec. install.sh and boot run as child bash processes that kcov's bash tracer cannot instrument, so they always reported 0% despite spec/install_spec.sh exercising them end-to-end; counting them understated real coverage. They remain integration-tested, not line-counted. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #31 +/- ##
===========================================
+ Coverage 63.29% 89.78% +26.49%
===========================================
Files 3 1 -2
Lines 790 666 -124
===========================================
+ Hits 500 598 +98
+ Misses 290 68 -222 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Patch release. Ships three commits off develop:
265774d) — gatexsh help's ANSI formatter on[ -t 1 ](no more^[[0min piped / tab-completion output), and cache the completer's LPUE list (cold ~581 ms → warm ~1 ms).fa86229) — ~30 new error/guard-branch tests; library line coverage ~76% → ~90%. Coverage scoped toxsh.sh(install.sh/boot run as child processes kcov can't trace).32c4429).Full notes: the
[0.6.2]section of CHANGELOG.md. Pushing tag0.6.2after merge triggers the GitHub release.