Repository navigation
Resolve attribute path before comparing list/map elements in conditionals - #3488
Open
m86hussein wants to merge 1 commit into
Open
m86hussein wants to merge 1 commit into
m86hussein wants to merge 1 commit into
Conversation
…nals Indexing into a list or map (e.g. xs[0]) produces a promise whose index is stored in attr_path while val still holds the whole collection. ComparisonExpression inspected val.scalar directly, so comparing a list element (such as xs[0].is_none()) raised AttributeError: 'NoneType' object has no attribute 'union' because a collection literal has no scalar. Resolve the attr_path to the leaf literal before inspecting the value, guard against a None scalar, and keep the resolved leaf for primitive elements so local evaluation works. This path only runs during local execution (is_ready), so remote serialization is unaffected. Fixes flyteorg/flyte#6473 Signed-off-by: m86hussein <m86hussein@gmail.com>
m86hussein
requested review from
cosmicbboy,
davidmirror-ops,
kumare3,
machichima,
pingsutw,
samhita-alla and
wild-endeavor
as code owners
November 8, 2026 14:12
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Indexing into a list or map (e.g.
xs[0]) produces a promise whose index is stored inattr_path, whilevalstill holds the whole collection.ComparisonExpressioninspectedval.scalardirectly, so comparing a list element — for examplexs[0].is_none()inside aconditional— raised:because a collection literal has no
scalar.What
attr_path(list/map indexing) down to the leaf literal.ComparisonExpressionnow inspects the resolved leaf for both operands, guards against aNonescalar, and keeps the resolved leaf for primitive elements so localeval()works.is_ready), so remote serialization (unready promises -> variable references) is unaffected.Tests
Added
test_condition_with_list_indexcovering aNonelist element (is_none()-> True branch), a non-Noneelement (-> else branch), and a primitive int element comparison.Related issue
Fixes flyteorg/flyte#6473