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

@ -361,6 +361,14 @@ try {
-SourceRoot $tmp -SourcePaths $sourcePath -RetrievedArticlePaths $articlePath, $supportingArticlePath
}
$omittedConflictingCorrectionMerge = $conflictingCorrectionMerge | ConvertTo-Json -Depth 20 | ConvertFrom-Json
$omittedConflictingCorrectionMerge.findings[0].PSObject.Properties.Remove('suggested-code')
Set-Content -LiteralPath $reportPath -Value ($omittedConflictingCorrectionMerge | ConvertTo-Json -Depth 20) -Encoding utf8NoBOM
Assert-ThrowsLike -Pattern '*SUPER_FINDING_MISMATCH*' -Action {
& $validator -ReportPath $reportPath -BCQualityRoot $Root -SkillKind super `
-SourceRoot $tmp -SourcePaths $sourcePath -RetrievedArticlePaths $articlePath, $supportingArticlePath
}
$unmergedSupportingFinding = $supportingFindingLeaf.findings[0] | ConvertTo-Json -Depth 20 | ConvertFrom-Json
$unmergedSupportingFinding | Add-Member -NotePropertyName 'from-sub-skill' -NotePropertyValue 'al-security-review'
$unmergedDuplicates = $mergedSuperReport | ConvertTo-Json -Depth 20 | ConvertFrom-Json

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