Repository navigation
Automate visual failure comparisons in /review tests #36666
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 2 commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
e07e066
Automate visual failure comparisons in /review tests
Copilot b9f1f73
Merge visual comparisons into /review tests
Copilot 87ce58d
Label visual failures by PR relationship
Copilot 4ccbab1
Use changed visual scope in relation labels
Copilot 8e606da
Fix report-fence parsing + visual dedup key; align review-tests auth …
kubaflo 5cb72ca
Harden visual-asset publishing per review feedback
kubaflo 96b9fe0
Unset GH_AW_* tokens before the trusted review-tests merge step
kubaflo 294ed45
Fix visual-evidence dedup, isolate diff download, surface prep failures
kubaflo 88eb005
Make /review tests pre-activation resilient so the failure-report fal…
kubaflo e48a947
Merge main into review-tests-visual-comparisons
Copilot abddbf5
Harden visual-evidence gather/publish/merge per review feedback
kubaflo f4cf6cf
Bound remaining AzDO/Helix Invoke-WebRequest calls with -TimeoutSec
Copilot 42cd619
Harden /review tests visual budgeting, leg dedup, and omission accoun…
Copilot fe5e030
Harden visual budget lifetime, download cancellation, and omission ac…
Copilot 18d5f31
Distinguish publish failures and omission causes; charge visual budge…
Copilot 7f2018c
Harden visual-publish failure classification and per-request timeouts…
Copilot a438e1d
Bound visual result pagination by deadline
Copilot ae857e4
Harden visual attribution and workflow bounds
Copilot aac848e
Clean up rejected baseline candidates and cover near-expiry paginatio…
kubaflo 3ab5098
Seal local visual merge and enforce bounds
Copilot 7ec3c32
Harden visual publishing failure paths
Copilot 93fe958
Count whole GitHub mention tokens in the merge budget guard (#36666 r…
kubaflo d45fef2
Preserve exact visual baseline provenance
Copilot ee579ba
Protect report parsing and gather finalization
Copilot e4b435a
Bound remaining gather enrichment
Copilot f8898d9
Enforce gather deadline across all requests
Copilot bf5b0fd
Bound gather subprocesses and evidence
Copilot 284e34e
Preserve analysis around visual markers
Copilot d116698
Separate fresh and persisted visual markers
Copilot a122d99
Tighten AzDO attachment allowlist to reject adorned URLs (#36666 review)
kubaflo 585e366
Neutralize untrusted visual marker content
Copilot 3f81b62
Merge remote-tracking branch 'origin/review-tests-visual-comparisons'…
Copilot 3f85eca
Document ruleset-compatible PAT environment policy
Copilot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,157 @@ | ||
| #!/usr/bin/env pwsh | ||
| #Requires -Modules Pester | ||
|
|
||
| BeforeAll { | ||
| $scriptPath = Join-Path $PSScriptRoot 'Review-Tests.ps1' | ||
| $tokens = $null | ||
| $parseErrors = $null | ||
| $ast = [System.Management.Automation.Language.Parser]::ParseFile($scriptPath, [ref]$tokens, [ref]$parseErrors) | ||
| if ($parseErrors -and $parseErrors.Count -gt 0) { | ||
| throw ($parseErrors | ForEach-Object { $_.Message }) -join [Environment]::NewLine | ||
| } | ||
|
|
||
| foreach ($functionName in @( | ||
| 'Get-EmbeddedTestFailureReport', | ||
| 'Collapse-OpenDetails', | ||
| 'New-TestFailureReviewBody' | ||
| )) { | ||
| $function = $ast.Find({ | ||
| $args[0] -is [System.Management.Automation.Language.FunctionDefinitionAst] -and | ||
| $args[0].Name -eq $functionName | ||
| }, $true) | ||
| if (-not $function) { throw "Function '$functionName' not found in $scriptPath" } | ||
| Invoke-Expression $function.Extent.Text | ||
| } | ||
| } | ||
|
|
||
| Describe 'Local test-failure report extraction' { | ||
| It 'extracts a fenced complete report without the assistant preamble or code fence' { | ||
| $content = @' | ||
| I could not write report.md. Report follows. | ||
|
|
||
| ```markdown | ||
| <!-- Tests Failure --> | ||
|
|
||
| ## Tests Failure Analysis | ||
|
|
||
| <details> | ||
| <summary>Review</summary> | ||
|
|
||
| <details> | ||
| <summary>Evidence</summary> | ||
| Evidence | ||
| </details> | ||
|
|
||
| </details> | ||
| ``` | ||
|
|
||
| Trailing assistant prose. | ||
| '@ | ||
|
|
||
| $report = Get-EmbeddedTestFailureReport -Content $content | ||
|
|
||
| $report | Should -Match '^<!-- Tests Failure -->' | ||
| $report | Should -Match '## Tests Failure Analysis' | ||
| $report | Should -Not -Match 'I could not write' | ||
| $report | Should -Not -Match '```' | ||
| $report | Should -Not -Match 'Trailing assistant prose' | ||
| ([regex]::Matches($report, '<details>').Count) | | ||
| Should -Be ([regex]::Matches($report, '</details>').Count) | ||
| } | ||
|
|
||
| It 'preserves code fences inside an unfenced report and trims trailing prose' { | ||
| $content = @' | ||
| The write was denied, so the report is below. | ||
|
|
||
| <!-- Tests Failure --> | ||
|
|
||
| ## Tests Failure Analysis | ||
|
|
||
| <details> | ||
| <summary>Review</summary> | ||
|
|
||
| ```text | ||
| error: sample | ||
| ``` | ||
|
|
||
| </details> | ||
|
|
||
| This sentence is outside the report. | ||
| '@ | ||
|
|
||
| $report = Get-EmbeddedTestFailureReport -Content $content | ||
|
|
||
| $report | Should -Match '```text' | ||
| $report | Should -Match 'error: sample' | ||
| $report | Should -Not -Match 'outside the report' | ||
| } | ||
|
|
||
| It 'preserves inner code fences inside a fenced complete report' { | ||
| $content = @' | ||
| I could not write report.md. Report follows. | ||
|
|
||
| ```markdown | ||
| <!-- Tests Failure --> | ||
|
|
||
| ## Tests Failure Analysis | ||
|
|
||
| <details> | ||
| <summary>Review</summary> | ||
|
|
||
| <details> | ||
| <summary>Evidence</summary> | ||
|
|
||
| ```text | ||
| error: sample | ||
| ``` | ||
|
|
||
| </details> | ||
|
|
||
| </details> | ||
| ``` | ||
|
|
||
| Trailing assistant prose. | ||
| '@ | ||
|
|
||
| $report = Get-EmbeddedTestFailureReport -Content $content | ||
|
|
||
| $report | Should -Match '```text' | ||
| $report | Should -Match 'error: sample' | ||
| $report | Should -Not -Match 'Trailing assistant prose' | ||
| ([regex]::Matches($report, '<details>').Count) | | ||
| Should -Be ([regex]::Matches($report, '</details>').Count) | ||
| } | ||
|
|
||
| It 'reuses a complete report instead of wrapping a second title and badge section' { | ||
| $content = @' | ||
| Generated report: | ||
|
|
||
| <!-- Tests Failure --> | ||
|
|
||
| ## Tests Failure Analysis | ||
|
|
||
| > @author - results | ||
|
|
||
| <details> | ||
| <summary>Review</summary> | ||
| **Overall verdict:** Not ready | ||
| </details> | ||
| '@ | ||
|
|
||
| $body = New-TestFailureReviewBody ` | ||
| -PRNumber 123 ` | ||
| -Repository 'dotnet/maui' ` | ||
| -ReportContent $content ` | ||
| -ContextJsonPath (Join-Path $TestDrive 'unused.json') | ||
|
|
||
| $body | Should -Match '^<!-- Tests Failure \(local\) -->' | ||
| ([regex]::Matches($body, '## Tests Failure Analysis').Count) | Should -Be 1 | ||
| ([regex]::Matches($body, '\*\*Overall verdict:\*\*').Count) | Should -Be 1 | ||
| $body | Should -Not -Match 'Generated report:' | ||
| } | ||
|
|
||
| It 'returns null when no complete report is embedded' { | ||
| Get-EmbeddedTestFailureReport -Content 'Only a short analysis sentence.' | | ||
| Should -BeNullOrEmpty | ||
| } | ||
| } |
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.