From dfe87111a88e28004cd5bb0c1f862f040f5f9ea0 Mon Sep 17 00:00:00 2001 From: demiliani Date: Fri, 25 Sep 2026 12:36:01 +0200 Subject: [PATCH] Reject conflicting merged corrections --- tools/Test-ReviewContract.ps1 | 10 ++++++++++ tools/Validate-FindingsReport.ps1 | 4 ++++ 2 files changed, 14 insertions(+) diff --git a/tools/Test-ReviewContract.ps1 b/tools/Test-ReviewContract.ps1 index 372dab3..ca8593a 100644 --- a/tools/Test-ReviewContract.ps1 +++ b/tools/Test-ReviewContract.ps1 @@ -351,6 +351,16 @@ try { -SourceRoot $tmp -SourcePaths $sourcePath -RetrievedArticlePaths $articlePath, $supportingArticlePath Assert-True (-not $acceptedTextOnlyMerge.normalized) 'supporting references permit an overlapping A and B merge with different messages and no suggested code' + $conflictingSupportingLeaf = $supportingFindingLeaf | ConvertTo-Json -Depth 20 | ConvertFrom-Json + $conflictingSupportingLeaf.findings[0].'suggested-code' = 'ToolTip = ''Customer name'';' + $conflictingCorrectionMerge = $mergedSuperReport | ConvertTo-Json -Depth 20 | ConvertFrom-Json + $conflictingCorrectionMerge.'sub-results' = @($mergeOwnerLeaf, $conflictingSupportingLeaf) + Set-Content -LiteralPath $reportPath -Value ($conflictingCorrectionMerge | ConvertTo-Json -Depth 20) -Encoding utf8NoBOM + Assert-ThrowsLike -Pattern '*SUPER_FINDING_MISSING*' -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 diff --git a/tools/Validate-FindingsReport.ps1 b/tools/Validate-FindingsReport.ps1 index 186bf84..bbfecf3 100644 --- a/tools/Validate-FindingsReport.ps1 +++ b/tools/Validate-FindingsReport.ps1 @@ -204,8 +204,12 @@ function Get-SemanticErrors { } $sameCorrection = Test-SameCorrection $RolledFinding $LeafFinding + $correctionsConflict = (Test-HasProperty $RolledFinding 'suggested-code') -and + (Test-HasProperty $LeafFinding 'suggested-code') -and + $RolledFinding.'suggested-code' -cne $LeafFinding.'suggested-code' $explicitCrossRuleMerge = $leafReferences.Count -and $rolledReferences.Count -gt $leafReferences.Count -and + -not $correctionsConflict -and (Test-ReferencesInclude $rolledReferences $leafReferences) if (-not $sameCorrection -and -not $explicitCrossRuleMerge) { return $false