feat(config): Warn when undefined environments or groups are used in overrides #1880
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.
-- Please review #1876 first --
Why this PR?
When copying and pasting configs between projects, it is easy to forget to update any overrides. Currently, this is silent: the overrides simply have no effect, which can have undesirable consequences.
What has changed?
With this PR, a warning is emitted when an override references an environment or environment group that is not defined in the manifest.
A decision was made not to emit an error, at least for now, as this would be a breaking change.
How does it do it?
This PR builds on #1876, which preserves at least the names of all environments and groups in the loaded manifest, regardless of whether they're selected to be deployed or not.
Then, when a config entry is loaded, the environment or group name of each override is checked against those in the loader context
How is it tested?
Two extra tests are added to that explicitly check that warnings are logged:
TestLoadProjects_GroupOverrideWithUndefinedGroupProducesWarning
TestLoadProjects_EnvironmentOverrideWithUndefinedEnvironmentProducesWarning
How does it affect users?
Users will now receive a warning when an override references an environment or environment group that is not defined in the manifest.