Repository navigation
perf(activate): skip redundant initial bash prompt hook - #11131
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 (2)
📒 Files selected for processing (3)
📝 WalkthroughWalkthroughBash activation now skips redundant ChangesBash prompt flow
Estimated code review effort: 2 (Simple) | ~10 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
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 eliminates a redundant
Confidence Score: 5/5Safe to merge — the change touches only the Bash activation/deactivation scripts and a focused e2e test, with no modifications to core Rust code or cross-shell behavior. The one-shot skip flag is introduced, consumed, and cleaned up symmetrically across all code paths: normal first-prompt skip, chpwd-before-first-prompt, deactivation, and re-activation. Exit-status preservation is maintained in every branch of _mise_hook_prompt_command. The e2e test exercises both the skip path and the subsequent normal-run path. No files require special attention; the e2e test leaves a bash-hook-ran sentinel file in $PWD that is never explicitly removed, but this is inconsequential in isolated test environments. Important Files Changed
Reviews (1): Last reviewed commit: "perf(activate): skip redundant initial b..." | Re-trigger Greptile |
Hyperfine Performance
|
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2026.7.7 x -- echo |
21.7 ± 1.3 | 18.9 | 27.6 | 1.00 |
mise x -- echo |
22.9 ± 2.4 | 18.2 | 31.7 | 1.05 ± 0.12 |
mise env
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2026.7.7 env |
23.3 ± 1.3 | 20.3 | 29.8 | 1.00 |
mise env |
24.0 ± 1.7 | 19.5 | 32.1 | 1.03 ± 0.09 |
mise hook-env
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2026.7.7 hook-env |
25.2 ± 1.9 | 21.2 | 32.0 | 1.20 ± 0.12 |
mise hook-env |
21.0 ± 1.5 | 17.5 | 26.8 | 1.00 |
✅ Performance improvement for hook-env is 20% |
mise ls
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2026.7.7 ls |
17.9 ± 1.0 | 15.9 | 25.4 | 1.10 ± 0.09 |
mise ls |
16.3 ± 1.0 | 14.6 | 23.9 | 1.00 |
xtasks/test/perf
| Command | mise-2026.7.7 | mise | Variance |
|---|---|---|---|
| install (cached) | 165ms | 170ms | -2% |
| ls (cached) | 65ms | 61ms | +6% |
| bin-paths (cached) | 67ms | 65ms | +3% |
| task-ls (cached) | 131ms | 133ms | -1% |
Summary
PROMPT_COMMANDhook after activation already refreshed the environmentWhy
mise activate bashperforms an immediatehook-env, then the first prompt invokeshook-envagain. With an unchanged session, that second invocation exits early but still pays process and runtime startup costs.In an isolated empty configuration using the debug build, a paired benchmark through the first Bash prompt improved from 36.91 ms to 29.30 ms on average across 30 runs, saving 7.60 ms. Absolute debug timings are machine-specific; the comparison isolates the redundant prompt dispatch.
Validation
cargo test shell::bash::testsmise run test:e2e env/test_bash_first_prompt_after_activate env/test_bash_consecutive_prompt_runs cli/test_bash_duplicate_trust_warningmise run lint-fixmise run lintNote
Low Risk
Localized bash shell-hook timing change with explicit chpwd interaction and e2e coverage; no auth or data-path changes.
Overview
Bash activation now sets a one-shot
__MISE_BASH_SKIP_FIRST_PROMPTafter the initial_mise_hook/hook-env, so the firstPROMPT_COMMANDdoes not invokehook-envagain. The flag is cleared on that skip (or when a chpwd hook already refreshed the env via__MISE_BASH_CHPWD_RAN), and deactivation unsets the variable.The e2e script
test_bash_first_prompt_after_activateis updated to assert the first prompt skipshook-envand the second runs it; Bash activate/deactivate snapshots match the new shell snippets.Reviewed by Cursor Bugbot for commit 1100efb. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by CodeRabbit