Skip to content

fix(config): deprecate env directive value aliases - #11062

Merged
jdx merged 2 commits into
jdx:mainfrom
risu729:agent/deprecate-env-directive-values
Jul 16, 2026
Merged

jdx merged 2 commits into
jdx:mainfrom
risu729:agent/deprecate-env-directive-values

Conversation

@risu729

@risu729 risu729 commented Jul 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • deprecate value and values in built-in file, path, and source directive objects starting in mise 2026.7.0
  • direct users to canonical path, which accepts both a string and an array of strings
  • retain compatibility until removal in mise 2026.12.0
  • document the precise scope and cover deprecated warnings plus canonical plural-path behavior end to end

Why

The public schema and current documentation expose path/paths, but runtime parsing still accepts the older value spelling and the incidental values spelling. These forms are old enough to use the same shortened deprecation window as the related env.mise deprecation in #11053.

The schema intentionally remains unchanged: it already exposes only the canonical path and paths forms.

Impact

Built-in file, path, and source directive objects under env._ or vars._ that use value or values continue to work through mise 2026.11.x and now emit a warning. path accepts either a scalar string or an array, while paths remains supported for arrays.

Ordinary environment variable objects such as FOO = { value = "bar" } and options for plugin-provided directives are unaffected.

Validation

  • mise run format
  • cargo check --all-features
  • mise run test:e2e e2e/env/test_env_file e2e/env/test_env_path

Summary by CodeRabbit

  • Documentation

    • Added guidance that the legacy value and values keys for built-in environment file, path, and source directives are deprecated.
    • Documented the recommended path syntax and removal timeline in mise 2026.12.0.
  • Bug Fixes

    • Added clearer deprecation warnings when legacy directive keys are used.
    • Improved support for configuring multiple paths while preserving environment variable and PATH resolution.

@coderabbitai

coderabbitai Bot commented Jul 16, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Environment directive parsing now uses path-based structures, warns on deprecated value and values keys, and adds documentation plus end-to-end coverage for legacy and current syntax.

Changes

Environment directive deprecation

Layer / File(s) Summary
Directive parsing and normalization
src/config/config_file/mise_toml.rs
Custom deserialization detects deprecated value and values keys, maps path-based forms, and updates directive flattening.
Deprecation documentation and test coverage
docs/environments/index.md, e2e/env/test_env_file, e2e/env/test_env_path
Documentation describes the deprecated syntax, while tests verify warnings, exported variables, and path resolution.

Estimated code review effort: 2 (Simple) | ~10 minutes

Poem

I’m a bunny with paths in a row,
Old values now gently say go.
Warnings hop near,
While exports stay clear,
And $PWD paths happily grow.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: deprecating env directive value aliases.

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@greptile-apps

greptile-apps Bot commented Jul 16, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR deprecates the undocumented value and values spelling aliases in built-in file, path, and source directive objects (e.g., _.file = { value = "foo" }), emitting a deprecated_at! warning starting in 2026.7.0 with removal scheduled for 2026.12.0, while leaving the canonical path / paths forms and ordinary env-var value assignments entirely unaffected.

  • Core logic (mise_toml.rs): MiseTomlEnvDirective becomes a newtype wrapping a renamed MiseTomlEnvDirectiveValue; a custom Deserialize impl first materialises the input as toml::Value to detect deprecated keys before delegating to the existing untagged-enum deserialization — a clean, zero-regression approach.
  • Tests: test_env_file gains assertions for both value (single) and values (array) deprecation warnings; test_env_path verifies paths (still canonical) produces no warning.
  • Docs: a vitepress warning block is added under the env directives section pointing users to path and stating the removal version.

Confidence Score: 5/5

Safe 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 toml::Value, inspect for deprecated keys, then delegate to the untagged enum) is a well-established pattern and does not alter any existing parsing outcome. Aliases are consistent: value/values remain accepted and simply emit warnings, while path/paths continue working without any warning. The FromStr path for plain-string directives is untouched. E2e tests cover the newly warned-on spellings and confirm the still-canonical paths alias is warning-free.

No files require special attention.

Important Files Changed

Filename Overview
src/config/config_file/mise_toml.rs Refactors MiseTomlEnvDirective into a newtype wrapping MiseTomlEnvDirectiveValue and adds a custom Deserialize impl that eagerly materialises the input to toml::Value to inspect for deprecated value/values keys before delegating to the existing untagged enum logic. The alias renaming and deprecation branches are wired to deprecated_at! with the right versions.
e2e/env/test_env_file Adds two new e2e blocks: one asserting the value alias triggers a deprecation warning while still loading the file, and another asserting the values alias triggers a deprecation warning while correctly loading multiple files.
e2e/env/test_env_path Adds a test confirming the paths alias (still canonical/non-deprecated) emits no deprecation warning and resolves multiple path entries correctly.
docs/environments/index.md Adds a vitepress warning block documenting the deprecation of value/values in built-in directive objects, pointing users to path, and noting the removal version (2026.12.0) as well as the unaffected cases.

Reviews (2): Last reviewed commit: "fix(config): clarify directive alias sco..." | Re-trigger Greptile

Comment thread e2e/env/test_env_file Resolved

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
src/config/config_file/mise_toml.rs (1)

1695-1711: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Avoid intermediate vector allocations in flatten_directives.

The current implementation constructs a new Vec for every Single and Multiple item inside the flat_map closure just to satisfy the iterator requirements. Since the callers use env.extend(...) (which accepts any IntoIterator), you can simplify this function to build and return a single Vec, 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

📥 Commits

Reviewing files that changed from the base of the PR and between 44d5d47 and 95e0605.

📒 Files selected for processing (4)
  • docs/environments/index.md
  • e2e/env/test_env_file
  • e2e/env/test_env_path
  • src/config/config_file/mise_toml.rs

@risu729
risu729 marked this pull request as ready for review July 16, 2026 17:23
@jdx
jdx merged commit eb013ff into jdx:main Jul 16, 2026
34 checks passed
@risu729
risu729 deleted the agent/deprecate-env-directive-values branch July 16, 2026 18:35
This was referenced Jul 16, 2026
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