feat(config): Add a ceiling to how mise searchs for config & tasks#6041
Merged
feat(config): Add a ceiling to how mise searchs for config & tasks#6041
Conversation
… support Update function `all_dirs` that returns a list of directories starting from a given path and traversing upward through all ancestors until either: 1. A ceiling directory is reached (if specified in the ceiling_dirs HashSet) 2. The root directory is reached This allows for controlled directory traversal with configurable boundaries, which is useful for operations that need to search upward in the file system but should stop at certain points. The function includes comprehensive test coverage for various scenarios including: - No ceiling directories - Single ceiling directory - Multiple ceiling directories - Ceiling at the start directory - Relative path handling
… mise search for config and task files MISE_CEILING_PATHS is interpreted as a HashSet and passed to file::all_dirs Added e2e test for config files
Use std::env::split_paths to split MISE_CEILING_PATHS to get required behaviour on Windows. Update documentation for `MISE_CEILING_PATHS` to explain this.
Contributor
Author
|
Finally got to the e2e-win tests - ready for review |
Owner
|
bugbot run |
Owner
|
Bugbot run |
Owner
|
nice work! |
jdx
pushed a commit
that referenced
this pull request
Oct 10, 2025
### 📦 Registry - add lazyssh by @TyceHerrman in [#6610](#6610) ### 🚀 Features - **(config)** Add a ceiling to how mise searchs for config & tasks by @richardthe3rd in [#6041](#6041) ### 🐛 Bug Fixes - **(task)** use config_root instead of project_root for task base path by @risu729 in [#6609](#6609) - **(task)** resolve project tasks in run blocks using TaskLoadContext by @jdx in [#6614](#6614) - **(task)** dont truncate task message when CI is set by @roele in [#6620](#6620) - **(ui)** prevent OSC 9;4 progress sequences from being written to non-terminals by @jdx in [#6615](#6615) ### Chore - remove cosign/slsa-verifier from mise.toml by @jdx in [#6616](#6616) ### New Contributors - @richardthe3rd made their first contribution in [#6041](#6041)
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.
Problem: mise recurses upwards from cwd looking for and loading config and tasks files. When mise accesses a directory that is slow to load it has a noticable impact on performance of mise activate In my work environment this is due to use of autofs/automount on /home - meaning when I use mise under /home/username there is a slowdown as mise looks for config file such as /home/.mise.toml
Solution: Implement something similar to git's GIT_CEILING_DIRECTORIES, a list of directories at which mise will stop recursing up.
Users control this by setting
MISE_CEILING_PATHSenvironment variable. In my case, I'd set this to include /home, meaning /home/username is the last directory searched.This can be a set to a list of directories which are separated by the platform's conventions for PATH meaning
:for Linux/macS and;for Windows. But basically I'm usingstd::env::split_paths, so that's the definition.All the interesting work here seem to be in
src/config/mod.rs, there are three places that callfile::all_dirs()to get the list of ancestor folders of cwdload_config_pathsload_local_tasksconfig_file_from_dirUpdated the signature of all_dirs to
all_dirs<P: AsRef<Path>>(start_dir: P, ceiling_dirs: &HashSet<PathBuf>) -> Result<Vec<PathBuf>>start_dirhelps with testability (unit tests added)ancestors()Provided a wrapper
all_dirsinsrc/config/mod.rsthat passes in the current dir, and the value ofMISE_CEILING_PATHSas aHashSetAdded e2e tests to check that search for config files and file tasks both stop at the ceiling.
Added (brief) documentation to
configuration.mde2e-wintest, good catch differences any assumptions about file systems and the behaviour ofsplit_path--
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY.
Note
Adds
MISE_CEILING_PATHSto stop ancestor traversal for configs/tasks, refactors directory walking, and updates docs with comprehensive e2e/unit tests.MISE_CEILING_PATHS(parsed viasplit_paths) to cap directory ascent when locating configs and tasks (src/env.rs).file::all_dirs()with a new wrapper that respectsMISE_CEILING_PATHSinsrc/config/mod.rs(config_file_from_dir,load_config_paths,load_local_tasks_with_context).file::all_dirstoall_dirs(start_dir, &HashSet<PathBuf>)that halts at ceiling paths; add debug/trace logging and unit tests (src/file.rs).MISE_CEILING_PATHSand update the resolution process to note stopping at ceiling paths (docs/configuration.md).e2e/...) and Windows (e2e-win/...) covering single/multiple/non-existent ceilings.Written by Cursor Bugbot for commit e536882. This will update automatically on new commits. Configure here.