Skip to content

Add support for importantSettings to override lower priority settings#2293

Draft
ChrisBlankDe wants to merge 2 commits into
microsoft:mainfrom
ChrisBlankDe:importantSettings
Draft

Add support for importantSettings to override lower priority settings#2293
ChrisBlankDe wants to merge 2 commits into
microsoft:mainfrom
ChrisBlankDe:importantSettings

Conversation

@ChrisBlankDe

Copy link
Copy Markdown
Contributor

❔What, Why & How

This pull request introduces a new importantSettings feature 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:

  • Added support for an importantSettings array 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 unless overwriteSettings is used. [1] [2] [3] [4] [5]

Schema and defaults:

  • Updated settings.schema.json to define the importantSettings property, including type, default value, and documentation.
  • Set a default empty array for importantSettings in the default settings object.

Documentation:

  • Documented the new importantSettings feature in RELEASENOTES.md, describing its behavior, use cases, and examples, including interaction with ConditionalSettings.
  • Expanded settings.md with detailed explanations and examples of how importantSettings affects the settings hierarchy and merging, including edge cases and limitations.

Related to issue: #

✅ Checklist

  • Add tests (E2E, unit tests)
  • Update RELEASENOTES.md
  • Update documentation (e.g. for new settings or scenarios)
  • Add telemetry

@ChrisBlankDe ChrisBlankDe marked this pull request as ready for review June 26, 2026 13:53
@ChrisBlankDe ChrisBlankDe requested a review from a team as a code owner June 26, 2026 13:53
Copilot AI review requested due to automatic review settings June 26, 2026 13:53

Copilot AI 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.

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 importantSettings list 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 thread Scenarios/settings.md
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.
Comment thread RELEASENOTES.md
@@ -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"
@ChrisBlankDe ChrisBlankDe marked this pull request as draft June 26, 2026 14:20
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