fix: restore application env exactly after evaluating project config - #400
Merged
zachdaniel merged 1 commit intoSep 3, 2026
Merged
Conversation
with_evaled_configs/2 applies the evaluated project config with Application.put_all_env/1 and restored a per-application snapshot with put_all_env/1 as well. put_all_env only writes the keys it is given, so keys that the evaluated config introduced stayed set in the VM after the call returned. Every task that touches files goes through Igniter.format/2, so test suites driving an installer against fixtures that configure the library under test kept that fixture config for the rest of the run. The restore now deletes keys absent from the snapshot before putting the snapshot back. The regression test covers an added key, a pre-existing key assigned a different value, and an application with no prior environment.
Contributor
|
🚀 Thank you for your contribution! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
with_evaled_configs/2evaluates the project'sconfig/config.exsandconfig/<env>.exs, applies the result withApplication.put_all_env/1, and afterwards restores a per-application snapshot withApplication.put_all_env/1again.put_all_envonly writes the keys it is given, so any key the evaluated config introduced that was absent before stays set in the VM after the call returns.This shows up in test suites that drive an Igniter installer against fixtures configuring the library under test. Every task that touches files goes through
Igniter.format/2, so after such a test the fixture'sconfig :my_lib, MyLib.Config, ...remains under{:my_lib, MyLib.Config}for the rest of the run, and unrelated tests that read that key pass or fail depending on test order.The restore now deletes keys that were not in the snapshot before putting the snapshot back. The regression test covers a key that did not exist before, a pre-existing key that the evaluated config assigned a different value, and an application that had no environment at all.
test/mix/tasks/igniter.install_test.exson current main does not compile (install/1is undefined); this change does not touch it.