[LIB] Fix the behavior of null-preserving visitor, refactor, add comparison tests - #4774
mozesl-nokia wants to merge 12 commits into
Conversation
✅ Deploy Preview for kptdocs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Upstream-null associative lists are not reliably preserved, and the expanded behavior conflicts with existing public documentation.
Review effort: Balanced
Findings: 1
Open (1)
What changed in this PR
Refactors merge3 null preservation into a dedicated visitor and expands behavioral comparisons.
Changes:
- Separates default and null-preserving merge visitors.
- Adds shared null-handling utilities and associative-list preprocessing.
- Replaces legacy tests with broader preservation and kyaml comparison coverage.
| File | Description |
|---|---|
visitor.go |
Restores the default merge visitor behavior. |
visitor_util.go |
Adds shared null-handling helpers. |
tuple.go |
Selects the appropriate visitor and preprocesses null lists. |
preserve_test.go |
Removes superseded preservation tests. |
null_preserving_visitor.go |
Implements dedicated null-preserving merge behavior. |
null_preserve_test.go |
Tests scalar and associative-list null preservation. |
comparison_test.go |
Compares custom visitors with kyaml behavior. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
Also, the "PreserveExplicitNull" is now misleading, because this implementation preserves all null values, not just the explicit ones. How awkward would it be to break fresh api changes by renaming it? @kptdev/maintainers |
Signed-off-by: Mózes László Máté <laszlo.mozes@nokia.com>
Assisted-by: Cursor:grok-4.7 Signed-off-by: Mózes László Máté <laszlo.mozes@nokia.com>
Signed-off-by: Mózes László Máté <laszlo.mozes@nokia.com>
Assisted-by: Cursor:grok-4.7 Signed-off-by: Mózes László Máté <laszlo.mozes@nokia.com>
Assisted-by: Cursor:grok-4.7 Signed-off-by: Mózes László Máté <laszlo.mozes@nokia.com>
Assisted-by: Cursor:grok-4.7 Signed-off-by: Mózes László Máté <laszlo.mozes@nokia.com>
Signed-off-by: Mózes László Máté <laszlo.mozes@nokia.com>
Signed-off-by: Mózes László Máté <laszlo.mozes@nokia.com>
Assisted-by: Cursor:grok-4.7 Signed-off-by: Mózes László Máté <laszlo.mozes@nokia.com>
28f23ee to
ff5f512
Compare
Signed-off-by: Mózes László Máté <laszlo.mozes@nokia.com>
Assisted-by: Cursor:grok-4.7 Signed-off-by: Mózes László Máté <laszlo.mozes@nokia.com>
|





#4746 didn't cover enough of the use-cases for the null preservation behaviour. This PR refactors a big chunk of that code, splitting the visitor into it's own class and reverted the changes on the old custom
Visitor(except for the associative list bugfix).Added some comparison tests so we can track how each of our visitors handle merges compared to each other and kyaml's original.
AI disclosure:
NullPreservingVisitor, add the comparison tests and for reviewUpdate
PreserveExplicitNulltoPreserveNulls--for-deploymentflag ofkpt pkg getmake generateAI disclosure: