fix(patch,resource-update): empty values survive hinted fields and unresolved reference adds plan - #705
Open
JeroenSoeters wants to merge 11 commits into
Open
fix(patch,resource-update): empty values survive hinted fields and unresolved reference adds plan#705JeroenSoeters wants to merge 11 commits into
JeroenSoeters wants to merge 11 commits into
Conversation
An opt-in FieldHint marking a top-level field's subtree as carrying meaningful empty collections: normalization must preserve them rather than strip them as rendering noise. Orthogonal to UpdateMethod.
…survive empty-value normalization Fields hinted preserveEmptyValues keep their empty collections through both diff inputs, op values, and the spurious-add filter, matched by first pointer segment against a root set derived from schema hints. The top-level empty-value drop's keep-set widens to fields whose desired pre-flatten value is a well-formed reference envelope, so a first-declared unresolvable reference plans a placeholder add that execution resolves instead of being silently discarded. The absence-scoped provider-echo tolerance is deliberately unchanged for preserved roots.
A kept placeholder on a createOnly destination could only surface as a replacement, and a replacement must never be planned from a value that has not resolved: an import-shaped source whose property is never written would otherwise destroy its consumer. Placeholder adds are minted for mutable destinations only.
…mpty collections intact
…eptance A preserveEmptyValues-hinted field reaches the plugin verbatim on create, re-applies clean, and updates as one whole value; the persist merge keeps its empty collections when the plugin echoes nothing. An existing resource gaining a reference to a hashed secret plans, delivers the resolved value together with an ordinary sibling change, re-applies clean, and persists only the placeholder at rest.
The hint's invariant covers empty collections, which pass the top-level empty-value filter on their own; granting preserved roots a keep-set entry only changed empty-string behavior, minting spurious adds for fields an unset nullable declaration renders as an empty string.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two defects with one representational root cause: the property pipeline treats empty values as rendering noise and filters them, destroying values that are deliberate.
specwhereselfSigned: {}IS the declaration) reached providers with its empty members recursively stripped, from the create payload, the diff inputs, and patch op values - valid objects were rejected by admission and the recursive collapse defeated workarounds.Mechanism
preserveEmptyValues, marks a top-level field's subtree as carrying meaningful empty collections. Every empty-collection normalization skips such subtrees: both diff inputs, post-diff op values, the spurious-add filter, and the plugin-bound property conversion (all contexts: write, Read, sync, delete). The persist merge keeps empty objects and arrays under such roots. Matching is by first RFC 6901 pointer segment against a root set derived from schema hints; dotted (nested subresource) hints grant nothing. The absence-scoped provider-echo tolerance is unchanged, empty strings gain no exemption, andAtomickeeps exactly its existing diff-granularity meaning - existing plugin schemas see no behavior change, pinned by tests.$refwith a parseable identity, or a complete$resdeclaration). A first-declared unresolvable reference now plans a placeholder op that execution resolves live; only the placeholder ever persists. CreateOnly destinations are excluded: a replacement is never planned from a value that has not resolved.Tests
Unit pins for every touched site (fidelity at each strip, defaults preserved for unhinted fields, path matcher prefix/escape cases, envelope predicate matrix, churn contract, no-change guarantees) and workflow acceptance: an opaque-bodied resource creates verbatim, re-applies clean, and updates as one whole value still carrying its empty member; an existing resource gaining a reference to a hashed secret plans, delivers the resolved value together with an ordinary sibling change, re-applies clean, and persists no plaintext.
A follow-up in the kubernetes plugin opts
K8S::Custom::Resource.specin withupdateMethod = "Atomic"+preserveEmptyValues = trueand a minFormaeVersion bump.