Make failOn: newWarning work with workspace compilation#2300
Open
aholstrup1 wants to merge 7 commits into
Open
Make failOn: newWarning work with workspace compilation#2300aholstrup1 wants to merge 7 commits into
aholstrup1 wants to merge 7 commits into
Conversation
The failOn:newWarning check only ran in RunPipeline, so it had no effect when workspaceCompilation was enabled (compilation happens in CompileApps there). Move CheckForWarningsUtils to .Modules, call Test-ForNewWarnings from CompileApps, and preserve the compiler BuildOutput.txt by not letting Run-AlPipeline delete it in workspace mode. Adds Pester tests.
Get-Warnings only matched the container GitHub-annotation format (::warning file=...::). Workspace compilation writes raw AL compiler output (<file>(<line>,<col>): warning <Id>: <desc>) to BuildOutput.txt, so new warnings were never detected under workspace compilation. Parse both formats. Adds Pester coverage.
Some AL diagnostics (e.g. AL0523) embed a referenced app's version in the warning message. AL-Go stamps build/revision from the run number, so the version differs between the baseline and PR builds, making an unchanged warning look new. Normalize 4-part version numbers in the description before comparing (keeping Id, File, Col). Adds a Pester test for the version-churn case.
Collapse the workspace-mode buildOutputFile guard in RunPipeline to a single assignment, and de-duplicate the two identical Get-Warnings branches into one body driven by a list of patterns. No behavior change; tests unchanged.
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request makes the failOn: newWarning policy effective when workspaceCompilation is enabled by running the new-warning comparison at the point where compiler output is actually produced, and by improving warning parsing/normalization so baseline-vs-PR comparisons are stable.
Changes:
- Run
Test-ForNewWarningsfromCompileAppsin workspace compilation mode, and skip the check inRunPipelineto avoid double execution. - Preserve
BuildOutput.txtin workspace mode by preventingRun-AlPipelinefrom deleting it at startup. - Extend warning detection to parse both GitHub Actions annotation warnings and raw AL compiler warnings, and normalize embedded 4-part version numbers to reduce false “new warning” detections.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| Tests/CheckForWarningsUtils.Test.ps1 | Adds Pester coverage for both warning formats, new/removed warning comparisons, and version normalization. |
| RELEASENOTES.md | Documents that failOn: newWarning now works with workspace compilation and describes the parsing/normalization improvements. |
| Actions/RunPipeline/RunPipeline.ps1 | Avoids deleting workspace-produced BuildOutput.txt and skips the new-warning check when workspace compilation is enabled. |
| Actions/CompileApps/Compile.ps1 | Invokes Test-ForNewWarnings after workspace compilation to enforce failOn: newWarning where warnings are generated. |
| Actions/.Modules/CheckForWarningsUtils.psm1 | Adds warning-format parsing support for workspace output and normalizes volatile version strings before comparison. |
…pork # Conflicts: # RELEASENOTES.md
Normalize path separators when parsing warnings so the same warning matches across container (forward slash) and workspace (backslash) compilation formats, avoiding false new-warning hits when a project switches compilation mode. Add direct tests for Get-NormalizedWarningDescription, a cross-format regression test, and Description assertions in the parser tests.
spetersenms
approved these changes
Jul 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The
failOn: newWarningsetting fails a pull request when it introduces new AL compiler warnings, compared against the last successful build of the target branch. It only ever worked for container / compiler-folder builds. WithworkspaceCompilationenabled it silently did nothing, so repositories using workspace compilation (including BCApps) had no protection against newly introduced warnings.What changed
The root cause was that the new-warning check (
Test-ForNewWarnings) only ran in theRunPipelineaction, but with workspace compilation the apps are compiled by the separateCompileAppsaction andRunPipelineruns against prebuilt apps.Test-ForNewWarningsis now invoked fromCompileAppswhen workspace compilation is enabled, andRunPipelineskips it in that mode to avoid a double run.CheckForWarningsUtils.psm1moved fromActions/RunPipeline/toActions/.Modules/since it is now shared.Run-AlPipelinedeletes itsbuildOutputFileat startup (unconditionally, before it looks at whether anything needs building). In workspace mode that file is the compiler output written byCompileAppsand contains the warnings, soRunPipelinenow passes an emptybuildOutputFileto keep it intact for the uploaded build-output artifact that future PRs compare against.Two robustness issues surfaced while validating this against BCApps and are fixed here too:
File(line,col): warning ID: description) rather than the GitHub Actions annotation format (::warning file=...::). The parser now handles both, so warnings are actually detected under workspace compilation.AL0523) embed a referenced app's version in the message. AL-Go stamps build/revision from the run number, so that version differs between the baseline and PR builds and made unchanged warnings look new. Four-part version numbers are now normalized before comparison, while the original description is still shown in the error annotation.Testing
Added Pester coverage in
Tests/CheckForWarningsUtils.Test.ps1for both warning formats, the new-vs-removed warning cases, the version-normalization case, and the pull-request/failOnguards.Validated end to end on a real multi-project repo (microsoft/BCApps, workspace compilation enabled): a PR that introduces one unused-variable warning fails with "New warnings were introduced" via the
CompileAppspath, while projects whose only diff was version-churn in warning text pass instead of failing falsely.Note for reviewers
There is a one-time transition effect: the first PRs after this merges compare against baseline artifacts produced by the previous code, so for workspace publishing projects those baselines may be warning-less until
mainis rebuilt once. It self-heals after the next successfulmainbuild.