Python: Preserve falsey EditTableV2 items - #7380
Draft
hsusul wants to merge 1 commit into
Draft
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a Python declarative workflow bug where EditTableV2 incorrectly treated valid falsey item values (False, 0, "", [], {}) as “missing” due to a truthiness-based fallback, causing the executor to instead use the legacy value field (or None) and corrupt table contents.
Changes:
- Update
EditTableV2Executorto selectitemvia an explicitNonecheck, preserving falsey values while keeping the legacyvaluefallback whenitem is None. - Add regression tests covering falsey
itemvalues and a boundary test confirming the legacyvaluefallback remains whenitemisNone.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| python/packages/declarative/agent_framework_declarative/_workflows/_executors_basic.py | Replace truthiness fallback with an explicit None check so falsey item values are preserved. |
| python/packages/declarative/tests/test_graph_executors.py | Add regression/boundary tests ensuring falsey item values are retained and legacy value fallback still works when item is None. |
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.
Motivation & Context
EditTableV2accepts YAML/JSON values through itsitemfield, including valid falsey values such asfalse,0, an empty string, an empty list, or an empty object. The Python executor currently selectsitemwith a truthiness fallback, so adding any of those values stores the legacyvaluefield instead (orNonewhenvalueis absent). For example, addingitem: falseto[true]deterministically produces[true, null]instead of[true, false], corrupting the workflow table value.Description & Review Guide
Nonecheck, and add regression coverage forFalse,0,"",[], and{}plus boundary coverage that preserves the existing legacyvaluefallback whenitemisNone. Local checks passed:uv run poe test -P declarative(686 passed, 254 skipped),uv run poe syntax -P declarative(2 tasks passed),uv run poe pyright -P declarative(0 errors),uv run poe check(all syntax, source typing, test typing, package tests, and Markdown code checks passed with exit 0), andgit diff --check.Nonecontinues to act as the missing-item sentinel for compatibility with the legacyvaluefield. There are no public API, schema, provider, or unrelated operation changes.itemand the existingNonefallback behavior.Related Issue
Fixes #7379
No other open pull request for #7379 was found during the duplicate check.
Contribution Checklist
breaking changelabel (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.