fix(graph_workflow): report node type value in export_summary - #2027
Open
aayushbaluni wants to merge 1 commit into
Open
fix(graph_workflow): report node type value in export_summary#2027aayushbaluni wants to merge 1 commit into
aayushbaluni wants to merge 1 commit into
Conversation
`export_summary` built its agent entries with `str(node.type)`, which renders as "NodeType.AGENT" rather than the enum value "agent". Every other serializer emits the value: `to_dict`/`to_spec` via the node payload helper, `to_json` via its own node payload, and `from_json` parses with `_parse_node_type`. `export_summary` was the last site still emitting the repr, so the summary disagreed with the exports for the same workflow and leaked a Python-internal spelling into user-facing output. Adds a regression test asserting the summary reports "agent" and matches what the deep export writes for the same nodes.
|
Hello there, thank you for opening an PR ! 🙏🏻 The team was notified and they will get back to you asap. |
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.
Summary
export_summaryreports node types as"NodeType.AGENT"instead of the enum value"agent", disagreeing with every other serializer in the file.This is a follow-up to #2017, which consolidated
GraphWorkflow's serialization internals and fixed the round-trip bug from #1839. That work switched the node payload helpers tonode.type.valueand added_parse_node_typefor the legacy spelling. One call site was not converted.The bug
NodeTypeis astrEnum, sostr(node.type)renders the repr, not the value. Observed on currentmaster:Every other serializer emits the value (
_node_payloadforto_dict/to_spec, andto_json's own node payload), andfrom_jsonparses with_parse_node_type. So the same workflow describes its node types two different ways depending on which method you call.Scope
This is cosmetic, not a functional break. Nothing deserializes a summary, so unlike #1839 it cannot cause a load failure. It matters because it leaks a Python-internal spelling into user-facing output and is inconsistent with the exports, which is exactly the confusion #1839 started from.
The fix is one line, matching the convention already used elsewhere in the file:
Testing
Added
test_export_summary_reports_node_type_value, which asserts the summary reports"agent"and that it agrees with what the deep export writes for the same nodes.tests/structs/test_graph_workflow.py: 59 passed, 11 skipped (58 passed before, +1 new)str(node.type)fails the new test withAssertionError: assert ['NodeType.AGENT', 'NodeType.AGENT'] == ['agent', 'agent']and leaves the other 58 green, so the test measures the fix rather than decorating itblack --line-length 70: cleanruff check swarms/structs/graph_workflow.py: 236 errors before and 236 after, all pre-existing and unrelated, so this adds noneCloses the residual part of #1839. My earlier PR #1898 is closed as superseded by #2017.