Skip to content

feat(config): Add a ceiling to how mise searchs for config & tasks#6041

Merged
jdx merged 17 commits intojdx:mainfrom
richardthe3rd:ceiling
Oct 8, 2025
Merged

feat(config): Add a ceiling to how mise searchs for config & tasks#6041
jdx merged 17 commits intojdx:mainfrom
richardthe3rd:ceiling

Conversation

@richardthe3rd
Copy link
Copy Markdown
Contributor

@richardthe3rd richardthe3rd commented Aug 15, 2025

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_PATHS environment 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 using std::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 call file::all_dirs() to get the list of ancestor folders of cwd

  • load_config_paths
  • load_local_tasks
  • config_file_from_dir

Updated the signature of all_dirs to all_dirs<P: AsRef<Path>>(start_dir: P, ceiling_dirs: &HashSet<PathBuf>) -> Result<Vec<PathBuf>>

  • Passing in start_dir helps with testability (unit tests added)
  • The second argument is the set of "ceiling" directories that are used to stop the iteration
  • Also rewrote to use ancestors()

Provided a wrapper all_dirs in src/config/mod.rs that passes in the current dir, and the value of MISE_CEILING_PATHS as a HashSet

Added e2e tests to check that search for config files and file tasks both stop at the ceiling.

Added (brief) documentation to configuration.md

  • Add a e2e-win test, good catch differences any assumptions about file systems and the behaviour of split_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_PATHS to stop ancestor traversal for configs/tasks, refactors directory walking, and updates docs with comprehensive e2e/unit tests.

  • Config/Env resolution
    • Introduce MISE_CEILING_PATHS (parsed via split_paths) to cap directory ascent when locating configs and tasks (src/env.rs).
    • Replace uses of file::all_dirs() with a new wrapper that respects MISE_CEILING_PATHS in src/config/mod.rs (config_file_from_dir, load_config_paths, load_local_tasks_with_context).
  • Filesystem utils
    • Refactor file::all_dirs to all_dirs(start_dir, &HashSet<PathBuf>) that halts at ceiling paths; add debug/trace logging and unit tests (src/file.rs).
  • Tasks loading
    • Task discovery now respects ceiling paths when walking parent dirs.
  • Docs
    • Document MISE_CEILING_PATHS and update the resolution process to note stopping at ceiling paths (docs/configuration.md).
  • Tests
    • Add e2e tests for configs/tasks on Unix (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.

Richard Alcock and others added 10 commits August 15, 2025 17:31
… 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.
@richardthe3rd richardthe3rd changed the title feat(MISE_CEILING_PATHS): Add a ceiling to how mise searchs for config & tasks feat: Add a ceiling to how mise searchs for config & tasks Sep 30, 2025
@richardthe3rd richardthe3rd changed the title feat: Add a ceiling to how mise searchs for config & tasks feat(config): Add a ceiling to how mise searchs for config & tasks Sep 30, 2025
@richardthe3rd richardthe3rd marked this pull request as ready for review October 7, 2025 16:26
@richardthe3rd
Copy link
Copy Markdown
Contributor Author

Finally got to the e2e-win tests - ready for review

@jdx
Copy link
Copy Markdown
Owner

jdx commented Oct 8, 2025

bugbot run

cursor[bot]

This comment was marked as outdated.

@jdx
Copy link
Copy Markdown
Owner

jdx commented Oct 8, 2025

Bugbot run

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no bugs!


@jdx
Copy link
Copy Markdown
Owner

jdx commented Oct 8, 2025

nice work!

@jdx jdx merged commit 348faba into jdx:main Oct 8, 2025
27 checks passed
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)
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.

2 participants