Skip to content
Merged
Prev Previous commit
Next Next commit
[autofix.ci] apply automated fixes (attempt 2/3)
  • Loading branch information
autofix-ci[bot] authored Nov 26, 2025
commit dc82d491fe13a39e55b9edbd5d16deeecd1ceb7f
61 changes: 32 additions & 29 deletions src/hook_env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,41 +110,44 @@ pub fn should_exit_early_fast() -> bool {
// Check if data dir has been modified (new tools installed, etc.)
if dirs::DATA.exists()
&& let Ok(metadata) = dirs::DATA.metadata()
&& let Ok(modified) = metadata.modified() {
let modtime = modified
.duration_since(std::time::SystemTime::UNIX_EPOCH)
.unwrap_or_default()
.as_millis();
if modtime > PREV_SESSION.latest_update {
return false;
}
}
&& let Ok(modified) = metadata.modified()
{
let modtime = modified
.duration_since(std::time::SystemTime::UNIX_EPOCH)
.unwrap_or_default()
.as_millis();
if modtime > PREV_SESSION.latest_update {
return false;
}
}
Copy link

Choose a reason for hiding this comment

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

Bug: Fast-path misses deleted data directory

The fast-path only checks dirs::DATA modification time when it exists, but skips the check entirely if it doesn't exist. If dirs::DATA existed in the previous session but is now deleted, the fast-path won't detect this change and may incorrectly exit early, leaving stale tool paths in the environment. The check should return false when dirs::DATA is missing to trigger a full environment update.

Fix in Cursor Fix in Web

// Check if any directory in the config search path has been modified
// This catches new config files created anywhere in the hierarchy
if let Some(cwd) = &*dirs::CWD
&& let Ok(ancestor_dirs) = file::all_dirs(cwd, &env::MISE_CEILING_PATHS) {
// Config subdirectories that might contain config files
let config_subdirs = ["", ".config/mise", ".mise", "mise", ".config"];
for dir in ancestor_dirs {
for subdir in &config_subdirs {
let check_dir = if subdir.is_empty() {
dir.clone()
} else {
dir.join(subdir)
};
if let Ok(metadata) = check_dir.metadata()
&& let Ok(modified) = metadata.modified() {
let modtime = modified
.duration_since(std::time::SystemTime::UNIX_EPOCH)
.unwrap_or_default()
.as_millis();
if modtime > PREV_SESSION.latest_update {
return false;
}
}
&& let Ok(ancestor_dirs) = file::all_dirs(cwd, &env::MISE_CEILING_PATHS)
{
// Config subdirectories that might contain config files
let config_subdirs = ["", ".config/mise", ".mise", "mise", ".config"];
for dir in ancestor_dirs {
for subdir in &config_subdirs {
let check_dir = if subdir.is_empty() {
dir.clone()
} else {
dir.join(subdir)
};
if let Ok(metadata) = check_dir.metadata()
&& let Ok(modified) = metadata.modified()
{
let modtime = modified
.duration_since(std::time::SystemTime::UNIX_EPOCH)
.unwrap_or_default()
.as_millis();
if modtime > PREV_SESSION.latest_update {
return false;
}
}
}
}
}
true
}

Expand Down
Loading