Skip to content

fix(trust): add untrust command#9370

Merged
jdx merged 3 commits intomainfrom
codex/untrust-command
Apr 24, 2026
Merged

fix(trust): add untrust command#9370
jdx merged 3 commits intomainfrom
codex/untrust-command

Conversation

@jdx
Copy link
Copy Markdown
Owner

@jdx jdx commented Apr 24, 2026

Summary

  • add a top-level mise untrust [CONFIG_FILE] command that reuses the existing trust untrust implementation
  • keep mise trust --untrust behavior intact
  • add an e2e regression covering a task named untrust so naked task fallback cannot run it
  • regenerate CLI usage docs for the new command

Test

  • mise run format
  • mise run render:usage
  • mise run test:e2e e2e/cli/test_untrust
  • commit hook: cargo fmt/check, shellcheck, shfmt, prettier, pkl, taplo, lua-check, stylua, actionlint, markdownlint, schema

Note

Medium Risk
Adds a new CLI entry point that mutates trusted-config state; behavior is mostly reused but touches config trust controls and command dispatch, so regressions could affect how configs are treated as trusted/untrusted.

Overview
Adds a new top-level mise untrust [CONFIG_FILE] command, wired into CLI dispatch, that reuses the existing trust-removal logic (previously only reachable via mise trust --untrust).

Refactors the untrust implementation in trust.rs into shared helpers (untrust_config_file, resolve_config_file) so both commands resolve directories the same way.

Regenerates user-facing artifacts (usage spec, docs site command list, man page, Fig completions) and adds an e2e regression test to ensure mise untrust does not fall back to running a task named untrust.

Reviewed by Cursor Bugbot for commit 95064bc. Bugbot is set up for automated code reviews on this repo. Configure here.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 24, 2026

Greptile Summary

Adds a top-level mise untrust [CONFIG_FILE] command by extracting the existing untrust logic from Trust into reusable pub(super) free functions (untrust_config_file, resolve_config_file) and wiring up a new Untrust struct in src/cli/untrust.rs. Regenerates all derived artifacts (docs, man page, usage KDL, fig completions). Behavioral parity with mise trust --untrust is preserved: both paths resolve the config file identically and share the same fallback to ALL_CONFIG_FILES.first().

Confidence Score: 5/5

Safe to merge — all changes are additive, behavioral parity with mise trust --untrust is preserved, and generated artifacts are consistent.

No P0 or P1 findings. The refactoring is clean: the extracted free functions reproduce exactly the same logic as the removed private methods, the fallback path (ALL_CONFIG_FILES.first()) is unchanged, the new command's synchronous run() is correctly dispatched without .await in mod.rs, and all generated docs/completions are regenerated consistently.

No files require special attention.

Important Files Changed

Filename Overview
src/cli/trust.rs Extracts untrust_config_file and resolve_config_file as pub(super) free functions; behavior is identical to the removed private methods
src/cli/untrust.rs New command file; cleanly delegates to the extracted trust helpers
src/cli/mod.rs Registers the new Untrust variant; correctly omits .await since Untrust::run() is synchronous
e2e/cli/test_untrust Regression test guards against task-name shadowing; covers the core happy path

Sequence Diagram

sequenceDiagram
    participant User
    participant CLI as mise CLI (mod.rs)
    participant Untrust as Untrust (untrust.rs)
    participant Trust as trust.rs helpers
    participant CF as config_file module

    User->>CLI: mise untrust [CONFIG_FILE]
    CLI->>Untrust: Untrust::run(self)
    Untrust->>Trust: resolve_config_file(self.config_file.as_ref())
    Trust-->>Untrust: Option<PathBuf>
    Untrust->>Trust: untrust_config_file(Option<PathBuf>)
    alt config_file provided
        Trust->>CF: config_trust_root(&path)
        CF-->>Trust: cfr
        Trust->>CF: config_file::untrust(&cfr)
        Trust->>Trust: cfr.canonicalize()
        Trust-->>User: info untrusted path
    else no config_file fallback
        Trust->>Trust: ALL_CONFIG_FILES.first()
        Trust->>CF: config_file::untrust(&cfr)
        Trust-->>User: info untrusted path
    end
Loading

Reviews (3): Last reviewed commit: "refactor(trust): share config file resol..." | Re-trigger Greptile

Comment thread src/cli/untrust.rs
Comment thread e2e/cli/test_untrust
Comment on lines +8 to +10
assert "mise trust mise.toml"
assert_contains "mise trust --show" "trusted"
assert_contains "mise untrust 2>&1" "untrusted"
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.

P2 Missing post-untrust status assertion

The test verifies the untrust command prints "untrusted" but never re-runs mise trust --show to confirm the file's trust status has actually changed back to untrusted. Adding assert_contains "mise trust --show" "untrusted" after line 10 would give a round-trip signal that the state was persisted correctly.

Fix in Claude Code

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces the mise untrust command, allowing users to revoke trust from configuration files. The implementation includes the new CLI command, updated documentation, and an end-to-end test. A review comment identifies code duplication in the logic used to resolve configuration file paths and suggests refactoring it into a shared helper function to improve maintainability.

Comment thread src/cli/untrust.rs
Comment on lines +23 to +34
fn config_file(&self) -> Option<PathBuf> {
self.config_file.as_ref().map(|config_file| {
if config_file.is_dir() {
config_files_in_dir(config_file)
.last()
.cloned()
.unwrap_or(config_file.join(&*env::MISE_DEFAULT_CONFIG_FILENAME))
} else {
config_file.clone()
}
})
}
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.

medium

The config_file method is a duplicate of the implementation found in src/cli/trust.rs. This logic, which handles resolving the correct config file when a directory is provided, should be moved to a shared helper function (e.g., in src/cli/trust.rs or src/config/mod.rs) to improve maintainability and avoid duplication.

@jdx jdx enabled auto-merge (squash) April 24, 2026 19:23
@jdx jdx disabled auto-merge April 24, 2026 19:23
@jdx jdx enabled auto-merge (squash) April 24, 2026 19:23
@jdx jdx merged commit cbe9cf2 into main Apr 24, 2026
37 checks passed
@jdx jdx deleted the codex/untrust-command branch April 24, 2026 19:47
@github-actions
Copy link
Copy Markdown

Hyperfine Performance

mise x -- echo

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2026.4.20 x -- echo 17.4 ± 0.6 16.1 20.9 1.00
mise x -- echo 17.8 ± 0.7 16.7 23.6 1.02 ± 0.05

mise env

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2026.4.20 env 16.8 ± 0.6 15.9 21.2 1.00
mise env 17.7 ± 0.7 16.4 23.6 1.05 ± 0.06

mise hook-env

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2026.4.20 hook-env 17.8 ± 0.6 16.1 20.2 1.00
mise hook-env 18.2 ± 0.5 17.0 20.0 1.02 ± 0.04

mise ls

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2026.4.20 ls 16.8 ± 0.5 15.7 19.6 1.00
mise ls 17.3 ± 0.5 16.1 19.0 1.03 ± 0.04

xtasks/test/perf

Command mise-2026.4.20 mise Variance
install (cached) 120ms 123ms -2%
ls (cached) 65ms 69ms -5%
bin-paths (cached) 66ms 67ms -1%
task-ls (cached) 704ms 702ms +0%

mise-en-dev added a commit that referenced this pull request Apr 25, 2026
### 🚀 Features

- **(registry)** add --security flag to include security info in JSON
output by @jdx in [#9364](#9364)

### 🐛 Bug Fixes

- **(config)** limit resolved backend opts to aliases by @risu729 in
[#9315](#9315)
- **(docs)** stack banner message and link on mobile by @jdx in
[#9362](#9362)
- **(github)** prefer shortest asset name as tiebreaker in
auto-detection by @jdx in [#9361](#9361)
- **(java)** newer zulu versions use a different directory structure by
@roele in [#9365](#9365)
- **(prune)** respect tracked lockfiles by @jdx in
[#9373](#9373)
- **(task)** skip tool install for missing naked tasks by @jdx in
[#9374](#9374)
- **(trust)** add untrust command by @jdx in
[#9370](#9370)
- fix - flux-operator-mcp aqua path by @monotek in
[#9357](#9357)

### 📚 Documentation

- update ruby compile msg by @fladson in
[#9338](#9338)

### 📦️ Dependency Updates

- update ubuntu docker tag to v26 by @renovate[bot] in
[#9347](#9347)
- update ghcr.io/jdx/mise:deb docker digest to 1af5a69 by @renovate[bot]
in [#9352](#9352)
- update taiki-e/install-action digest to 787505c by @renovate[bot] in
[#9354](#9354)
- update ghcr.io/jdx/mise:rpm docker digest to 7015ff3 by @renovate[bot]
in [#9353](#9353)
- update ghcr.io/jdx/mise:copr docker digest to da63a0f by
@renovate[bot] in [#9351](#9351)
- update ghcr.io/jdx/mise:alpine docker digest to 461700f by
@renovate[bot] in [#9350](#9350)
- bump communique 1.0.3 → 1.0.4 by @jdx in
[#9378](#9378)

### 📦 Registry

- remove openshift-install by @jdx in
[#9372](#9372)
- remove go-sdk by @jdx in
[#9371](#9371)

### Chore

- **(npm-publish)** use aube publish instead of npm publish by @jdx in
[#9328](#9328)

### New Contributors

- @fladson made their first contribution in
[#9338](#9338)
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.

1 participant