Skip to content

fix(condition): assert_in/assert_not_in wrongly reject falsy values present in the list - #218

Open
chuenchen309 wants to merge 1 commit into
langgenius:mainfrom
chuenchen309:fix/assert-in-falsy-value-short-circuit
Open

fix(condition): assert_in/assert_not_in wrongly reject falsy values present in the list#218
chuenchen309 wants to merge 1 commit into
langgenius:mainfrom
chuenchen309:fix/assert-in-falsy-value-short-circuit

Conversation

@chuenchen309

Copy link
Copy Markdown

Bug

_assert_in/_assert_not_in short-circuit on if not value, but this checks the truthiness of the value being tested for membership, not whether it's absent. A falsy value that is legitimately present in the expected list (e.g. an empty string in a picklist that allows an empty option) is silently rejected by in and silently accepted by not in, before the actual membership check ever runs.

Every other comparator in this file (_assert_equal, _assert_greater_than, _assert_null, etc.) guards with if value is None, not if not value_assert_in/_assert_not_in are the only outliers.

Fix

Match the file's own established pattern: guard on value is None instead of not value.

Tests

  • New test test_process_conditions_in_matches_falsy_value_present_in_list (via the real ConditionProcessor.process_conditions path, matching this file's existing test style): red before the fix, green after.
  • Full tests/utils/test_condition_processor.py (5 tests) + tests/nodes/if_else/ (24 tests, the node that consumes this processor) pass.
  • Full test suite (604 tests) passes.
  • ruff check / ruff format --check / ty check clean on the changed files.

AI disclosure

Found, reproduced, and fixed with AI assistance (Claude Code), which noticed the inconsistency by comparing _assert_in/_assert_not_in's guard against every other comparator function in the same file. I independently reproduced the pre-fix bug and the fix's correctness by running the tests directly before opening this PR.

…resent in the list

_assert_in and _assert_not_in short-circuit on `if not value`, but this
checks the truthiness of the value being tested for membership, not
whether it's absent. A falsy value that is legitimately present in the
expected list (e.g. an empty string in a picklist that allows an empty
option) is silently rejected by "in" and silently accepted by
"not in" before the actual membership check ever runs.

Every other comparator in this file (_assert_equal, _assert_greater_than,
etc.) guards with `if value is None`, not `if not value` -- these two
are the only outliers.

Fix: match the file's own established pattern, guard on `value is None`
instead.

Verified: new test (test_process_conditions_in_matches_falsy_value_present_in_list)
red before fix, green after; full test_condition_processor.py suite (5
tests) plus tests/nodes/if_else/ (24 tests) pass; full test suite (604
tests) passes; ruff + ty clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@dosubot dosubot Bot added size:XS This PR changes 0-9 lines, ignoring generated files. bug Something isn't working labels Jul 15, 2026
@github-actions

github-actions Bot commented Jul 15, 2026

Copy link
Copy Markdown

All contributors on this pull request have signed the CLA.
Posted by the CLA Assistant Lite bot.

@chuenchen309

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant