Skip to content

fix(shell): avoid full mise hook on server zsh - #571

Open
shunk031 wants to merge 3 commits into
mainfrom
fix/server-zsh-mise-shims
Open

fix(shell): avoid full mise hook on server zsh#571
shunk031 wants to merge 3 commits into
mainfrom
fix/server-zsh-mise-shims

Conversation

@shunk031

@shunk031 shunk031 commented Jul 31, 2026

Copy link
Copy Markdown
Owner

Why

Server-side Zsh startup paid the full mise activate zsh hook cost even though server startup only needs the standalone mise binary and shims. Measurements showed _mise_hook / mise hook-env -s zsh cost about 40-50 ms, while the server prompt setup should remain unchanged.

What Changed

  • Move full eval "$(~/.local/bin/mise activate zsh)" from the common Sheldon config to the client-only Sheldon config.
  • Add a Zsh startup helper that exposes mise and shims via mise activate zsh --shims without registering _mise_hook, precmd, or chpwd hooks.
  • Source the Zsh helper from the server Sheldon config before Starship, keeping Starship unchanged.
  • Replace the static .zprofile source with a template that uses shims-only startup on servers and full mise activation elsewhere.
  • Extend install tests to cover the Zsh helper, Sheldon client/server split, and .zprofile template behavior.
  • Isolate Zsh startup tests from bashcov tracing variables so CI output checks remain deterministic.

Validation

Inspect the diff for whitespace errors.

git diff --check

Parse the Zsh mise helper.

zsh -n home/dot_config/exact_shell/mise.zsh

Render the server .zprofile template and parse it as Zsh.

chezmoi execute-template --override-data '{"system":"server"}' < home/dot_zprofile.tmpl | zsh -n

Render the client .zprofile template and parse it as Zsh.

chezmoi execute-template --override-data '{"system":"client"}' < home/dot_zprofile.tmpl | zsh -n

Parse the mise install shell sources.

bash -n install/common/mise.sh home/dot_config/exact_shell/mise.bash

Run ShellCheck for the mise install shell sources.

mise exec -- shellcheck install/common/mise.sh home/dot_config/exact_shell/mise.bash

A temp-HOME Zsh smoke test confirmed fake mise and a shimmed chezmoi are found, and _mise_hook is absent from functions, precmd_functions, and chpwd_functions.

Local bats tests were not run per repository policy; GitHub Actions should validate them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant