Skip to content

fix(env): include tools-only redactions in mise env --redacted#8956

Merged
jdx merged 1 commit intojdx:mainfrom
jakedgy:fix/env-redacted-tools-flag
Apr 7, 2026
Merged

fix(env): include tools-only redactions in mise env --redacted#8956
jdx merged 1 commit intojdx:mainfrom
jakedgy:fix/env-redacted-tools-flag

Conversation

@jakedgy
Copy link
Copy Markdown
Contributor

@jakedgy jakedgy commented Apr 7, 2026

Summary

  • mise env --redacted only checked redactions from the non-tools env resolution pass (config.env_results()), missing any env vars declared with both tools = true and redact = true
  • The tools-only pass (final_env / load_post_env) correctly collects redactions, but cli/env.rs never queried them
  • Added ts.final_env() call to also collect tools-only redactions when building the --redacted filter

Follows up on #8449 which fixed redaction in task output but missed the mise env --redacted display path.

Test plan

  • Added e2e test for --redacted with tools = true, redact = true (inline val)
  • Added e2e test for --redacted with _.source = { tools = true, redact = true }
  • Existing test_env_redacted_flags tests still pass
  • Existing test_task_redactions tests still pass

🤖 Generated with 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 adds E2E tests and updates the environment variable handling logic to ensure that variables marked with both tools = true and redact = true are correctly identified for redaction. The changes in src/cli/env.rs now aggregate redaction keys from both the standard environment results and the tools-specific pass. Feedback suggests a performance optimization to avoid redundant calls to ts.final_env() when both --redacted and --dotenv flags are used.

Comment thread src/cli/env.rs
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 7, 2026

Greptile Summary

Fixes mise env --redacted to include redactions from tools = true, redact = true env vars by adding a ts.final_env() call when --redacted is active and merging its redaction set into redacted_keys. As a side-effect, the existing double final_env computation in the --dotenv path is eliminated by reusing the pre-computed result.

Confidence Score: 5/5

Safe to merge; targeted fix with no regressions

No P0 or P1 issues; fix is correct and well-tested with the new e2e scenarios; only the previously-flagged double-computation concern (P2) remains and is already under discussion in a prior thread

No files require special attention

Important Files Changed

Filename Overview
src/cli/env.rs Correctly pre-computes final_env and extends redacted_keys with tools-only redactions; converts output_dotenv to sync to reuse pre-computed EnvMap
e2e/cli/test_env_redacted_flags Adds e2e coverage for tools=true + redact=true inline-value and sourced-file scenarios

Sequence Diagram

sequenceDiagram
    participant U as User
    participant E as Env::run
    participant T as Toolset
    participant C as Config

    U->>E: mise env --redacted
    E->>T: ts.final_env(config)
    T->>C: config.env_results() (internal)
    T-->>E: (EnvMap, EnvResults[tools])
    E->>C: config.env_results()
    C-->>E: EnvResults[non-tools]
    Note over E: redacted_keys =<br/>non_tools.redactions<br/>+ tools.redactions<br/>+ config.redaction_keys()
    E->>T: ts.env_with_path(config)
    T-->>E: full EnvMap
    E-->>U: filtered redacted env output
Loading

Greploops — Automatically fix all review issues by running /greploops in Claude Code. It iterates: fix, push, re-review, repeat until 5/5 confidence.
Use the Greptile plugin for Claude Code to query reviews, search comments, and manage custom context directly from your terminal.

Reviews (2): Last reviewed commit: "fix(env): include tools-only redactions ..." | Re-trigger Greptile

Comment thread src/cli/env.rs
`mise env --redacted` only checked redactions from the non-tools env
resolution pass, missing any env vars declared with both `tools = true`
and `redact = true`. This adds the tools-only pass redactions from
`final_env` so they are included in the filtered output.

The `final_env` call is hoisted and shared between the `--redacted`
key collection and `--dotenv` output to avoid computing it twice.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@jakedgy jakedgy force-pushed the fix/env-redacted-tools-flag branch from 3ddced9 to d3cbf1f Compare April 7, 2026 19:38
@jdx jdx merged commit 7203b8b into jdx:main Apr 7, 2026
34 checks passed
mise-en-dev added a commit that referenced this pull request Apr 7, 2026
### 🚀 Features

- **(config)** Add Tera template support to miserc.toml by
@richardthe3rd in [#8867](#8867)

### 🐛 Bug Fixes

- **(env)** include tools-only redactions in `mise env --redacted` by
@jakedgy in [#8956](#8956)
- **(env)** pass dependency env to vfox backend plugin hooks by
@cprecioso in [#8952](#8952)
- **(shim)** fix race condition when removing in make_shim, when
multiple plugins provide the same shim by @brander-john in
[#8947](#8947)
- **(spm)** derive API URL from host for self-hosted instances by
@ThomasDutartre in [#8955](#8955)
- **(task)** resolve env vars in usage tera templates when flags are
provided by @jdx in [#8957](#8957)

### 📚 Documentation

- **(python)** clarify attestation settings must be under [settings] in
mise.toml by @fru1tworld in
[#8939](#8939)

### 📦 Registry

- added sing-box by @tony-sol in
[#8944](#8944)

### Chore

- **(ci)** remove auto-draft PR workflow by @jdx in
[#8945](#8945)

### New Contributors

- @ThomasDutartre made their first contribution in
[#8955](#8955)
- @jakedgy made their first contribution in
[#8956](#8956)
- @brander-john made their first contribution in
[#8947](#8947)
- @fru1tworld made their first contribution in
[#8939](#8939)
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