Skip to content

fix(backend): pass install_env to postinstall#9930

Merged
jdx merged 1 commit into
jdx:mainfrom
risu729:fix/install-env-postinstall
May 18, 2026
Merged

fix(backend): pass install_env to postinstall#9930
jdx merged 1 commit into
jdx:mainfrom
risu729:fix/install-env-postinstall

Conversation

@risu729

@risu729 risu729 commented May 16, 2026

Copy link
Copy Markdown
Contributor

Summary

  • passes per-tool install_env into tool-level postinstall hook commands
  • documents that tool-level postinstall receives install_env variables
  • extends the postinstall environment e2e to cover install_env

Project item: https://github.com/users/risu729/projects/3/views/1?filterQuery=install_env&pane=issue&itemId=188373493

Tests

  • cargo fmt --all -- --check
  • git diff --check
  • CARGO_TARGET_DIR="$(cargo metadata --format-version 1 --no-deps | jq -r .target_directory)" mise run test:e2e -- test_hooks_postinstall_env

@greptile-apps

greptile-apps Bot commented May 16, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes the tool-level postinstall hook so that per-tool install_env variables are passed into the postinstall execution environment, matching the behaviour users would already expect from seeing those variables during the install phase itself.

  • src/backend/mod.rs: One-line fix in run_postinstall_hook — calls env_vars.extend(tv.request.options().core.install_env) after the config env block, so install_env entries are present (and override any conflicting earlier entries) when the postinstall command runs.
  • e2e test: The existing test_hooks_postinstall_env script is extended with an INSTALL_ENV_VAR set via install_env and a new assertion that verifies it is visible inside postinstall.
  • Docs: docs/configuration.md, docs/dev-tools/index.md, and docs/hooks.md are all updated to document that install_env variables are available during tool-level postinstall.

Confidence Score: 5/5

Safe to merge — a minimal, well-tested one-line fix with matching documentation and a new e2e assertion.

The change is a single extend call that mirrors the same pattern already used when applying install_env during the install phase (e.g. asdf.rs). Priority semantics are consistent: install_env uses extend (overrides), while global config env uses or_insert (does not override), which is the expected ordering. The e2e test directly exercises the new code path and the documentation is fully updated.

No files require special attention.

Important Files Changed

Filename Overview
src/backend/mod.rs Adds env_vars.extend(tv.request.options().core.install_env) in run_postinstall_hook so that per-tool install_env variables are propagated into the postinstall environment, consistently overriding earlier env entries.
e2e/config/test_hooks_postinstall_env Extends the existing postinstall environment e2e test to include an INSTALL_ENV_VAR set via install_env and verifies it is visible during postinstall.
docs/configuration.md Updates the install_env bullet to note it also applies to tool-level postinstall.
docs/dev-tools/index.md Adds a note that install_env variables are available during postinstall, alongside the existing MISE_TOOL_INSTALL_PATH mention.
docs/hooks.md Adds a bullet to the tool-level postinstall environment variable list noting that install_env variables are injected.

Reviews (2): Last reviewed commit: "fix(backend): pass install_env to postin..." | Re-trigger Greptile

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request updates the documentation and implementation to ensure that environment variables specified in the install_env configuration are available during the postinstall hook. It includes a new end-to-end test to verify this behavior. A review comment pointed out a compilation error in the backend logic where a map was being extended with a reference instead of owned values, and a code suggestion was provided to fix it.

Comment thread src/backend/mod.rs
@risu729 risu729 marked this pull request as ready for review May 18, 2026 10:12
@risu729 risu729 force-pushed the fix/install-env-postinstall branch from 72b830b to 93568f1 Compare May 18, 2026 11:11
@risu729 risu729 marked this pull request as draft May 18, 2026 11:25
@risu729 risu729 marked this pull request as ready for review May 18, 2026 11:39
@jdx jdx merged commit 940d637 into jdx:main May 18, 2026
33 checks passed
@risu729 risu729 deleted the fix/install-env-postinstall branch May 18, 2026 16:26
mise-en-dev added a commit that referenced this pull request May 19, 2026
### 🚀 Features

- **(cli)** rename before flag to minimum release age by @risu729 in
[#9768](#9768)
- **(core)** deprecate default package files by @jdx in
[#9970](#9970)
- **(edit)** add --global flag for editing the global config file by
@fru1tworld in [#9953](#9953)

### 🐛 Bug Fixes

- **(aqua)** support cosign public-key bundles by @jdx in
[#9972](#9972)
- **(backend)** pass install_env to postinstall by @risu729 in
[#9930](#9930)
- **(backend)** apply install_env to install commands by @risu729 in
[#9929](#9929)
- **(cargo)** skip binstall for cargo install options by @risu729 in
[#9928](#9928)
- **(config)** restore MISE_ENV_FILE setting by @risu729 in
[#9903](#9903)

### 🚜 Refactor

- **(cli)** use tool wording in version env help by @risu729 in
[#9906](#9906)
- **(conda)** parse tool options locally by @risu729 in
[#9960](#9960)
- **(core)** parse plugin tool options locally by @risu729 in
[#9963](#9963)
- **(go)** parse tool options locally by @risu729 in
[#9961](#9961)
- **(http)** parse tool options locally by @risu729 in
[#9870](#9870)

### 📦️ Dependency Updates

- lock file maintenance by @renovate[bot] in
[#9954](#9954)
- lock file maintenance by @renovate[bot] in
[#9957](#9957)

### 📦 Registry

- use aqua backend for qsv by @risu729 in
[#9910](#9910)

### Ci

- build/publish snap package for arm64 by @jnsgruk in
[#9948](#9948)

### New Contributors

- @jnsgruk made their first contribution in
[#9948](#9948)

## 📦 Aqua Registry Updates

### New Packages (2)

- [`AOMediaCodec/libavif`](https://github.com/AOMediaCodec/libavif)
- [`julian7/redact`](https://github.com/julian7/redact)

### Updated Packages (1)

- [`apache/jena`](https://github.com/apache/jena)
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