Skip to content

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

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

Ole Wunschmann (OleWunschmann) wants to merge 84 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.

🔵 Needs a closer look

Cross-platform path resolution and destructive file-operation safeguards warrant final human validation.

3 open findings
1 resolved since last review

🧠 Review effort: Balanced

Comment thread RELEASENOTES.md Resolved
Comment thread Scenarios/CustomizingALGoForGitHub.md Resolved
Enhance file resolution and destination renaming features in AL-Go template. Introduce safety measures for updates and removals involving symlinks.

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.

🔵 Needs a closer look

Cross-platform symlink and junction handling around destructive file operations warrants human validation.

1 open finding
2 resolved since last review

🧠 Review effort: Balanced

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

Cross-platform path validation and file-removal changes need human verification, and project-path handling and dependency-depth calculation still require fixes.

2 open issues
1 resolved since last review

Review effort: Balanced

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

Project dependency analysis still reloads stale template settings, which can generate too few sequential build jobs.

No open issues 🎉

2 resolved since last review

Review effort: Balanced

@OleWunschmann

Copy link
Copy Markdown
Contributor Author

🔵 Needs a closer look

Project dependency analysis still reloads stale template settings, which can generate too few sequential build jobs.

No open issues 🎉

2 resolved since last review

Review effort: Balanced

Fixed with 553f998 by reworking the snapshot handling for custom templates.

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 Linux scenario still asserts the original Windows workflow content after applying Ubuntu/pwsh settings, causing it to fail before the consumer-repository checks.

No open issues 🎉

Review effort: Balanced

@OleWunschmann

Ole Wunschmann (OleWunschmann) commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor Author

🔵 Needs a closer look

The Linux scenario still asserts the original Windows workflow content after applying Ubuntu/pwsh settings, causing it to fail before the consumer-repository checks.

No open issues 🎉

Review effort: Balanced

I ran the custom template e2e test for Linux and for Windows, and they were successful.

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 prerequisite documentation references a nonexistent function, and the PR description claims symlink/junction paths are skipped when they actually abort the run.

2 open issues

Review effort: Balanced

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.

🔵 Needs a closer look

Human assessment is needed because an unpublished finding identifies a path-validation gap that leaves symlink- or junction-redirected removal destinations unchecked during check-only updates.

1 open issue
1 resolved since last review

Review effort: Balanced

@OleWunschmann

Copy link
Copy Markdown
Contributor Author

🔵 Needs a closer look

Human assessment is needed because an unpublished finding identifies a path-validation gap that leaves symlink- or junction-redirected removal destinations unchecked during check-only updates.

1 open issue

1 resolved since last review

Review effort: Balanced

Fixed the PR description. Removal candidates are only listed during checks; their paths are validated immediately before deletion in the new clone. No additional assertion is needed here.

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

Excluded removal destinations bypass physical-path validation during update checks, allowing symlink-redirected paths to be reported as pending removals instead of failing as documented.

1 open issue
1 resolved since last review

Review effort: Balanced

Add assertion to check physical equality of destination files.

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.

🔵 Needs a closer look

The resolver defines a cross-platform security boundary whose fail-closed behavior with Windows junctions and PowerShell 5.1 requires native runtime validation beyond static review.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

@OleWunschmann

Copy link
Copy Markdown
Contributor Author

🔵 Needs a closer look

The resolver defines a cross-platform security boundary whose fail-closed behavior with Windows junctions and PowerShell 5.1 requires native runtime validation beyond static review.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

Matching tests exist and will be run by the workflows.

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.

🟢 Approval recommended

No active review issues remain for the custom-template file update changes.

No open issues 🎉

Review effort: Balanced

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