Detect conflicting leaf corrections

This commit is contained in:
demiliani 2026-09-25 13:31:14 +02:00
parent dfe87111a8
commit de62a818df
2 changed files with 19 additions and 0 deletions

View file

@ -409,6 +409,17 @@ function Get-SemanticErrors {
$representedLeafFindings = @($eligibleFindings | Where-Object {
Test-RolledFindingRepresents $finding $_.Finding $_.ProducerId
})
$representedCorrections = @(
$representedLeafFindings |
Where-Object { Test-HasProperty $_.Finding 'suggested-code' } |
ForEach-Object { $_.Finding.'suggested-code' } |
Sort-Object -CaseSensitive -Unique
)
if ($representedCorrections.Count -gt 1) {
Add-Error 'SUPER_FINDING_MISMATCH' "$ReportPathPrefix.findings[$index]" `
"Rolled-up finding '$($finding.id)' represents leaf findings with conflicting suggested-code replacements."
continue
}
$expectedSeverityRank = ($representedLeafFindings | ForEach-Object { Get-SeverityRank $_.Finding.severity } | Measure-Object -Maximum).Maximum
$expectedConfidenceRank = ($representedLeafFindings | ForEach-Object { Get-ConfidenceRank $_.Finding.confidence } | Measure-Object -Maximum).Maximum
if ((Get-SeverityRank $finding.severity) -ne $expectedSeverityRank -or