item() equal to 0 raises StateIterationItemNotSetError (falsy item treated as unset)
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 88/100
Research direction
Start at src/data_factory_testing_framework/_pythonnet/data_factory_testing_framework_expressions_evaluator.py#L53, then run the supplied @range(0, 3) reproduction. Done means the ForEach produces Append_Item results 0, 1, and 2, while unset iteration items still raise StateIterationItemNotSetError; check other iteration_item truthiness tests as noted.
Written by the indexing model from the issue text.
Description
Inside a ForEach, an item() whose value is 0 raises StateIterationItemNotSetError, as if no item were set. @range(0, n) therefore fails on its first iteration.
Environment: data-factory-testing-framework 1.4.2 (also present on main at 11b9f27), Python 3.12.13, .NET 10.0.12, Linux.
Repro
import json, tempfile
from pathlib import Path
from data_factory_testing_framework import TestFramework, TestFrameworkType
pipeline = {
"name": "item_zero",
"properties": {
"variables": {"items": {"type": "Array"}},
"activities": [
{
"name": "Each_Day",
"type": "ForEach",
"dependsOn": [],
"typeProperties": {
"items": {"value": "@range(0, 3)", "type": "Expression"},
"activities": [
{
"name": "Append_Item",
"type": "AppendVariable",
"dependsOn": [],
"typeProperties": {
"variableName": "items",
"value": {"value": "@item()", "type": "Expression"},
},
}
],
},
}
],
},
}
root = Path(tempfile.mkdtemp())
(root / "pipeline").mkdir()
(root / "pipeline" / "item_zero.json").write_text(json.dumps(pipeline))
framework = TestFramework(framework_type=TestFrameworkType.DataFactory, root_folder_path=str(root))
for activity in framework.evaluate_pipeline(framework.get_pipeline_by_name("item_zero"), []):
print(activity.name, activity.type_properties["value"].result) # expected: 0, 1, 2
Expected: Append_Item 0, Append_Item 1, Append_Item 2.
Actual:
StateIterationItemNotSetError: Iteration item not set.
Cause
data_factory_testing_framework_expressions_evaluator.py#L53 tests the item for truthiness:
state_iter_item_json = json.dumps(state.iteration_item) if state.iteration_item else None
so any falsy item (0, and by the same line "", false, [], {}) is sent to the evaluator as "no item". Verified with 0.
Suggested fix: if state.iteration_item is not None else None. The same check probably matters wherever iteration_item is tested for truthiness.
- Dominant language
- Python
- Stars
- 135
- Forks
- 43
- Avg merge
- 1h 14m
- Merged PRs (30d)
- 1
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- No pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from microsoft/data-factory-testing-framework
-
A new ExpressionRuntime (Lark grammar compile) per evaluated expression makes evaluation ~5x slowerOpen
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
-
IfCondition evaluates the expressions of the branch not taken (case-sensitive "activities" check)Open
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
DataFactoryTestingFrameworkExpressionsEvaluator adds status property even if None is set.Possibly taken @LeonardHd claimed this 433 days ago. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
All issues in microsoft/data-factory-testing-framework
Similar issues
-
needs-human needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
gke-labs/kube-agents#2400 · 1 comment ·
Maintainers usually reply within 1 day
-
Device Details tables: FS/SF columns contradict each other (nfet_01v8 Vt row, pfet_01v8 Idsat row)Open
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
google/skywater-pdk#450 ·
-
Drained trajectory arrays are overwritten when the sequence buffer is reusedPossibly taken @sylvesterkaczmarek claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
google-deepmind/bsuite#56 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
LearningCircuit/local-deep-research#7206 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
chingu-voyages/V62-tier3-team-33#285 ·
Maintainers usually reply within 1 day