fix(yaml): pass keyonly condition with searchpattern when at least one file matches - #9889
Conversation
…e file matches When a yaml condition uses searchpattern with keyonly, it should pass as long as at least one matched file contains the specified key, aligning with the file plugin behavior. Previously the condition failed whenever any matched file did not contain the key. Also record a per-file key miss for the yamlpath engine so the searchpattern handling can distinguish 'at least one file contains the key' from 'no file contains it'. Closes updatecli#9848 Signed-off-by: Junhuan Zheng <3373484735@qq.com>
|
Hi @olblak, this is my first contribution to updatecli, so the CI workflows (Go, CodeQL, typos, zizmor, Updatecli Test) are waiting for approval before they can run. Could you approve them when you have a moment? Thanks! |
olblak
left a comment
There was a problem hiding this comment.
Thanks, this looks great, I'll need to find some time to test it
|
Tick the box to add this pull request to the merge queue (same as
|
|
Hi @olblak, quick heads-up on the failing The Go build, Analyse, CodeQL, typos and zizmor checks all pass on this PR. Happy to rebase or help in any way if needed. |
olblak
left a comment
There was a problem hiding this comment.
Thanks for the pullrequest, tested manually and it works as expected
Fix #9848
When a yaml condition uses
searchpattern: truetogether withkeyonly: true, it should pass as long as at least one matched file contains the specified key, aligning with the file plugin behavior. Previously the condition failed whenever any matched file did not contain the key.This change also records a per-file key miss for the
yamlpathengine so the searchpattern handling can distinguish "at least one file contains the key" from "no file contains it".Test
To test this pull request, you can run the following commands:
Additional Information
Checklist
Tradeoff
Potential improvement