Repository navigation
feat(zsh): 10x faster startup, fzf bindings, non-interactive PATH, startup budget - #47
Merged
Merged
Conversation
…artup budget - compinit from a cached dump (-C) under XDG_CACHE_HOME, full rebuild when >24h old; was a full audit + dump rewrite (~300ms) every start - zinit turbo for autosuggestions + syntax-highlighting; highlighting now loads LAST (the old template loaded it first); zsh-completions is fpath-only (blockf) - fzf key bindings wired: fzf --zsh (>=0.48) or the same install's scripts; skipped under zsh -i -c (no ZLE; fzf's option restore errors there) - ~/.zshenv managed PATH block so non-interactive zsh (ssh host cmd, agent shells) sees ~/.local/bin; new upsert_managed_block helper (in-place, idempotent) - history 100k + EXTENDED_HISTORY + HIST_EXPIRE_DUPS_FIRST; drop setopt CORRECT - verify.sh reports median interactive startup; fails only if modules.zsh.startup_budget_ms is set Measured on Ubuntu 22.04: ~700ms -> ~70ms warm. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01S29GMkRB43pGsAUBUXwLdT
…an interactive start The rc's last statement ([[ -f ~/.zshrc.local ]] && source) left $?=1 when the file is absent, so every zsh -i -c caller inherited a failure. Integration test now asserts empty stderr + rc 0 for zsh -i, and the cached completion dump location. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01S29GMkRB43pGsAUBUXwLdT
…dation - upsert_managed_block: refuse (rc 1, file untouched) on unpaired markers instead of deleting user lines after an unterminated begin; collapse duplicate blocks to one and settle; match markers ignoring CR so a CRLF file isn't given a second block - touch the completion dump after the daily full compinit: compinit only rewrites it when the completion set changed, so once 24h old every shell stayed on the slow path - verify: time 'zsh -i </dev/null' (includes setup that -c skips); warn on and ignore a non-numeric startup_budget_ms instead of silently passing - fzf bindings also require a terminal on stdin (no zle errors for 'cmd | zsh -i') Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01S29GMkRB43pGsAUBUXwLdT
4 of 5 tasks
…y, skip global compinit - only refresh the compinit dump mtime after a successful, non-empty dump, and treat an empty dump as missing: an aborted compinit (insecure dirs, prompt declined/EOF) plus the unconditional touch left an empty dump that -C trusted for 24h (no completions) - startup budget is a WARNING: the runner runs verify.sh to decide skips, and a failure there reinstalls the module on every run; timing is 3 runs, reported before the summary - ~/.zshenv sets skip_global_compinit=1 so Debian/Ubuntu /etc/zsh/zshrc no longer runs a full compinit (and writes ~/.zcompdump) on every start - macOS: mirror the PATH block into ~/.zprofile (path_helper reorders login-shell PATH) - drop HIST_EXPIRE_DUPS_FIRST (no effect with HIST_IGNORE_ALL_DUPS and HISTSIZE=SAVEHIST) - integration: idempotency asserted after a FORCED zsh re-run; skip_global_compinit and no ~/.zcompdump asserted Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01S29GMkRB43pGsAUBUXwLdT
Shells run before the managed .zshenv block existed can leave a ~/.zcompdump; remove it, start a fresh interactive shell, then assert the distro global compinit didn't recreate it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01S29GMkRB43pGsAUBUXwLdT
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
zsh correctness and speed for the zinit setup. No new tools. With no content overlay, behaviour is the same apart from speed and the fixes below.
compinit+compdumpat about 300 ms, because the dump was audited and rewritten on every start.compinitnow uses a cached dump (-C) under$XDG_CACHE_HOME/zsh/zcompdump-$ZSH_VERSION, fully rebuilt when older than 24 h.blockf, so it only extendsfpath.fzfmodule installs with--no-update-rc, so nothing sourced them before.fzf --zshon fzf 0.48 and later. Older builds fall back to scripts from the same install as the binary, because mixing versions breaks the widgets.zsh -i -c, where there is no line editor and fzf's option restore printscan't change option: zle.~/.zshenvmanaged PATH block, so non-interactive zsh (ssh host cmd,zsh -c, agent tool shells) also sees~/.local/bin. It uses a newupsert_managed_blockhelper: marker-delimited, replaced in place, never duplicated, user lines untouched.EXTENDED_HISTORY,HIST_EXPIRE_DUPS_FIRST.setopt CORRECTremoved.verify.shreports the median interactive startup time. It fails only whenmodules.zsh.startup_budget_msis set.zsh -i -c exitreturned 1 when~/.zshrc.localwas absent, because the rc file ended with a false[[ ]] &&.Part of the estate's shell/toolchain track (private ADRs 0042/0043). Phase 2, an opt-in
misemodule, follows in a separate PR and builds onupsert_managed_block.Test plan
make test-integration-ubuntu: 51 passed, 0 failed. New assertions cover the.zshenvblock present and not duplicated,~/.local/binfirst in non-interactive zsh,zsh -iwith empty stderr and rc 0, and the cached dump location.zsh -n.^R/^T/Alt-Cbound to fzf widgets with fzf 0.70verify.shbudget: unset reports 58 ms; 150 passes; 10 fails with rc 1.shellcheckclean on the touched scripts.🤖 Generated with Claude Code
https://claude.ai/code/session_01S29GMkRB43pGsAUBUXwLdT
Review round 2 (adversarial, 2026-09-26): all addressed
/etc/zsh/zshrc).~/.zshenvnow setsskip_global_compinit=1.zsh -lcPATH order. The PATH block is mirrored into~/.zprofile.~/.zcompdumpassertion is self-contained;HIST_EXPIRE_DUPS_FIRSTwas dropped (it did nothing here).Integration: 54 passed, 0 failed.
hal canary (pre-merge pin, the engine at
feat/mise-modulehead, which contains this PR)bf9f604)bf163d5)zsh -i </dev/null)^Rzsh -c 'node; pi'~/.local/binfirst)~/.zcompdumpin HOME