Skip to content

Improve file handling in Update AL-Go System Files - #2273

Open
Ole Wunschmann (OleWunschmann) wants to merge 96 commits into
microsoft:mainfrom
OleWunschmann:enhance-customALGoFiles-feature
Open

Ole Wunschmann (OleWunschmann) wants to merge 96 commits into
microsoft:mainfrom
OleWunschmann:enhance-customALGoFiles-feature

Conversation

@OleWunschmann

@OleWunschmann Ole Wunschmann (OleWunschmann) commented Jun 3, 2026 •

Copy link
Copy Markdown
Contributor

What, Why & How

Custom-template customALGoFiles settings previously took effect in consumer repositories only after a later update. Also, files present in the original AL-Go template but absent from the custom template were not selected for propagation.

This PR makes Update AL-Go System Files read the custom template’s current settings during the same run. These settings are used for file selection, workflow customization, and dependency-depth calculation, rather than taking effect only on the next update.

Include and exclude rules are now resolved against both the custom template and the original AL-Go template. For example, a custom template may not contain the Power Platform workflows available in the original template. When a PTE consumer repository enables a Power Platform solution, those workflows can now be propagated from the original template. Custom-template exclusions can likewise prevent original-template files from being propagated.

The update also:

  • Adds destinationName to filesToInclude to copy a file under a different name.
  • Resolves destination collisions by keeping the first eligible match. Custom-template matches are considered before original-only matches; within each template, default rules precede configured rules.
  • Rejects paths redirected through symlinks or junctions, causing update checks and updates to fail with an error.

Migration note: Changing destinationName does not remove the previously propagated filename. Remove that file manually if it is no longer needed.

See the updated custom template documentation and release notes.

Related to #2227.

Checklist

  • Add unit and end-to-end tests
  • Update documentation and settings schema
  • Update release notes
  • Add telemetry

Copilot AI review requested due to automatic review settings June 3, 2026 15:24
@OleWunschmann
Ole Wunschmann (OleWunschmann) requested a review from a team as a code owner June 3, 2026 15:24

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

Note

Copilot was unable to run its full agentic suite in this review.

This PR enhances the customALGoFiles behavior during “Update AL-Go System Files”, adding support for unconditional removals (filesToRemove) and improving custom-template behavior by merging template settings directly and resolving files from the original AL-Go template where applicable.

Changes:

  • Add customALGoFiles.filesToRemove support end-to-end (schema, defaults, resolution logic, docs, and release notes).
  • Update CheckForUpdates to read template repo settings via ReadSettings and merge template settings during file resolution.
  • Expand automated coverage (unit + e2e) for include/exclude/remove resolution and custom-template propagation.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
e2eTests/scenarios/CustomTemplate/runtest.ps1 Extends e2e scenario to validate custom-template file include/exclude/remove propagation and workflow presence.
Tests/CheckForUpdates.Action.Test.ps1 Adds unit tests for destination-folder resolution and expanded GetFilesToUpdate behaviors (including filesToRemove).
Actions/CheckForUpdates/CheckForUpdates.ps1 Updates settings reading (incl. trigger) and wires template settings + filesToRemove into update/removal flow.
Actions/CheckForUpdates/CheckForUpdates.HelperFunctions.ps1 Implements ResolveFilePathsInDestinationFolder and extends GetFilesToUpdate to produce include/exclude/remove lists.
Actions/.Modules/settings.schema.json Extends settings schema with customALGoFiles.filesToRemove and clarifying descriptions.
Actions/.Modules/ReadSettings.psm1 Adds default filesToRemove array under customALGoFiles.
Scenarios/settings.md Documents customALGoFiles.filesToRemove in settings reference.
Scenarios/CustomizingALGoForGitHub.md Adds conceptual docs + examples for original-template resolution and filesToRemove.
RELEASENOTES.md Documents enhanced customALGoFiles behavior and new filesToRemove.

Comment thread Tests/CheckForUpdates.Action.Test.ps1 Resolved
Comment thread Tests/CheckForUpdates.Action.Test.ps1 Resolved

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 9 out of 9 changed files in this pull request and generated 3 comments.

Comment thread Scenarios/CustomizingALGoForGitHub.md Resolved
Comment thread Actions/.Modules/settings.schema.json Resolved
@OleWunschmann

Copy link
Copy Markdown
Contributor Author

Maria Zhelezova (@mazhelez) The failing PS5 tests should be fixed now.

Comment thread RELEASENOTES.md Resolved
Comment thread RELEASENOTES.md Resolved
Copilot AI review requested due to automatic review settings July 21, 2026 09:45

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 9 out of 9 changed files in this pull request and generated 3 comments.

Comments suppressed due to low confidence (1)

Actions/CheckForUpdates/CheckForUpdates.HelperFunctions.ps1:1205

  • Removal destinations are not constrained to $baseFolder. A filesToRemove entry with a matching template file and destinationFolder = '..' produces a destinationFullPath outside the repository; CheckForUpdates.ps1 later converts it to a relative path and passes it to Remove-Item. Normalize every removal destination and reject paths that are not descendants of the repository root before returning this list.
        $filesToRemove += @(ResolveFilePaths -sourceFolder $originalTemplateFolder -destinationFolder $baseFolder -files $filesToRemoveUnresolved -projects $projects)
    }
    $filesToRemove += @(ResolveFilePaths -sourceFolder $templateFolder -originalSourceFolder $originalTemplateFolder -destinationFolder $baseFolder -files $filesToRemoveUnresolved -projects $projects)
    $filesToRemove += @(ResolveFilePathsInDestinationFolder -destinationFolder $baseFolder -files $filesToRemoveUnresolved -projects $projects)

Comment thread Scenarios/CustomizingALGoForGitHub.md Resolved

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.

🟡 Changes recommended

The exclusion tooltip omits potential destination-file deletion, and the release notes omit that an empty trigger prevents trigger-based ConditionalSettings from affecting file selection or workflow generation.

2 open issues

Review effort: Max

Comment thread Actions/.Modules/settings.schema.json Resolved
Comment thread RELEASENOTES.md Resolved

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.

🟡 Changes recommended

Unresolved critical issues permit out-of-workspace settings reads, produce incorrect build depths from stale or context-dependent settings, and mishandle renamed workflows or overwrite consumer settings.

6 open issues
2 resolved since last review

Review effort: Max

Comment thread RELEASENOTES.md Resolved
Enhance AL-Go System Files to utilize latest repository settings from a custom template, ensuring proper workflow dependency depth and file inclusion/exclusion rules. Introduce breaking change for standard workflows/scripts in consumer repositories.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

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.

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.

🔵 Needs a closer look

The update check reads and applies settings through unvalidated symlinks, allowing files outside the workspace to influence configuration.

No open issues 🎉

3 resolved since last review

Review effort: Max

@OleWunschmann

Copy link
Copy Markdown
Contributor Author

🔵 Needs a closer look

The update check reads and applies settings through unvalidated symlinks, allowing files outside the workspace to influence configuration.

No open issues 🎉

3 resolved since last review

Review effort: Max

This PR validates source content reads and destination writes/removals during update processing. Extending validation to earlier settings loading would broaden that scope and is intentionally left unchanged. The release notes now clarify this boundary.

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.

🟡 Changes recommended

Critical path-validation gaps allow symlinked settings to be read before validation and redirected template roots to be trusted, permitting settings outside the workspace to influence updates.

3 open issues

Review effort: Max


# Apply unusedALGoSystemFiles logic
$unusedALGoSystemFiles = $settings.unusedALGoSystemFiles
$unusedALGoSystemFileNames = [System.Collections.Generic.HashSet[string]]::new($pathComparer)

@OleWunschmann Ole Wunschmann (OleWunschmann) Nov 11, 2026 •

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.

I agree.

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 by 1e9e5cd

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.

🟡 Changes recommended

Unresolved path-handling flaws can read settings outside the workspace or overwrite existing settings, while dependency-depth and workflow-processing defects can break CI.

4 open issues
2 resolved since last review

Review effort: Max

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.

🔵 Needs a closer look

Unresolved update defects can preserve stale settings, underestimate build depth, delete consumer files through unvalidated symlinked exclusions, and bypass required processing for renamed files.

1 open issue
3 resolved since last review

Review effort: Max

@OleWunschmann

Copy link
Copy Markdown
Contributor Author

nresolved update defects can preserve stale settings, underestimate build depth, delete consumer files through unvalidated symlinked exclusions, and bypass required processing for renamed files.

The only listed open issue was fixed in 1e9e5cd, restoring case-insensitive matching for unusedALGoSystemFiles. The introductory summary does not match the listed findings. Previously discussed limitations and scope decisions remain documented in their respective threads.

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.

🟡 Changes recommended

Critical path-validation gaps allow settings reads outside the repository and consumer-file deletions based on unchecked template sources.

3 open issues

Review effort: Max

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.

🟡 Changes recommended

Unresolved critical defects can generate workflows with insufficient dependency depth and allow unvalidated symlinked settings to influence updates.

2 open issues
2 resolved since last review

Review effort: Max

@OleWunschmann

Copy link
Copy Markdown
Contributor Author

🟡 Changes recommended

Unresolved critical defects can generate workflows with insufficient dependency depth and allow unvalidated symlinked settings to influence updates.

2 open issues

2 resolved since last review

Review effort: Max

Medium severity Keep unused system-file matching case-insensitive was already addressed an fixed?

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.

🟡 Changes recommended

Unvalidated symlinks can supply external update settings, the Linux end-to-end scenario fails, and inconsistent dependency settings or stale snapshots can produce incorrect workflows.

4 open issues
1 resolved since last review

Review effort: Max

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.

🔵 Needs a closer look

Unresolved critical defects can generate insufficient build depth, retain removed template settings, delete case-distinct Linux files, and read or act on unvalidated symlinked paths.

1 open issue
3 resolved since last review

Review effort: Max

@OleWunschmann

Copy link
Copy Markdown
Contributor Author

🔵 Needs a closer look

Unresolved critical defects can generate insufficient build depth, retain removed template settings, delete case-distinct Linux files, and read or act on unvalidated symlinked paths.

1 open issue

3 resolved since last review

Review effort: Max

All mentioned issues have already been addressed in the corresponding review comments.

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.

🟡 Changes recommended

Settings reads can follow unchecked symlinks outside the workspace, while dependency-context, stale-snapshot, and workflow-customization defects can generate workflows that fail builds.

2 open issues

Review effort: Max

Comment thread Actions/.Modules/settings.schema.json Resolved
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@OleWunschmann

Copy link
Copy Markdown
Contributor Author

🟡 Changes recommended

Settings reads can follow unchecked symlinks outside the workspace, while dependency-context, stale-snapshot, and workflow-customization defects can generate workflows that fail builds.

2 open issues

Review effort: Max

The broader concerns in this review summary are acknowledged limitations already discussed and explicitly deferred in resolved threads:

“Keep unused system-file matching case-insensitive” is already fixed in 1e9e5cd, which restored the legacy -contains / -notcontains comparisons.

Maria Zhelezova (@mazhelez) spetersenms Alexander Holstrup (@aholstrup1) FYI

This branch has not been deployed

No deployments
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.

7 participants