[Security Solution] Reverts all remaining diff algorithm fields to return Target version when base version is missing (#214287)

## Summary

Originally we had intended to have the prebuilt rule diff algorithms
merge non-functional fields when the field's base version was missing
and a rule was marked as customized as described in
https://github.com/elastic/kibana/issues/210358

> - When the rule has a missing base version and is marked as
customized:
> - We should attempt to merge all non-functional mergeable fields (any
field that doesn't have consequences with how the rule runs e.g. tags)
and return them as SOLVABLE_CONFLICT

We ended up changing this logic to return the `Target` version for every
field that fit that description
(https://github.com/elastic/kibana/pull/214161 and
https://github.com/elastic/kibana/pull/213757) besides `tags` and in
order to support consistency rather than a very minor edge case, we now
just return the target version for every field with a missing base
version and let users sort it out on their end

This PR reverts the changes made to accommodate this edge case and
updates related tests to account for the new logic

### Checklist

Check the PR satisfies following conditions. 

Reviewers should verify this PR satisfies this list as well.
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

---------

Co-authored-by: Georgii Gorbachev <georgii.gorbachev@elastic.co>
This commit is contained in:
Davis Plumlee 2025-03-14 03:20:37 -04:00 committed by GitHub
parent 296aff2abb
commit a2d2054148
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View file

@ -219,7 +219,7 @@ const commonFieldsDiffAlgorithms: FieldsDiffAlgorithmsFor<DiffableCommonFields>
version: forceTargetVersionDiffAlgorithm,
name: singleLineStringDiffAlgorithm,
tags: createScalarArrayDiffAlgorithm({
missingBaseVersionStrategy: ScalarArrayDiffMissingBaseVersionStrategy.Merge,
missingBaseVersionStrategy: ScalarArrayDiffMissingBaseVersionStrategy.UseTarget,
}),
description: multiLineStringDiffAlgorithm,
severity: singleLineStringDiffAlgorithm,

View file

@ -297,11 +297,11 @@ export function tagsField({ getService }: FtrProviderContext): void {
ruleUpgradeAssets,
diffableRuleFieldName: 'tags',
expectedDiffOutcome: ThreeWayDiffOutcome.MissingBaseCanUpdate,
isMergableField: true,
isMergableField: false,
expectedFieldDiffValues: {
current: ['tagB'],
target: ['tagC'],
merged: ['tagB', 'tagC'],
merged: ['tagC'],
},
},
getService