Add support for importantSettings to override lower priority settings#2293
Add support for importantSettings to override lower priority settings#2293ChrisBlankDe wants to merge 7 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request adds an importantSettings mechanism to AL-Go’s settings merge logic so selected settings can be “protected” during multi-source settings resolution, and documents the new behavior across schema + docs + release notes with accompanying Pester tests.
Changes:
- Extend settings merge logic to recognize an
importantSettingslist and prevent overriding of protected (non-array) settings. - Add Pester tests covering important setting protection, interaction with arrays/
overwriteSettings, and conditional settings. - Update schema and documentation (
settings.md,RELEASENOTES.md) to describe the new setting and expected behavior.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| Actions/.Modules/ReadSettings.psm1 | Implements important-setting tracking in the merge pipeline. |
| Actions/.Modules/settings.schema.json | Adds importantSettings to the settings schema with defaults/description. |
| Tests/ReadSettings.Test.ps1 | Adds test coverage for the important-setting merge semantics. |
| Scenarios/settings.md | Documents importantSettings behavior and examples. |
| RELEASENOTES.md | Adds release note entry describing the new capability. |
|
Interesting concept. We'd have to give it a bit of a thought, as it goes a bit against the way "important" settings are defined. For now, I can't tell I like |
|
I missed to add the use-case to description. added now. I think this will help understand what we're trying to achieve with this feature. When naming it, we got inspired by the !important rule in CSS, since we want to implement a similar concept. i wouldnt name it Think about what you'd like to call it, and I'll be happy to change it. |
| @@ -1,3 +1,37 @@ | |||
| ### Important settings protection | |||
There was a problem hiding this comment.
A new version of AL-Go (v9.1) has been released.
Please move your release notes changes to above the ## v9.1 section in the RELEASENOTES.md file.
This ensures your changes are included in the next release rather than being listed under an already-released version.
❔What, Why & How
This pull request introduces a new
importantSettingsmechanism that allows you to protect specific settings from being overridden by lower-priority sources in the AL-Go settings hierarchy. The implementation ensures that settings marked as important can only be overridden by lower-priority sources if those sources also explicitly mark the same setting as important. This applies to both standard and conditional settings, and integrates with the existingoverwriteSettingsmechanism. Documentation and schema files are updated to reflect this new feature.Important settings protection:
importantSettingsarray in settings files, enabling top-level settings to be protected from non-important overrides by lower-priority sources. The merging logic inMergeCustomObjectIntoOrderedDictionarywas updated to enforce this rule for both direct and conditional settings, and to ensure that array settings are always merged. [1] [2] [3] [4]Schema and documentation updates:
settings.schema.jsonto add theimportantSettingsproperty and clarified the behavior ofoverwriteSettingswhen important settings are involved. [1] [2] [3] [4]importantSettingsinRELEASENOTES.mdandScenarios/settings.md. [1] [2]Other improvements:
importantSettingsto the default settings returned byGetDefaultSettings.These changes make it easier to enforce organization- or repository-level settings and prevent accidental overrides from lower-priority sources, while maintaining flexibility for advanced scenarios.
Use Case
We want to define conditionalSetting for different buildModes as ALGoOrgSettings as we need them in many Repos.
For example we have one BuildMode for MinVersion Validation:
{ "ConditionalSettings": [ { "buildModes": [ "minversion" ], "settings": { "artifact": "/sandbox/*//first", "nuGetFeedSelectMode": "EarliestMatching" } } ] }if we add the buildMode to any workflow in the repo/project the artifact get overwritten by the repo/project setting.
If we define the artifact setting in conditional setting as important, this overwrite wouldnt happen.
Related to issue: #
✅ Checklist