Skip to content

Python: Add regression tests for Entry JoinExecutor Workflow.Inputs initialization#4335

Open
moonbox3 wants to merge 4 commits intomicrosoft:mainfrom
moonbox3:agent/fix-3948-1
Open

Python: Add regression tests for Entry JoinExecutor Workflow.Inputs initialization#4335
moonbox3 wants to merge 4 commits intomicrosoft:mainfrom
moonbox3:agent/fix-3948-1

Conversation

@moonbox3
Copy link
Contributor

@moonbox3 moonbox3 commented Feb 27, 2026

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 (JoinExecutor with kind: 'Entry') must call _ensure_state_initialized to populate Workflow.Inputs. Without this, expressions like =inputs.age resolve to blank, causing conditions like =Local.age < 13 to 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 JoinExecutor was not initializing Workflow.Inputs before 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 via inputs.input. These tests lock in the correct behavior and will catch any future regression in Entry node state initialization.

Contribution Checklist

  • The code builds clean without any errors or warnings
  • The PR follows the Contribution Guidelines
  • All unit tests pass, and I have added new tests where possible
  • Is this a breaking change? If yes, add "[BREAKING]" prefix to the title of the PR.

Note: PR autogenerated by moonbox3's agent

moonbox3 and others added 2 commits February 27, 2026 09:42
…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>
Copilot AI review requested due to automatic review settings February 27, 2026 00:44
Copy link
Contributor Author

@moonbox3 moonbox3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@markwallace-microsoft
Copy link
Member

markwallace-microsoft commented Feb 27, 2026

Python Test Coverage

Python Test Coverage Report •
FileStmtsMissCoverMissing
packages/azurefunctions/agent_framework_azurefunctions
   _app.py50017265%261–262, 265, 267–269, 275, 277–280, 282–283, 285–287, 291, 294, 296, 298–299, 302–304, 306, 308, 316, 324–327, 330, 333, 338–339, 342–345, 348, 351–353, 364–367, 373, 375, 383–384, 387, 392–393, 395–396, 398, 401, 404, 406, 408, 410–412, 416–419, 421, 423–424, 426, 437–439, 443–444, 446–447, 449, 460–465, 473, 475, 481–483, 489–490, 492–493, 495–498, 502, 508, 527, 626–627, 735, 743–744, 764–766, 772–774, 780–782, 815–816, 876–877, 926–927, 932, 1014, 1017, 1026–1028, 1030–1032, 1034, 1036, 1047, 1049–1052, 1054, 1056–1057, 1059, 1066–1067, 1069–1070, 1072–1073, 1075, 1079, 1089–1091, 1093–1094, 1096–1098, 1105, 1107–1108, 1110, 1131, 1136, 1148, 1220, 1310, 1325–1328, 1353
packages/core/agent_framework
   _types.py10248691%59, 68–69, 123, 128, 147, 149, 153, 157, 159, 161, 163, 181, 185, 211, 233, 238, 243, 247, 273, 277, 632–633, 1004, 1066, 1083, 1101, 1106, 1124, 1134, 1151–1152, 1154, 1172–1173, 1175, 1182–1183, 1185, 1220, 1231–1232, 1234, 1272, 1499, 1551, 1642–1647, 1669, 1674, 1840, 1852, 2104, 2125, 2220, 2449, 2656, 2726, 2738, 2756, 2954–2956, 2959–2961, 2965, 2970, 2974, 3058–3060, 3089, 3143, 3162–3163, 3166–3170, 3176
packages/core/agent_framework/_workflows
   _workflow.py2601992%87, 268–270, 272–273, 291, 295, 423, 611, 632, 688, 700, 706, 711, 731–733, 746
TOTAL22208276087% 

Python Unit Test Overview

Tests Skipped Failures Errors Time
4709 247 💤 0 ❌ 0 🔥 1m 20s ⏱️

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.age so an If condition routes to the correct branch.
  • Add a regression test verifying string inputs populate inputs.input so the value is accessible in expressions.

@moonbox3 moonbox3 requested a review from a team as a code owner February 27, 2026 01:55
@moonbox3 moonbox3 removed the request for review from a team February 27, 2026 02:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Python: [Bug]: DeclarativeWorkflowBuilder - Entry JoinExecutor does not initialize Workflow.Inputs

4 participants