fix(self-update): add missing functions to self_update stub#6502
Conversation
Add `upgrade_instructions_text()` and `append_self_update_instructions()` to the self_update stub module to fix compilation errors when building without the self_update feature. This fixes the MacPorts build which uses: `cargo install mise --no-default-features --features native-tls,vfox/vendored-lua` Fixes compilation errors in: - src/cli/doctor/mod.rs:192 - src/cli/version.rs:129 - src/config/mod.rs:489 - src/config/mod.rs:498 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
Pull Request Overview
Fixes compilation errors when building mise without the self_update feature by adding missing function stubs. This ensures MacPorts and other builds that exclude self-update functionality can compile successfully.
- Add
upgrade_instructions_text()stub function that returnsNone - Add
append_self_update_instructions()stub function that returns the input message unchanged
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Update the stub to properly read upgrade instructions from TOML file even when self_update feature is disabled. This ensures package managers like MacPorts can still provide custom upgrade instructions to users. Changes: - Moved InstructionsToml struct and read_instructions_file() to stub - Implemented full logic for upgrade_instructions_text() - Updated append_self_update_instructions() to append instructions 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
| } | ||
| } | ||
| None | ||
| } |
There was a problem hiding this comment.
Bug: Stub Function Performs Unnecessary I/O Operations
The upgrade_instructions_text() function in the self_update_stub module reads and parses a TOML file. As a stub for a disabled feature, it's expected to be a no-op and return None directly. This current behavior introduces unnecessary file I/O and TOML parsing dependencies, potentially leading to runtime errors when the self_update feature is not enabled.
Hyperfine Performance
|
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2025.9.25 x -- echo |
19.4 ± 0.2 | 19.0 | 21.8 | 1.11 ± 0.02 |
mise x -- echo |
17.5 ± 0.3 | 17.1 | 19.1 | 1.00 |
✅ Performance improvement for x -- echo is 11% |
mise env
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2025.9.25 env |
18.9 ± 0.3 | 18.4 | 21.4 | 1.11 ± 0.03 |
mise env |
17.1 ± 0.4 | 16.5 | 21.1 | 1.00 |
✅ Performance improvement for env is 11% |
mise hook-env
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2025.9.25 hook-env |
18.5 ± 0.2 | 18.1 | 19.4 | 1.11 ± 0.03 |
mise hook-env |
16.7 ± 0.4 | 16.2 | 21.1 | 1.00 |
✅ Performance improvement for hook-env is 11% |
mise ls
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2025.9.25 ls |
16.6 ± 0.2 | 16.1 | 17.6 | 1.13 ± 0.04 |
mise ls |
14.7 ± 0.5 | 14.1 | 21.1 | 1.00 |
✅ Performance improvement for ls is 13% |
xtasks/test/perf
| Command | mise-2025.9.25 | mise | Variance |
|---|---|---|---|
| install (cached) | 166ms | ✅ 102ms | +62% |
| ls (cached) | 64ms | 63ms | +1% |
| bin-paths (cached) | 70ms | 69ms | +1% |
| task-ls (cached) | 463ms | 474ms | -2% |
✅ Performance improvement: install cached is 62%
### 📦 Registry - add code by @TyceHerrman in [#6492](#6492) ### 🚀 Features - change idiomatic_version_file to default disabled by @jdx in [#6501](#6501) ### 🐛 Bug Fixes - **(self-update)** add missing functions to self_update stub by @jdx in [#6502](#6502) - **(set)** allow --prompt flag to work with `mise set` by @jdx in [#6485](#6485) ### 📚 Documentation - **(hooks)** clarify pre/post-install hooks description. by @minusfive in [#6497](#6497) - remove link to issue by @jdx in [e13d980](e13d980) ### 🧪 Testing - **(e2e)** remove deprecated MISE_LEGACY_VERSION_FILE assertions by @jdx in [#6505](#6505) ### New Contributors - @minusfive made their first contribution in [#6497](#6497) <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Bumps project to v2025.10.0, updates changelog, packaging/docs, and completion spec filenames. > > - **Release/Versioning**: > - Bump version to `2025.10.0` in `Cargo.toml`, `Cargo.lock`, `default.nix`, `packaging/rpm/mise.spec`. > - **Documentation**: > - Update `README.md` quickstart version output. > - Add `2025.10.0` entry to `CHANGELOG.md` with registry, features, fixes, docs, tests, and contributors. > - **Shell Completions**: > - Update cached spec filenames to `usage__usage_spec_mise_2025_10_0.spec` in `completions/_mise`, `completions/mise.bash`, `completions/mise.fish`.} > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 28930cf. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> Co-authored-by: mise-en-dev <release@mise.jdx.dev>
Summary
upgrade_instructions_text()andappend_self_update_instructions()to the self_update stub moduleself_updatefeatureProblem
MacPorts builds mise with:
This fails with compilation errors because the stub file
src/cli/self_update_stub.rswas missing functions that are called from other parts of the codebase:src/cli/doctor/mod.rs:192src/cli/version.rs:129src/config/mod.rs:489src/config/mod.rs:498Solution
Added the missing functions to the stub implementation:
upgrade_instructions_text()- returnsNone(no upgrade instructions)append_self_update_instructions()- returns the message unchanged (no-op)Test plan
cargo check --no-default-features --features native-tls,vfox/vendored-lua🤖 Generated with Claude Code
Note
Adds
upgrade_instructions_textandappend_self_update_instructionsto the self-update stub, including TOML-based instruction parsing fromenv::MISE_SELF_UPDATE_INSTRUCTIONS.src/cli/self_update_stub.rs:upgrade_instructions_text()to read upgrade instructions fromenv::MISE_SELF_UPDATE_INSTRUCTIONS(TOML parsed viaread_instructions_file).InstructionsTomlandread_instructions_file()to parsemessageor first command from the TOML.append_self_update_instructions(message)to append retrieved instructions to a message.SelfUpdate::is_available()returningfalse.Written by Cursor Bugbot for commit 47b687f. This will update automatically on new commits. Configure here.