fix(env): include tools-only redactions in mise env --redacted#8956
fix(env): include tools-only redactions in mise env --redacted#8956
mise env --redacted#8956Conversation
There was a problem hiding this comment.
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.
Greptile SummaryFixes Confidence Score: 5/5Safe 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
Sequence DiagramsequenceDiagram
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
Greploops — Automatically fix all review issues by running Reviews (2): Last reviewed commit: "fix(env): include tools-only redactions ..." | Re-trigger Greptile |
`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>
3ddced9 to
d3cbf1f
Compare
### 🚀 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)
Summary
mise env --redactedonly checked redactions from the non-tools env resolution pass (config.env_results()), missing any env vars declared with bothtools = trueandredact = truefinal_env/load_post_env) correctly collects redactions, butcli/env.rsnever queried themts.final_env()call to also collect tools-only redactions when building the--redactedfilterFollows up on #8449 which fixed redaction in task output but missed the
mise env --redacteddisplay path.Test plan
--redactedwithtools = true, redact = true(inline val)--redactedwith_.source = { tools = true, redact = true }test_env_redacted_flagstests still passtest_task_redactionstests still pass🤖 Generated with Claude Code