Python: Add regression tests for Entry JoinExecutor Workflow.Inputs initialization#4335
Python: Add regression tests for Entry JoinExecutor Workflow.Inputs initialization#4335moonbox3 wants to merge 4 commits intomicrosoft:mainfrom
Conversation
…initializes Workflow.Inputs Add tests verifying that when workflow.run() is called with a dict or string input, the Entry node (JoinExecutor with kind: 'Entry') correctly initializes Workflow.Inputs via _ensure_state_initialized so that: - Expressions like =inputs.age resolve to the correct value - Conditions like =Local.age < 13 evaluate based on actual input (not blank/0) - String inputs populate both inputs.input and System.LastMessage.Text Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
moonbox3
left a comment
There was a problem hiding this comment.
Automated Code Review
Reviewers: 3 | Confidence: 98%
✓ Correctness
This diff only reformats three assert statements by inlining their f-string failure messages, removing the parenthesized multi-line form. The change is purely cosmetic and functionally equivalent — Python's assert statement accepts the message expression directly. No logic, correctness, or behavior is altered.
✓ Security Reliability
This diff only reformats assert statement message arguments from parenthesized multi-line strings to inline f-strings. There are no security or reliability concerns introduced — the changes are purely cosmetic and do not affect logic, resource handling, or trust boundaries.
✓ Test Coverage
The diff is a pure formatting change — it consolidates multi-line assert failure messages onto single lines. No logic, behaviour, or test coverage is added, removed, or altered. The assertions themselves remain semantically identical, and no new code paths are introduced. From a test-coverage perspective there is nothing to flag.
Automated review by moonbox3's agents
There was a problem hiding this comment.
Pull request overview
Adds regression coverage to ensure declarative workflows correctly initialize Workflow.Inputs at the Entry node so PowerFx expressions referencing inputs.* behave correctly when workflow.run() is invoked with dict or string inputs (fixes #3948 regression risk).
Changes:
- Add a regression test verifying dict inputs populate
inputs.ageso anIfcondition routes to the correct branch. - Add a regression test verifying string inputs populate
inputs.inputso the value is accessible in expressions.
Motivation and Context
Note: the original bug is already fixed in main. This PR is adding more tests around it.
When
workflow.run()is called with a dict or string input, the Entry node (JoinExecutorwithkind: 'Entry') must call_ensure_state_initializedto populateWorkflow.Inputs. Without this, expressions like=inputs.ageresolve to blank, causing conditions like=Local.age < 13to always evaluate as true (blank is treated as 0), silently routing all inputs to the wrong branch.Fixes #3948
Description
The root cause is that the Entry
JoinExecutorwas not initializingWorkflow.Inputsbefore the workflow's action nodes began executing, leaving input-referencing expressions with no data to resolve. This PR adds two regression tests that directly exercise the broken path: one passing a dict input and asserting the correct conditional branch is taken for both child and adult ages, and one passing a string input and asserting it is accessible viainputs.input. These tests lock in the correct behavior and will catch any future regression in Entry node state initialization.Contribution Checklist