Retire obsolete collection identity before replacement agreement

This commit is contained in:
2026-10-24 00:51:10 +00:00
parent d2e20a304a
commit 146e7e56d9
8 changed files with 242 additions and 43 deletions

View File

@@ -93,6 +93,7 @@ func mergeInheritanceCollectionPolicies(
parentRootPath Path,
parentValue, childValue *document.Node,
applicationPolicy sequencePolicy,
replaced collectionReplacementPaths,
) (collectionPolicyScope, []Diagnostic) {
result := cloneCollectionPolicyScopeForInheritance(parent)
paths := make(map[string]Path, len(parent.collections)+len(child.collections))
@@ -107,7 +108,9 @@ func mergeInheritanceCollectionPolicies(
relative, inside := relativeHistoryPath(parentRootPath, path)
var retained, incoming *document.Node
if inside {
retained, _ = documentAtPath(parentValue, relative)
if !replaced.contains(path, false) {
retained, _ = documentAtPath(parentValue, relative)
}
incoming, _ = documentAtPath(childValue, relative)
}
resolution, lower, _, active, issues := inheritanceCollectionResolution(path, parent, child, applicationPolicy, incoming)
@@ -190,13 +193,11 @@ func applyInheritanceSequencePolicy(
combined sequenceCombinationResult,
resolution collectionPolicyResolution,
lowerScope, higherScope collectionPolicyScope,
result *collectionPolicyScope,
) collectionPolicy {
policy := cloneCollectionPolicyForInheritance(resolution.policy)
policy.recordOrder = nil
policy.recordPolicies = nil
if combined.value == nil || combined.value.Kind != document.Sequence {
result.retireCollectionPoliciesAtOrBelow(path)
return policy
}