Add support for importantSettings to override lower priority settings#2293
Draft
ChrisBlankDe wants to merge 2 commits into
Draft
Add support for importantSettings to override lower priority settings#2293ChrisBlankDe wants to merge 2 commits into
ChrisBlankDe wants to merge 2 commits into
Conversation
Contributor
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. |
Comment on lines
+513
to
+519
| $importantAtThisLevel = @() | ||
| $importantRef = [ref]$importantAtThisLevel | ||
| MergeCustomObjectIntoOrderedDictionary -dst $settings -src $settingsJson -importantSettingsFromHigherPriority $currentImportantSettings -importantSettingsAtThisLevel $importantRef | ||
| # Only update currentImportantSettings if this level explicitly defined importantSettings (not null) | ||
| if ($null -ne $importantAtThisLevel) { | ||
| $currentImportantSettings = $importantAtThisLevel | ||
| } |
Comment on lines
+541
to
+547
| $importantAtThisLevel = @() | ||
| $importantRef = [ref]$importantAtThisLevel | ||
| MergeCustomObjectIntoOrderedDictionary -dst $settings -src $conditionalSetting.settings -importantSettingsFromHigherPriority $currentImportantSettings -importantSettingsAtThisLevel $importantRef | ||
| # Only update currentImportantSettings if conditional settings explicitly defined importantSettings | ||
| if ($null -ne $importantAtThisLevel) { | ||
| $currentImportantSettings = $importantAtThisLevel | ||
| } |
| Remove-Item -Path $tempName -Recurse -Force | ||
| } | ||
|
|
||
| It 'Normal settings from higher priority level override important settings from lower priority' { |
| Remove-Item -Path $tempName -Recurse -Force | ||
| } | ||
|
|
||
| It 'ConditionalSetting with importantSettings at org level overrides project setting for specific buildMode' { |
Comment on lines
+321
to
+323
| By default, AL-Go follows a standard settings hierarchy where settings from higher priority levels (closer to deployment) override settings from lower priority levels. However, you can mark specific settings as **important** to protect them from being overridden by lower priority settings using the `importantSettings` array. | ||
|
|
||
| When a setting is marked as important at a higher level in the hierarchy, it cannot be overridden by settings from lower priority levels. This is useful for enforcing organizational or repository-wide policies that should not be changed at the project or workflow level. |
| @@ -1,3 +1,37 @@ | |||
| ### Important settings protection | |||
|
|
|||
| A new `importantSettings` setting allows you to protect specific settings from being overridden by lower-priority sources in the settings hierarchy. When a setting is marked as important at a higher priority level, it cannot be overridden by non-important settings from lower priority sources. | |||
| "type": "string" | ||
| }, | ||
| "default": [], | ||
| "description": "An array of setting names that should take precedence over normal inheritance hierarchy. Settings listed here will override settings from lower priority sources. See https://aka.ms/ALGoSettings#importantSettings" |
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.
❔What, Why & How
This pull request introduces a new
importantSettingsfeature to the settings merging mechanism, allowing specific settings to be protected from being overridden by lower-priority sources. The implementation includes schema updates, code changes to handle the new logic, and documentation updates to explain the behavior and provide usage examples.Important settings protection and merging logic:
importantSettingsarray in settings files, which lists setting names that should be protected from being overridden by lower-priority sources. When a setting is marked as important at a higher priority, it cannot be overridden by non-important settings from lower levels. Arrays marked as important are still merged unlessoverwriteSettingsis used. [1] [2] [3] [4] [5]Schema and defaults:
settings.schema.jsonto define theimportantSettingsproperty, including type, default value, and documentation.importantSettingsin the default settings object.Documentation:
importantSettingsfeature inRELEASENOTES.md, describing its behavior, use cases, and examples, including interaction withConditionalSettings.settings.mdwith detailed explanations and examples of howimportantSettingsaffects the settings hierarchy and merging, including edge cases and limitations.Related to issue: #
✅ Checklist