Repository navigation
Improve file handling in Update AL-Go System Files - #2273
Ole Wunschmann (OleWunschmann) wants to merge 101 commits into
Conversation
There was a problem hiding this comment.
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.filesToRemovesupport end-to-end (schema, defaults, resolution logic, docs, and release notes). - Update
CheckForUpdatesto read template repo settings viaReadSettingsand 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. |
|
Maria Zhelezova (@mazhelez) The failing PS5 tests should be fixed now. |
There was a problem hiding this comment.
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. AfilesToRemoveentry with a matching template file anddestinationFolder = '..'produces adestinationFullPathoutside the repository;CheckForUpdates.ps1later converts it to a relative path and passes it toRemove-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)
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. |
There was a problem hiding this comment.
🟡 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) |
There was a problem hiding this comment.
I agree.
There was a problem hiding this comment.
🟡 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
There was a problem hiding this comment.
🔵 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
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. |
|
There was a problem hiding this comment.
🟡 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
There was a problem hiding this comment.
🔵 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. |
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
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 |
| @@ -1,3 +1,16 @@ | |||
| ### Improved file handling in Update AL-Go System Files | |||
There was a problem hiding this comment.
A new version of AL-Go (v10.1) has been released.
Please move your release notes changes to above the ## v10.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.
There was a problem hiding this comment.
Done
| "type": "object", | ||
| "properties": { | ||
| "filesToInclude": { | ||
| "description": "An array of file specifications to include in the update. Files that match these specifications are copied from the template to the repository. When used in a custom template's settings, inclusions are also propagated from the original template to consumer repos even if the files no longer exist in the custom template.", |
| When using a custom template repository, `filesToInclude` also resolves files from the **original** AL-Go template (i.e. the official [AL-Go-PTE](https://github.com/microsoft/AL-Go-PTE) or [AL-Go-AppSource](https://github.com/microsoft/AL-Go-AppSource) template). This means files present in the official AL-Go template that are not overridden by your custom template are still propagated to consumer repositories. When a file exists in both the original template and your custom template, how the file's **content** is resolved depends on the file's type: | ||
|
|
||
| - **Workflow files** (`.github/workflows/*.yaml`/`*.yml`): the content is based on the original template's file, with customizations from your custom template's copy (see [Adding custom jobs](#adding-custom-jobs)) re-applied on top. | ||
| - **Settings files**: if the destination file already exists, its settings are preserved and only its `$schema` is updated from the original template. If it does not exist, the original template's settings are used. Current custom template repository settings are also read when updating workflows. | ||
| - **All other files** (e.g. PowerShell scripts, `.copy.md`, `.agent.md`): the original template's file content is used as-is; changes made to that same file in your custom template are not applied in this case. | ||
|
|
||
| The following table summarizes how `filesToInclude` resolves files when a custom template is in use: | ||
|
|
||
| | File is present in original template | File is present in custom template | File is matched by `filesToInclude` | Result | | ||
| |---|---|---|---| | ||
| | Yes | No | Yes | File from **original template** is propagated | | ||
| | No | Yes | Yes | File from **custom template** is propagated | | ||
| | Yes | Yes | Yes | File from **original template** is propagated; for Workflow files, customizations from the **custom template** are also applied | |



What, Why & How
Custom-template
customALGoFilessettings 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:
destinationNametofilesToIncludeto copy a file under a different name.Migration note: Changing
destinationNamedoes 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