Repository navigation
CI: Match Known Build Error message arrays on ordered lines - #39231
Conversation
Preserve literal ErrorMessage arrays instead of joining their expressions into a contiguous scalar substring. Require ordered matches on distinct subsequent lines in the same failure text and warn when skipping invalid arrays. Preserve scalar, regex, text-limit, selection, and attribution behavior. Add 25 loader-to-matcher regression cases and document the bounded public Build Analysis contract. All 215 collector cases pass; current-main red/green checks reproduce 16 expected failures and nine controls before the fix. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 876ad450-5f81-4c61-8ec7-e54600c51004
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 39231Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 39231" |
|
Azure Pipelines: 1 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
Note
This error may be related to your runner configuration. You can now configure runners for Copilot code review separately from Copilot cloud agent by creating a copilot-code-review.yml file with your setup steps. Read the docs for details.
This comment has been minimized.
This comment has been minimized.
|
/azp run |
|
Azure Pipelines: 3 pipeline(s) were filtered out due to trigger conditions. |
|
Note 🔍
|
Evaluate literal ErrorMessage arrays against each actual failure occurrence instead of messages aggregated across occurrences of the same test and platform. Keep scalar and regex aggregation, the 20000-character cap per text, pattern-first selection, and attribution gates unchanged. Add same-test split-occurrence regression coverage through production deduplication and the actual cross-reference path, plus complete-occurrence, alias, empty-evidence, ordering, scalar/regex, and text-limit controls. All 38 KBE cases and 228 collector cases pass; four new cases reproduce unsupported hints on the prior PR head. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 876ad450-5f81-4c61-8ec7-e54600c51004
Skill Validation Results
|
There was a problem hiding this comment.
🟡 Changes recommended
Occurrence matching omits separately stored stack traces, so stack-frame arrays such as issue #36435 still fail at the production call site.
1 open finding
🧠 Review effort: Balanced
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Append each occurrence’s separately captured stackTrace only to its literal-array matching text. Keep aggregate scalar/regex behavior unchanged and cover real deduplication and cross-reference paths, isolation, and text limits. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 876ad450-5f81-4c61-8ec7-e54600c51004
This comment has been minimized.
This comment has been minimized.
|
/azp run |
|
Note 🔍
|
|
Azure Pipelines: 3 pipeline(s) were filtered out due to trigger conditions. |
MauiBot
left a comment
There was a problem hiding this comment.
AI Review Summary
@PureWeen — new AI review results are available based on commit
6379c58.
🗂️ Review Sessions — click to expand
🚦 Gate — Test Before & After Fix
Gate Result: ⚠️ SKIPPED
No tests were detected in this PR.
Recommendation: Add tests to verify the fix using the write-tests-agent.
📋 Pre-Flight — Context & Validation
Pre-Flight Context
Scope/evidence boundary: Context only for #39231, using submitted GitHub metadata, the immutable diff, relevant source at base 84b1fb39ad56e22a51d29d4bbf141b03b02e4648 and head 6379c58d9da3d5ba086d7f1a3379913677b82c93, #36435, and the pinned Arcade Known Issues contract. No commands, tests, edits, review workflow, or alternative analysis were performed. This is not an exhaustive review or recommendation.
Reported problem
The local /review tests Known Build Error matcher previously coerced an ErrorMessage array to a single string and searched for one contiguous substring. That diverges from Arcade’s documented array contract: array entries are ordered AND conditions, each matching a separate line, with later entries searched on subsequent lines. The old behavior could therefore:
- Miss a valid multiline stack-frame signature.
- Incorrectly match expressions concatenated on one line.
- Combine partial evidence from separate occurrences after failures with the same test name and platform were deduplicated.
The historical fixture is #36435, whose two literals identify an Essentials FileSystem_Tests stack on iOS and MacCatalyst. That issue remains open, but its comments report the product failure stopped reproducing after #36121 and recommend closure; it is therefore historical evidence rather than a currently reproducible test case.
Changed files and mechanism
The PR changes three infrastructure files, with 405 additions and 14 deletions overall:
-
.github/skills/review-test-failures/scripts/Gather-TestFailureContext.ps1- Preserves valid literal
ErrorMessagearrays instead of casting them to a scalar. - Rejects empty arrays or arrays containing null, blank, non-string, or nested values, emitting a warning rather than weakening the rule.
- Extends
Test-KnownIssueMatchwith occurrence-local texts. - For arrays, splits LF, CRLF, or CR lines and requires each case-insensitive literal in order on a distinct later line.
- Keeps the pattern loop outermost, preserving first-matching-rule selection.
- Builds each occurrence’s array-matching text from that occurrence’s test name,
message/errorMessage, and separately capturedstackTrace. - Retains the 20,000-character cap independently for each occurrence.
- Leaves scalar and regex matching on the existing aggregated test-name/message text; stack traces are not added to those paths.
- Leaves final attribution gates unchanged; the submitted code and documentation characterize
matchesKnownIssueas a hint rather than causal proof.
- Preserves valid literal
-
.github/skills/review-test-failures/scripts/Gather-TestFailureContext.Tests.ps1- AST-extracts the affected functions and actual cross-reference assignments while mocking issue transport.
- Adds submitted cases for line endings, ordering, repeated expressions, literal regex characters, invalid arrays, text limits, first-rule selection, cross-test and cross-occurrence isolation, aliases, stack-trace-only evidence, and unchanged scalar/regex behavior.
- Exercises production deduplication and uses synthetic
platform = 'Android'records in relevant occurrence tests.
-
.github/docs/maui-ci-facts.md- Documents ordered, occurrence-local array matching, separate stack-trace capture, unchanged caps and attribution gates, and the explicit limitation that this local matcher does not establish full Build Analysis/Build Insights parity.
A prior automated review identified that occurrence-local matching omitted the separately stored stackTrace. The latest submitted commit adds it; the review thread is marked resolved, and the subsequent automated review reported no open findings while still noting that live CI and service parity were unverified.
Platform-sensitive paths
- No Android, iOS, MacCatalyst, Windows, handler, or product source files change. The affected path is shared PowerShell CI attribution logic.
- Platform remains part of the deduplication key, so occurrences from different platforms are not grouped together.
- The motivating public fixture, #36435, is iOS/MacCatalyst-specific. It does not provide live Android evidence.
- The added Pester cases include synthetic Android records, but that is parser/call-site coverage rather than an Android device or live AzDO end-to-end validation.
- The requested platform for later testing is Android. Representative Android validation should preserve the actual AzDO separation between
errorMessageandstackTraceand pass through deduplication plus the production cross-reference path.
Validation context and requirements
Gate result:
The PR description reports offline PowerShell 7.4.5/Pester 5.7.1 results of 9 focused stack-trace cases, 47 Known Build Error boundary cases, and 237 collector cases, plus pre-fix failure demonstrations and replay of a saved #36435 response. Those results were not independently verified here.
Later validation should establish:
- Red/green behavior against the immutable base and head for the targeted regressions.
- Ordered distinct-line matching without same-line, reversed, partial, cross-test, cross-platform, or cross-occurrence assembly.
- Matching when literals occur only in one Android occurrence’s stack trace, and when one is in its message and another in its stack trace.
- Preservation of scalar/regex aggregation, first-rule selection, case-insensitive literals, warning behavior, and the 20,000-character boundary.
- No change to downstream attribution without the existing baseline corroboration.
- Whether the Pester suite is automatically discovered and executed in PR CI.
- Ideally, an Android end-to-end gatherer replay or live failure record rather than only synthetic parser fixtures.
Remaining uncertainties
- Live
/review testsbehavior, current check-run status, deployed Build Analysis behavior, and Android end-to-end behavior are unknown. - The public Arcade contract supports arrays for both
ErrorMessageandErrorPattern; this PR intentionally changes only literalErrorMessagearrays. The acceptability of that remaining parity gap requires separate review. - #36435 no longer reproduces according to its comments, so its usefulness is limited to saved historical data.
- No product build, device/UI test, live service match, or CI rerun is established by the submitted evidence.
- Whether all failure producers supply occurrence fields consistently enough for name/message/stack-trace composition remains unverified outside the inspected AzDO test-result path.
- Additional source and discussion may contain context not covered here; no exhaustive correctness assessment was attempted.
🔬 Code Review — Deep Analysis
Code Review — PR #39231
Independent Assessment
What this changes:
- Extends Known Build Error parsing/matching in
.github/skills/review-test-failures/scripts/Gather-TestFailureContext.ps1soErrorMessagearrays are preserved as ordered literal arrays instead of being flattened to one string (Get-KnownBuildIssues, lines 2550-2618). - Adds array-aware matching in
Test-KnownIssueMatchthat requires ordered line-by-line hits inside one occurrence text, while keeping scalar/regex behavior on aggregate text (Test-KnownIssueMatch, lines 2620-2678). - Changes the cross-reference call site to build per-occurrence match text from test name + message/errorMessage + stackTrace and pass that into
-OccurrenceTexts(lines 4646-4654). - Adds extensive Pester coverage for loader→matcher boundary and occurrence-local behavior in
.github/skills/review-test-failures/scripts/Gather-TestFailureContext.Tests.ps1. - Updates
.github/docs/maui-ci-facts.mdto document the new array contract and service-parity caveat (lines 409-417 in head).
Inferred motivation:
Prevent false known-issue attribution when array signatures are split across occurrences or frames, while restoring valid stack-frame array matching from one occurrence.
Reconciliation with PR Narrative
Author claims: array flattening caused misses/false positives; matching must be occurrence-local and include stack trace; scalar/regex behavior should remain unchanged.
Agreement/disagreement: Agrees with code evidence. The implemented matcher and tests align with that scope; I found no contradictory behavior in submitted hunks.
Prior Review Reconciliation
| Prior ❌ Error Finding | Source | Status | Evidence |
|---|---|---|---|
| None found. | n/a | n/a | Prior inline finding was medium-severity stackTrace omission and is now addressed by occurrence text including stackTrace at .github/skills/review-test-failures/scripts/Gather-TestFailureContext.ps1:4652 plus new stack-trace tests in Gather-TestFailureContext.Tests.ps1 (KnownIssueStackTraces block). |
Blast Radius Assessment
- Runs for all instances: No (only
/review testsgather/classification path). - Startup impact: No (scripted CI attribution logic, not product startup/runtime UI path).
- Static/shared state: No new long-lived shared runtime state beyond local function variables.
CI Status
- Required-check result: undetermined (required-set query unavailable in this environment).
- Classification: undetermined/tool-unavailable for
gh pr checks --required(unauthenticated CLI in this run). - Additional observable signal: anonymous commit check-runs show Azure pipeline checks as
neutraland several non-required workflow checks failed/skipped, but this does not establish required-gate pass/fail. - Action taken: confidence capped to low and verdict not LGTM per policy.
Findings
No concrete blocking code defects found in the submitted diff after validation against changed call sites/tests/docs.
Failure-Mode Probing
- If array evidence is split across occurrences of same test/platform, does it still match? No — call site now passes per-occurrence text and tests assert split-occurrence non-match.
- If signatures exist only in stackTrace, can they match? Yes — occurrence text now includes
stackTrace; dedicated tests cover stack-trace-only matching. - Could scalar/regex behavior regress? Tests explicitly keep scalar/regex precedence and aggregated-text behavior unchanged.
- Could invalid arrays silently weaken to partial matching? No — invalid arrays are skipped with warning; they are not downgraded to weaker substring alternatives.
External Output Contract
| Consumer token/pattern | Producer location | Producer emission condition | Consumer assumption | Ordinary negative case | Downstream effect |
|---|---|---|---|---|---|
ErrorMessage array literals from Known Build Error issue JSON |
GitHub issue bodies queried by Invoke-GhJson issue list ... --label "Known Build Error" then parsed in Get-KnownBuildIssues |
Producer emits arrays as JSON values in issue body code blocks; each element is intended as ordered literal evidence lines | Consumer assumes array is ordered AND within a single occurrence text | Array elements present but split across multiple occurrences (or same-line concatenation only) | New matcher refuses match unless ordered lines occur in one occurrence text, preventing over-broad known-issue hinting |
Occurrence-local text (testName + message/errorMessage + stackTrace) |
AzDO result-detail retrieval in Get-AzDoFailedTestResultsByBuild populates message (errorMessage) and stackTrace fields separately (lines ~553-579), then dedup pipeline stores occurrences |
Producer may populate message and stack trace independently per failed result | Consumer assumes both belong to one occurrence and should be searched together for array signatures | Ordinary failed test where message exists but stack frames only in stackTrace |
Now correctly matchable; previous false negative removed; known-issue hinting improved without changing attribution gate conditions |
| Scalar/regex known-issue patterns | Same Known Build Error issue JSON, ErrorPattern or scalar ErrorMessage |
Producer provides regex or scalar literals | Consumer assumes legacy single-text behavior remains | Ordinary single-line failure text | Behavior unchanged (regex/scalar still matched against aggregated text with existing cap/timeout) |
Verdict: NEEDS_DISCUSSION
Confidence: low
Summary: The submitted code changes appear correct and well-covered for the targeted known-issue array matching defect, including occurrence isolation and stack-trace evidence handling. I found no actionable file-level defects in the diff. However, required-check status could not be authoritatively resolved via gh pr checks --required in this environment, so merge-safety confidence is capped low and verdict remains NEEDS_DISCUSSION rather than LGTM.
🛠️ Try-Fix — Analysis & Comparison
Alternative generation: not requested
Evidence-first mode intentionally omits routine Try-Fix attempts. This is not a failed
attempt, a completed alternative search, or evidence that alternatives have no value.
The expert review may still produce one evidence-backed PR refinement.
🏁 Report — Final Recommendation
⚠️ Final Recommendation: REQUEST CHANGES
Phase Status
| Phase | Status | Notes |
|---|---|---|
| Pre-Flight | ✅ COMPLETE | Trusted evidence-first context captured for submitted base 84b1fb39ad56e22a51d29d4bbf141b03b02e4648 and head 6379c58d9da3d5ba086d7f1a3379913677b82c93. |
| Code Review | NEEDS_DISCUSSION (low) | 0 errors, 0 warnings; required-check status remains undetermined. |
| Gate | No tests were detected by Gate; the submitted Pester changes were not independently validated by this run. | |
| Try-Fix | not requested | Evidence-first mode intentionally omitted alternative generation; this is not a failed or exhausted search. |
| Refinement | NOT GENERATED | The expert found no concrete actionable defect or unresolved behavioral mechanism meeting the refinement threshold. |
| Report | ✅ COMPLETE | Compared the only real candidate, the submitted pr. |
Code Review and Candidate Comparison
| Candidate | Evidence | Regression status | Assessment |
|---|---|---|---|
pr |
Expert review found no concrete defect in the submitted diff and found the implementation consistent with its stated scope. | Unknown in this run: Gate was skipped and required-check status could not be resolved. | Selected as the only real candidate, but not demonstrated merge-ready. |
No pr-plus-reviewer patch was implemented, and no try-fix-N candidates exist. The submitted fix therefore wins the comparison by default, not because missing validation was treated as a pass.
Summary
The submitted change appears to correctly preserve literal ErrorMessage arrays, match their elements on ordered distinct lines within one failure occurrence, and include that occurrence's separately captured stack trace without changing scalar/regex attribution behavior. The expert review found no actionable code defect or inline finding. Approval is nevertheless blocked because Gate was skipped and authoritative required-check evidence is unavailable; the expert verdict is consequently NEEDS_DISCUSSION with low confidence.
Root Cause
Get-KnownBuildIssues previously coerced a literal ErrorMessage array to one string, while deduplicated failure text could aggregate separate occurrences of the same test/platform. That combination could miss legitimate multiline signatures, accept same-line concatenations, or assemble a signature from unrelated occurrences.
Fix Quality
The submitted implementation is focused and its Pester coverage targets ordered matching, occurrence isolation, stack-trace evidence, invalid arrays, line endings, text limits, and unchanged scalar/regex behavior. Those tests and the reported validation were not independently executed in this review, however, so this run cannot claim regression coverage or merge readiness. Try-Fix was not requested, and the absence of a refinement reflects the expert finding no evidence-backed defect to patch.
🧭 Next Steps — review latest findings
No alternative fix was selected for this run. Review the session findings and CI results before merging.

Note
Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!
Description of Change
Fix the existing
/review testsKnown Build Error consumer's handling of literalErrorMessagearrays.Root cause:
Get-KnownBuildIssuescasts an array to[string], joining its expressions with spaces.Test-KnownIssueMatchthen searches for that one contiguous substring. A valid rule whose expressions appear on separate stack frames is missed; a same-line concatenation can incorrectly match.Get-DeduplicatedFailuresalso aggregates messages from separate occurrences of the same test/platform. Matching an array against that aggregate can assemble its signature from multiple partial occurrences even though none individually satisfies the rule.Correction: Preserve valid arrays and require all their literal expressions, in array order, on distinct subsequent lines within one actual occurrence's name +
message/errorMessage+ separately capturedstackTracetext. Keep the rule loop outermost so the first matching rule still wins, even when it matches a later occurrence. Scalar and regex rules continue to use the existing aggregated text. This follows the public Build Analysis array contract, rather than flattening the array or treating its elements as alternative rules. Empty arrays and arrays containing null, blank, non-string, or nested elements are skipped with an explicit warning; invalid elements are not discarded to create a weaker matcher.AzDO failure records capture the error message and stack trace in separate fields. The occurrence-local array text includes both fields from the same record, so stack-frame signatures can match even when they appear only in
stackTrace. Neither stack traces from different occurrences nor a message in one occurrence and a stack trace in another may complete a signature.The change is limited to three files:
Gather-TestFailureContext.ps1: literal-array loading/matching, occurrence-local array evidence, and narrowly corrected hint-only comments.Gather-TestFailureContext.Tests.ps1: 47 real loader-to-matcher cases with mocked issue-list transport, including production deduplication and the actual cross-reference assignments..github/docs/maui-ci-facts.md: the occurrence-local ordered-line contract and service-parity limitation.Existing scalar substring matching and scalar/regex aggregated-text composition, case-insensitive literals, scalar regex precedence/fallback/timeout, the 20,000-character cap per matched text, first-matching-rule selection, and attribution gates are unchanged. Partial, unrelated, reversed, same-line, cross-test, and same-test split-occurrence evidence is covered, along with LF/CRLF/CR line endings, single/repeated/three-expression arrays, invalid arrays, and the text-limit boundary.
The split-occurrence defect can cite an unsupported Known Build Error hint; it does not flip the final PR-related/unrelated attribution. Downstream
matchesKnownIssueselectsknown-issueinstead ofpre-existing-on-baseonly after the existing exactalsoFailsOnBaselinegate. Those attribution conditions are unchanged.Validation
Validated on the branch based on upstream main
84b1fb39ad56e22a51d29d4bbf141b03b02e4648, using PowerShell 7.4.5 and Pester 5.7.1. The occurrence-isolation correction was reproduced one2892b088c61cfd7e43b69c8e715abb6cae99907; the stack-trace correction was reproduced on7c1ee12b305e83abe996ef042b8ccfdf35466ff7, the original commit bound to the stack-trace review comment.stackTrace, the 9 new cases on7c1ee12b305e83abe996ef042b8ccfdf35466ff7produced 4 expected assertion failures and 5 passing controls. The tests use production deduplication and the actual caller, including stack-trace-only signatures, an absent message, a message followed by the same occurrence's stack trace, cross-occurrence negatives, unchanged scalar/regex text, and the 20,000-character boundary.e2892b088c61cfd7e43b69c8e715abb6cae99907produced 4 expected assertion failures and 9 passing controls, including the real same-test/platform split-occurrence regression throughGet-DeduplicatedFailuresand the actual cross-reference path.36435; a scalar rule through the real loader matched before and after; each partial expression stayed unmatched; the flattened same-line false positive changed from a match to no match.git diff --check: passed.These are offline parser/matcher-boundary checks, not a full PR-review run or proof of live/deployed Build Analysis/Build Insights parity. No product build, device/UI test, live service match, or CI rerun was performed. No issue enrollment, retry/quarantine/fixer policy, workflow, generated lock, manifest, or
ErrorPattern-array behavior is changed. A signature match remains a hint, not causal proof or a confirmed flake verdict.Issues Fixed
No separate parser-defect issue was filed. #36435 supplies historical public fixture evidence only: this PR does not fix or close that FileSystem product issue, establish that it is currently recurring, or assert its resolution.