Preserve retained input presence in nested CLI overrides

This commit is contained in:
2026-10-23 23:47:21 +00:00
parent af80ccb90c
commit f8cbb2ed87
3 changed files with 79 additions and 6 deletions

View File

@@ -38,7 +38,10 @@ func applyDecodedOverrides(
}
presence := cloneInputPresence(decoded.presence)
origins := cloneOrigins(decoded.origins)
currentProjection := document.Clone(decoded.final)
var lookup *documentLookup
if len(batch.overrides) != 0 {
lookup = buildDocumentLookup(decoded.final)
}
for _, override := range batch.overrides {
if len(override.path.segments) == 0 {
@@ -56,8 +59,11 @@ func applyDecodedOverrides(
location := document.Location{SourceID: override.source.ID}
recordOverrideAncestors(presence, origins, override.path, location)
updateOverridePresence(presence, currentProjection, override.value, override.path, location)
updateOverrideOrigins(origins, currentProjection, override.value, override.path, location)
// Prepared paths cannot overlap, so other assignments cannot change
// this target's pre-CLI subtree.
existing, _ := documentAtPathWithLookup(decoded.final, override.path, lookup)
updateOverridePresence(presence, existing, override.value, override.path, location)
updateOverrideOrigins(origins, existing, override.value, override.path, location)
}
final, projectionIssue := projectConfiguration(schema, working, defaultProjectionLimits())
if projectionIssue != nil {