Skip to content

bug: preserve unusual keys, empty containers, big ints, emoji, and aliases across the save round-trip#60

Merged
bosiakov merged 1 commit into
mainfrom
bug/values-save-roundtrip-fidelity
May 3, 2026
Merged

bug: preserve unusual keys, empty containers, big ints, emoji, and aliases across the save round-trip#60
bosiakov merged 1 commit into
mainfrom
bug/values-save-roundtrip-fidelity

Conversation

@bosiakov

@bosiakov bosiakov commented May 3, 2026

Copy link
Copy Markdown
Contributor
  • Encode flat keys with backslash escapes (\. \[ \) so map keys containing literal . (e.g. app.kubernetes.io/part-of) and empty-string keys ("": value) round-trip without splitting or rejection
  • Skip empty-container placeholder entries in PatchNodeTree when the tree already holds a matching mapping or sequence, instead of overwriting with a literal '{}' / '[]' string scalar
  • Set Value to empty for nil scalars in flattenValues so convertValue returns nil and yaml.v3 emits null / ~ / blank instead of the string <nil>
  • Treat tree values null / ~ / "" as equivalent to an empty entry Value when checking valueUnchanged, so unedited null leaves keep their source style
  • Skip SplitInlineComment when the editor text matches the loaded value verbatim, so a literal # inside a quoted string stops being misread as an inline comment
  • Add a raw-equals-load-form fast path in collectOverrides so multi-line literal blocks whose own content starts with # round-trip without the leading line being hoisted into a YAML head comment
  • Include scalar-leaf entries with empty Value in customMap so populateColumnOverrides no longer falls through to SerializeNodeSubtree, which was YAML-encoding empty strings as the four-character text "" and saving them as "\"\""
  • Thread loadedValues through OverridesToYAML so the empty-value round-trip path is scoped to keys actually loaded from the file, preventing chart defaults like acl.userSecret: "" and master.persistence.medium: "" from leaking into the saved override
  • Pull literal scalar text from NodeTree after flatten so chartutil's float64 cast on integers above 2^53 stops corrupting values like 9007199254740993 to 9.007199254740992e+15
  • Run rewriteValuesFromNodeTree on the merge load path too, since the UI loads override columns through LoadAndMergeCustomValues
  • Post-process the rendered YAML to convert yaml.v3's \Unnnnnnnn and \unnnn escape sequences inside double-quoted scalars back to literal Unicode, so emoji and supplementary-plane characters survive yaml.v3's forced double-quoted escape policy
  • Make effectiveComments walk the tree read-only via findParentSlotReadOnly so comparing comment state on an aliased leaf no longer breaks the alias as a side effect
  • Expose viaAlias from effectiveComments so PatchNodeTree treats alias-resolved comments as effectively unchanged, suppressing a same-position comment write that would otherwise expand the alias
  • Preserve Value on custom-only empty-container entries in RebuildUnifiedEntries so they pass IsFocusable, survive collectOverrides, and stay in the saved file
  • Drop the keyNode.Value == "" skip in parseComments and the position walker so comments on legitimate empty-string keys ("": value) attach to the right flat key
  • Switch UI helpers to escape-aware FlatKey methods, fix anchor membership depth to use FlatKey.Depth, and use escape-aware splitting in suggestAnchorName
  • Add tests covering FlatKey escape round-trip, empty/dotted/backslash key save, alias preservation, big-int precision, emoji escape removal, multi-line literal blocks, and custom-only empty-container preservation

@bosiakov
bosiakov merged commit db85f85 into main May 3, 2026
1 check passed
@bosiakov
bosiakov deleted the bug/values-save-roundtrip-fidelity branch May 3, 2026 18:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant