Skip to content

fix(iohandler): preserve empty containers and literal False in template args (#6728) - #6818

Open
MyDude92 wants to merge 2 commits into
keephq:mainfrom
MyDude92:fix-iohandler-falsy-args-6728
Open

MyDude92 wants to merge 2 commits into
keephq:mainfrom
MyDude92:fix-iohandler-falsy-args-6728

Conversation

@MyDude92

Copy link
Copy Markdown

Closes #6728

📑 Description

IOHandler's template-function parser previously dropped empty containers ([], {}, ()) and boolean False positional arguments due to an overly restrictive truthiness guard. This caused subsequent arguments to shift left, leading to parameter mismatch or unexpected TypeError exceptions during workflow evaluation.

Changes Made

  1. keep/iohandler/iohandler.py: Replaced flawed check with if _arg is not None:. Ensures all valid evaluated arguments ("", 0, 0.0, False, [], {}, ()) are preserved positionally.
  2. tests/test_iohandler.py: Added unit test test_iohandler_does_not_drop_falsy_arguments verifying keep.len and keep.eq on empty lists, dicts, tuples, and boolean False.

✅ Checks

  • My pull request adheres to the code style of this project
  • My code requires changes to the documentation
  • I have updated the documentation as required
  • All the tests have passed

ℹ Additional Information

Fixes parameter shifting and unexpected TypeErrors when workflows pass falsy collections or boolean False into keep.* functions.

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.

[🐛 Bug]: IOHandler silently drops empty list/dict/tuple (and literal False) arguments to keep.* template functions

1 participant