Repository navigation
fix: do not evaluate expressions of nested activities on the branch not taken - #180
Open
Florian BURELLI (florian-burelli) wants to merge 1 commit into
Conversation
…ot taken `Activity._evaluate_expressions` skips nested activities by looking for "activities" in the attribute or key name, case-sensitively. `activities` (ForEach, Switch cases) was skipped, but `ifTrueActivities`, `ifFalseActivities` and `defaultActivities` were not, so the expressions of both IfCondition branches and of the Switch default branch were evaluated eagerly in the scope of the container, before the branch was chosen. An expression that is only valid on one branch then failed the whole evaluation. Make the check case-insensitive so every nested activity list is left to the control activity, which evaluates the branch it takes in its own scope. Fixes microsoft#176 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
Florian BURELLI (@florian-burelli) please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
This branch has not been deployed
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.
Fixes #176
Problem
Activity._evaluate_expressionsskips nested activity lists by checking"activities" in key(and the same on attribute names). The check is case-sensitive, soactivities(ForEach, Switch cases) is skipped butifTrueActivities,ifFalseActivitiesanddefaultActivitiesare not. The raw JSON of those lists is still intype_properties(with its expression dicts already replaced byDataFactoryElements), so the expressions of both IfCondition branches, and of the Switch default branch, are evaluated eagerly in the scope of the container before the branch is chosen. An expression that is only valid on one branch fails the whole evaluation, e.g.@formatDateTime(pipeline().parameters.date, ...)on the false branch of@empty(pipeline().parameters.date).Change
_activity.py: the attribute and key checks go through one_is_nested_activities_name, which lowercases the name. Every nested activity list is now left to the control activity, which already evaluates the branch it takes in its own scope.Tests
tests/functional/branch_not_taken/: an IfCondition pipeline and a Switch pipeline whose untaken branch holds an expression that only works when that branch is taken (the repro of IfCondition evaluates the expressions of the branch not taken (case-sensitive "activities" check) #176). 4 cases, 3 of them fail onmain.tests/unit/models/activities/base/test_activity.py:Activity.evaluateleaves expressions underactivities,ifTrueActivities,ifFalseActivitiesanddefaultActivitiesunevaluated. The two camel-cased IfCondition keys anddefaultActivitiesfail onmain.Full suite: 229 passed. Ruff check and format clean.
🤖 Generated with Claude Code