Skip to content

Add support for importantSettings to override lower priority settings#2293

Open
ChrisBlankDe wants to merge 7 commits into
microsoft:mainfrom
ChrisBlankDe:importantSettings
Open

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

Conversation

@ChrisBlankDe

@ChrisBlankDe ChrisBlankDe commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

❔What, Why & How

This pull request introduces a new importantSettings mechanism 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 existing overwriteSettings mechanism. Documentation and schema files are updated to reflect this new feature.

Important settings protection:

  • Added support for an importantSettings array in settings files, enabling top-level settings to be protected from non-important overrides by lower-priority sources. The merging logic in MergeCustomObjectIntoOrderedDictionary was 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:

  • Updated settings.schema.json to add the importantSettings property and clarified the behavior of overwriteSettings when important settings are involved. [1] [2] [3] [4]
  • Added detailed explanations, examples, and usage notes for importantSettings in RELEASENOTES.md and Scenarios/settings.md. [1] [2]

Other improvements:

  • Added importantSettings to the default settings returned by GetDefaultSettings.
  • Minor parameter and comment cleanups for consistency in PowerShell scripts. [1] [2] [3] [4]

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

  • 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 thread Actions/.Modules/ReadSettings.psm1 Outdated
Comment thread Actions/.Modules/ReadSettings.psm1 Outdated
Comment thread Tests/ReadSettings.Test.ps1 Outdated
Comment thread Tests/ReadSettings.Test.ps1 Outdated
Comment thread Scenarios/settings.md Outdated
Comment thread RELEASENOTES.md
Comment thread Actions/.Modules/settings.schema.json Outdated
@ChrisBlankDe ChrisBlankDe marked this pull request as draft June 26, 2026 14:20

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

Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.

Comment thread Actions/.Modules/ReadSettings.psm1
Comment thread Actions/.Modules/ReadSettings.psm1
Comment thread Actions/.Modules/ReadSettings.psm1
Comment thread Actions/.Modules/ReadSettings.psm1
Comment thread Tests/ReadSettings.Test.ps1 Outdated
Comment thread Tests/ReadSettings.Test.ps1
@ChrisBlankDe ChrisBlankDe marked this pull request as ready for review June 29, 2026 13:34
@mazhelez

mazhelez commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

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.
In AL-Go, project settings are higher in priority than org settings, for example.

For now, I can't tell I like importantSettings because it might mean a lot of things. How about preventOverwrite, or protectedSettings?

@ChrisBlankDe

Copy link
Copy Markdown
Contributor Author

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 preventOverwrite since overwritting is still possible, if the overwriting source is also defined as important. And we already use that name for a special meachanism in handling AL-Go Settings.

Think about what you'd like to call it, and I'll be happy to change it.
In the end, the feature is what matters to me, not the name.

Comment thread RELEASENOTES.md
@@ -1,3 +1,37 @@
### Important settings protection

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.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Comment thread RELEASENOTES.md
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.

4 participants