Skip to content

fix(config): honor trusted_config_paths over previously-ignored configs - #11152

Merged
jdx merged 1 commit into
jdx:mainfrom
JamBalaya56562:pr11152
Jul 21, 2026
Merged

jdx merged 1 commit into
jdx:mainfrom
JamBalaya56562:pr11152

Conversation

@JamBalaya56562

@JamBalaya56562 JamBalaya56562 commented Jul 21, 2026 •

Copy link
Copy Markdown
Contributor

trusted_config_paths (MISE_TRUSTED_CONFIG_PATHS) had no effect for any config
that had been added to the persisted ignore list — by answering "No" to the
trust prompt or running mise trust --ignore. is_trusted() consulted the
ignore list before trusted_config_paths, so the setting never took effect,
which also contradicted the mise trust warnings that a settings-trusted path
"will still be trusted".

Precedence is now:

  1. ignored_config_paths setting — explicit hard block (unchanged)
  2. trusted_config_paths / global config — overrides the persisted ignore list
  3. persisted ignore list (dismissed prompt / mise trust --ignore)

The override is applied in both the trust check (is_trusted) and config
discovery (config_path_is_ignored), so a settings-trusted config is actually
discovered and loaded, and mise doctor's ignored-config list reflects it.
Adds an e2e regression test.

Addresses #3544

This PR was prepared by an AI coding assistant.

Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com

Summary by CodeRabbit

  • Bug Fixes
    • Trusted configuration paths now correctly override previously persisted “ignored” configuration entries.
    • When MISE_TRUSTED_CONFIG_PATHS is set, corresponding configurations are now discovered and loaded as trusted (including their environment variables).
    • Trust reporting (mise trust --show, and related environment output) more accurately reflects the active trusted-path rules.
  • Tests
    • Added an end-to-end regression test covering MISE_TRUSTED_CONFIG_PATHS overriding persisted ignore behavior and validating trust status output.

@coderabbitai

coderabbitai Bot commented Jul 21, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Central YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 10b4b865-f791-4690-a882-8e58db29aa00

📥 Commits

Reviewing files that changed from the base of the PR and between 670ee84 and ff742fd.

📒 Files selected for processing (3)
  • e2e/cli/test_trusted_config_paths_override_ignore
  • src/config/config_file/mod.rs
  • src/config/mod.rs
🚧 Files skipped from review as they are similar to previous changes (3)
  • e2e/cli/test_trusted_config_paths_override_ignore
  • src/config/config_file/mod.rs
  • src/config/mod.rs

📝 Walkthrough

Walkthrough

Config trust resolution now distinguishes explicit ignores from persisted ignores and allows trusted_config_paths to override persisted ignore state. Config discovery applies these rules, with an end-to-end test covering the override behavior.

Changes

Trusted Config Path Precedence

Layer / File(s) Summary
Trust and ignore source resolution
src/config/config_file/mod.rs
Trust evaluation separates explicit ignore settings, trusted config paths, and persisted ignores, applying the updated precedence rules.
Config discovery and regression coverage
src/config/mod.rs, e2e/cli/test_trusted_config_paths_override_ignore
Config discovery preserves trusted paths despite persisted ignores, and the e2e test verifies environment loading before and after the override.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant E2ETest
  participant MiseEnv
  participant ConfigDiscovery
  participant ConfigTrust
  E2ETest->>MiseEnv: run env with persisted ignored config
  MiseEnv->>ConfigDiscovery: discover project config
  ConfigDiscovery->>ConfigTrust: evaluate ignore and trust rules
  ConfigTrust-->>ConfigDiscovery: exclude config
  E2ETest->>MiseEnv: run env with trusted config path
  MiseEnv->>ConfigDiscovery: rediscover project config
  ConfigDiscovery->>ConfigTrust: prioritize trusted config path
  ConfigTrust-->>ConfigDiscovery: include config
  ConfigDiscovery-->>MiseEnv: load PROJECT
Loading

Poem

A rabbit hops through config snow,
Where trusted paths now brightly glow.
Persisted ignores lose their might,
PROJECT blooms in env delight.
The config path now shines bright!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: trusted_config_paths now overrides previously ignored configs.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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.

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 21, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR updates config trust precedence so configured trusted paths can override persisted ignores. The main changes are:

  • Separates explicit setting-based ignores from persisted ignore records.
  • Applies the new precedence to trust checks, config discovery, and doctor output.
  • Adds an end-to-end test for loading a previously ignored project config.

Confidence Score: 5/5

This looks safe to merge.

  • No new blocking issues qualify for this follow-up review.

Important Files Changed

Filename Overview
src/config/config_file/mod.rs Separates configured and persisted ignores, then updates trust-check precedence.
src/config/mod.rs Applies the trusted-path override to config discovery and ignored-config reporting.
e2e/cli/test_trusted_config_paths_override_ignore Adds end-to-end coverage for trusting a project config after it was persisted as ignored.

Reviews (5): Last reviewed commit: "fix(config): honor trusted_config_paths ..." | Re-trigger Greptile

Comment thread src/config/config_file/mod.rs 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 (2)
src/config/config_file/mod.rs (2)

457-508: 🚀 Performance & Scalability | 🔵 Trivial | 💤 Low value

Optional: Avoid redundant path canonicalization.

is_trusted_via_config_paths, is_ignored_via_setting, and is_persisted_ignored perform path.canonicalize() internally. When these helpers are called from is_trusted, they receive canonicalized_path.as_path() (from line 348), resulting in redundant filesystem syscalls for paths that have already been resolved.

If this becomes a hot path (e.g., during config discovery over many files), consider extracting inner _canonical variants that accept an already-canonicalized &Path to skip the extra syscalls, while keeping these outer helpers for external callers.

🤖 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/mod.rs` around lines 457 - 508, Optionally eliminate
redundant canonicalization in the is_trusted flow by adding internal _canonical
helper variants for is_trusted_via_config_paths, is_ignored_via_setting, and
is_persisted_ignored that accept an already-canonicalized path. Have is_trusted
call these variants with canonicalized_path.as_path(), while preserving the
existing public helpers’ canonicalization for external callers and their current
precedence and failure behavior.

372-378: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Reuse is_trusted_via_config_paths to DRY up this logic.

These lines duplicate the exact logic introduced below in is_trusted_via_config_paths. Reusing the helper makes this block more concise.

♻️ Proposed refactor
-    let settings = Settings::get();
-    for p in settings.trusted_config_paths() {
-        if canonicalized_path.starts_with(p) {
-            add_trusted(canonicalized_path.to_path_buf());
-            return true;
-        }
-    }
+    if is_trusted_via_config_paths(path) {
+        add_trusted(canonicalized_path.to_path_buf());
+        return true;
+    }
🤖 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/mod.rs` around lines 372 - 378, In the current
trust-checking function, replace the inline Settings::get and
trusted_config_paths iteration with a call to the existing
is_trusted_via_config_paths helper, preserving the current canonicalized_path
matching and return behavior. Remove only the duplicated loop logic and keep
add_trusted handling unchanged.
🤖 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/mod.rs`:
- Around line 457-508: Optionally eliminate redundant canonicalization in the
is_trusted flow by adding internal _canonical helper variants for
is_trusted_via_config_paths, is_ignored_via_setting, and is_persisted_ignored
that accept an already-canonicalized path. Have is_trusted call these variants
with canonicalized_path.as_path(), while preserving the existing public helpers’
canonicalization for external callers and their current precedence and failure
behavior.
- Around line 372-378: In the current trust-checking function, replace the
inline Settings::get and trusted_config_paths iteration with a call to the
existing is_trusted_via_config_paths helper, preserving the current
canonicalized_path matching and return behavior. Remove only the duplicated loop
logic and keep add_trusted handling unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Central YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: e7fed740-c354-43fd-8b7b-bfe94d19663f

📥 Commits

Reviewing files that changed from the base of the PR and between a139087 and c744037.

📒 Files selected for processing (3)
  • e2e/cli/test_trusted_config_paths_override_ignore
  • src/config/config_file/mod.rs
  • src/config/mod.rs

Comment thread src/config/mod.rs 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)
e2e/cli/test_trusted_config_paths_override_ignore (1)

29-35: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Cover explicit-ignore precedence as well.

This test verifies that trusted_config_paths overrides the persisted ignore list, but it does not verify the other half of the contract: an explicit ignored_config_paths entry must still block loading even when the same path is trusted. Add a case asserting mise env omits PROJECT when both settings are present.

🤖 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 `@e2e/cli/test_trusted_config_paths_override_ignore` around lines 29 - 35,
Extend the trusted/ignored configuration path test to cover both settings
targeting the same path. Add an explicit ignored_config_paths case alongside
trusted_config_paths, run mise env, and assert that PROJECT is omitted, while
preserving the existing trusted override assertions.
🤖 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 `@e2e/cli/test_trusted_config_paths_override_ignore`:
- Around line 29-35: Extend the trusted/ignored configuration path test to cover
both settings targeting the same path. Add an explicit ignored_config_paths case
alongside trusted_config_paths, run mise env, and assert that PROJECT is
omitted, while preserving the existing trusted override assertions.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Central YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: c5b4e977-ac97-440e-a94a-ce6eeff93534

📥 Commits

Reviewing files that changed from the base of the PR and between 82e5a77 and 10a16cc.

📒 Files selected for processing (3)
  • e2e/cli/test_trusted_config_paths_override_ignore
  • src/config/config_file/mod.rs
  • src/config/mod.rs
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/config/mod.rs
  • src/config/config_file/mod.rs

@jdx
jdx enabled auto-merge (squash) July 21, 2026 04:04
`trusted_config_paths` (MISE_TRUSTED_CONFIG_PATHS) had no effect for any config
that had been added to the persisted ignore list — by answering "No" to the
trust prompt or running `mise trust --ignore`. `is_trusted()` consulted the
ignore list before `trusted_config_paths`, so the setting never took effect,
which also contradicted the `mise trust` warnings that a settings-trusted path
"will still be trusted".

Precedence is now:

1. `ignored_config_paths` setting — explicit hard block (unchanged)
2. `trusted_config_paths` / global config — overrides the persisted ignore list
3. persisted ignore list (dismissed prompt / `mise trust --ignore`)

The override is applied in both the trust check (`is_trusted`) and config
discovery (`config_path_is_ignored`), so a settings-trusted config is actually
discovered and loaded, and `mise doctor`'s ignored-config list reflects it.
Adds an e2e regression test.

Addresses jdx#3544

*This PR was prepared by an AI coding assistant.*

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
auto-merge was automatically disabled July 21, 2026 04:37

Head branch was pushed to by a user without write access

@JamBalaya56562

JamBalaya56562 commented Jul 21, 2026 •

Copy link
Copy Markdown
Contributor Author

Rebased onto the latest main and force-pushed — CI is green and the PR is now mergeable. The force-push disabled the auto-merge you'd set (and I can't re-enable it); could you re-enable it or merge when you get a chance? Thanks!

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