-
Notifications
You must be signed in to change notification settings - Fork 71
Fix ExtractItems duplication with WithAppendKeyFields #295
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix ExtractItems duplication with WithAppendKeyFields #295
Conversation
|
Hi @mrIncompetent. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
/ok-to-test |
34643c6 to
48e74cc
Compare
48e74cc to
0c56ef5
Compare
jpbetz
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One readability suggestion then LGTM
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jpbetz, mrIncompetent The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
02eb440 to
3e9f11e
Compare
|
Squashed the commits, did an additional renaming to improve readability. |
ExtractItems with WithAppendKeyFields was duplicating atomic elements when extracting from associative lists. The item was processed twice: once for the direct path match and again for sub-path checking. Added test with atomicElementList to verify the fix. Co-authored-by: Joe Betz <[email protected]>
3e9f11e to
e4bed54
Compare
|
Ping @jpbetz |
1 similar comment
|
Ping @jpbetz |
|
/lgtm |
What
Fixes
ExtractItemsduplicating atomic elements when extracting from associative lists withWithAppendKeyFields.Why
Items with
elementRelationship: atomicwere processed twice - once for direct path match and again during sub-path checking, causing duplication in the output.Example
When extracting with fieldpaths:
.metadata.labels["app"].metadata.labels["version"].metadata.labels["env"].metadata.ownerReferences[uid="123e4567-e89b-12d3-a456-426614174000"]Before fix - ownerReference was duplicated:
{ "metadata": { "labels": { "app": "my-app", "version": "v1.0.0", "env": "prod" }, "ownerReferences": [ { "apiVersion": "apps/v1", "blockOwnerDeletion": true, "controller": true, "kind": "Deployment", "name": "my-deployment", "uid": "123e4567-e89b-12d3-a456-426614174000" }, { "apiVersion": "apps/v1", "blockOwnerDeletion": true, "controller": true, "kind": "Deployment", "name": "my-deployment", "uid": "123e4567-e89b-12d3-a456-426614174000" } ] } }After fix - ownerReference appears only once:
{ "metadata": { "labels": { "app": "my-app", "version": "v1.0.0", "env": "prod" }, "ownerReferences": [ { "apiVersion": "apps/v1", "blockOwnerDeletion": true, "controller": true, "kind": "Deployment", "name": "my-deployment", "uid": "123e4567-e89b-12d3-a456-426614174000" } ] } }