Repository navigation
fix(config): deprecate env directive value aliases - #11062
Conversation
📝 WalkthroughWalkthroughEnvironment directive parsing now uses ChangesEnvironment directive deprecation
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 deprecates the undocumented
Confidence Score: 5/5Safe to merge — the change is purely additive (deprecation warnings with full backwards compatibility) and the deserialization logic is correctly preserved. The two-phase deserialization (materialise to No files require special attention. Important Files Changed
Reviews (2): Last reviewed commit: "fix(config): clarify directive alias sco..." | Re-trigger Greptile |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/config/config_file/mise_toml.rs (1)
1695-1711: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueAvoid intermediate vector allocations in
flatten_directives.The current implementation constructs a new
Vecfor everySingleandMultipleitem inside theflat_mapclosure just to satisfy the iterator requirements. Since the callers useenv.extend(...)(which accepts anyIntoIterator), you can simplify this function to build and return a singleVec, avoiding intermediate heap allocations.♻️ Proposed refactor
- fn flatten_directives<F>( - directives: Vec<MiseTomlEnvDirective>, - constructor: F, - ) -> impl Iterator<Item = EnvDirective> - where - F: Fn(String, EnvDirectiveOptions) -> EnvDirective + 'static, - { - directives.into_iter().flat_map(move |d| match d.0 { - MiseTomlEnvDirectiveValue::Single { path, options } => { - vec![constructor(path, options)] - } - MiseTomlEnvDirectiveValue::Multiple { path, options } => path - .into_iter() - .map(|v| constructor(v, options.clone())) - .collect(), - }) - } + fn flatten_directives<F>( + directives: Vec<MiseTomlEnvDirective>, + constructor: F, + ) -> Vec<EnvDirective> + where + F: Fn(String, EnvDirectiveOptions) -> EnvDirective + 'static, + { + let mut out = Vec::new(); + for d in directives { + match d.0 { + MiseTomlEnvDirectiveValue::Single { path, options } => { + out.push(constructor(path, options)); + } + MiseTomlEnvDirectiveValue::Multiple { path, options } => { + out.extend( + path.into_iter() + .map(|v| constructor(v, options.clone())) + ); + } + } + } + out + }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/config/config_file/mise_toml.rs` around lines 1695 - 1711, Update flatten_directives to accumulate all constructed EnvDirective values into one Vec and return that collection as the iterator source, rather than creating a Vec inside each flat_map closure for Single and Multiple variants. Preserve constructor invocation and option cloning behavior, and keep the result compatible with callers passing it to env.extend.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@src/config/config_file/mise_toml.rs`:
- Around line 1695-1711: Update flatten_directives to accumulate all constructed
EnvDirective values into one Vec and return that collection as the iterator
source, rather than creating a Vec inside each flat_map closure for Single and
Multiple variants. Preserve constructor invocation and option cloning behavior,
and keep the result compatible with callers passing it to env.extend.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Central YAML (base), Organization UI (inherited)
Review profile: CHILL
Plan: Pro Plus
Run ID: 69797ce6-afdf-4922-859f-de05979e5dfe
📒 Files selected for processing (4)
docs/environments/index.mde2e/env/test_env_filee2e/env/test_env_pathsrc/config/config_file/mise_toml.rs
Summary
valueandvaluesin built-infile,path, andsourcedirective objects starting in mise 2026.7.0path, which accepts both a string and an array of stringsWhy
The public schema and current documentation expose
path/paths, but runtime parsing still accepts the oldervaluespelling and the incidentalvaluesspelling. These forms are old enough to use the same shortened deprecation window as the relatedenv.misedeprecation in #11053.The schema intentionally remains unchanged: it already exposes only the canonical
pathandpathsforms.Impact
Built-in
file,path, andsourcedirective objects underenv._orvars._that usevalueorvaluescontinue to work through mise 2026.11.x and now emit a warning.pathaccepts either a scalar string or an array, whilepathsremains supported for arrays.Ordinary environment variable objects such as
FOO = { value = "bar" }and options for plugin-provided directives are unaffected.Validation
mise run formatcargo check --all-featuresmise run test:e2e e2e/env/test_env_file e2e/env/test_env_pathSummary by CodeRabbit
Documentation
valueandvalueskeys for built-in environment file, path, and source directives are deprecated.pathsyntax and removal timeline in mise 2026.12.0.Bug Fixes