-
Notifications
You must be signed in to change notification settings - Fork 18
[APO-2321] Make entrypoint node optional in Python SDK serialization #3346
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
17c2c26
[APO-2321] Make entrypoint node optional in Python SDK serialization
devin-ai-integration[bot] f77fa1c
Fix: restore non_trigger_entrypoint_nodes variable for edge generation
devin-ai-integration[bot] df9d8dd
Fix: backfill entrypoint defaults and skip ENTRYPOINT for trigger-onl…
devin-ai-integration[bot] 61106c0
Fix: rename display_data variables to avoid mypy type inference issues
devin-ai-integration[bot] 6d159a3
Add regression test for partial WorkflowMetaDisplay override
devin-ai-integration[bot] 2f157d9
Fix mypy type errors in regression test
devin-ai-integration[bot] ad8cd53
Fix duplicate edge IDs for multiple triggers targeting same node
devin-ai-integration[bot] 3ae8213
Update snapshot for simple_manual_trigger_workflow edge ID
devin-ai-integration[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
55 changes: 55 additions & 0 deletions
55
...flows/display/tests/workflow_serialization/test_partial_workflow_meta_display_override.py
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| """Tests for partial WorkflowMetaDisplay override serialization.""" | ||
|
|
||
| from vellum.workflows import BaseWorkflow | ||
| from vellum.workflows.inputs.base import BaseInputs | ||
| from vellum.workflows.nodes.bases.base import BaseNode | ||
| from vellum.workflows.state.base import BaseState | ||
| from vellum_ee.workflows.display.base import WorkflowDisplayData, WorkflowDisplayDataViewport, WorkflowMetaDisplay | ||
| from vellum_ee.workflows.display.workflows.base_workflow_display import BaseWorkflowDisplay | ||
| from vellum_ee.workflows.display.workflows.get_vellum_workflow_display_class import get_workflow_display | ||
|
|
||
|
|
||
| def test_triggerless_workflow_with_partial_display_override_creates_entrypoint(): | ||
| """ | ||
| Tests that a triggerless workflow with partial WorkflowMetaDisplay overrides | ||
| (only display_data set) still creates an ENTRYPOINT node with backfilled IDs. | ||
| """ | ||
|
|
||
| # GIVEN a simple triggerless workflow | ||
| class ProcessNode(BaseNode): | ||
| pass | ||
|
|
||
| class TestWorkflow(BaseWorkflow[BaseInputs, BaseState]): | ||
| graph = ProcessNode | ||
|
|
||
| # AND a display class that only overrides display_data (viewport), not entrypoint IDs | ||
| class TestWorkflowDisplay(BaseWorkflowDisplay[TestWorkflow]): | ||
| workflow_display = WorkflowMetaDisplay( | ||
| display_data=WorkflowDisplayData(viewport=WorkflowDisplayDataViewport(x=100.0, y=200.0, zoom=1.5)) | ||
| ) | ||
|
|
||
| # WHEN we serialize the workflow | ||
| result = get_workflow_display(workflow_class=TestWorkflow).serialize() | ||
|
|
||
| # THEN the workflow should have an ENTRYPOINT node | ||
| workflow_raw_data = result["workflow_raw_data"] | ||
| assert isinstance(workflow_raw_data, dict) | ||
| nodes = workflow_raw_data["nodes"] | ||
| assert isinstance(nodes, list) | ||
| entrypoint_nodes = [n for n in nodes if isinstance(n, dict) and n.get("type") == "ENTRYPOINT"] | ||
| assert len(entrypoint_nodes) == 1, "Triggerless workflow with partial overrides should have an ENTRYPOINT node" | ||
|
|
||
| # AND the ENTRYPOINT node should have valid IDs (not None) | ||
| entrypoint_node = entrypoint_nodes[0] | ||
| assert isinstance(entrypoint_node, dict) | ||
| assert entrypoint_node["id"] is not None, "ENTRYPOINT node should have a non-None id" | ||
| entrypoint_data = entrypoint_node["data"] | ||
| assert isinstance(entrypoint_data, dict) | ||
| source_handle_id = entrypoint_data["source_handle_id"] | ||
| assert source_handle_id is not None, "ENTRYPOINT node should have a non-None source_handle_id" | ||
|
|
||
| # AND there should be an edge from ENTRYPOINT to the process node | ||
| edges = workflow_raw_data["edges"] | ||
| assert isinstance(edges, list) | ||
| entrypoint_edges = [e for e in edges if isinstance(e, dict) and e.get("source_node_id") == entrypoint_node["id"]] | ||
| assert len(entrypoint_edges) > 0, "Should have edges from ENTRYPOINT node" |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The entrypoint metadata on
WorkflowMetaDisplayis now optional (lines 52‑54), but_generate_workflow_meta_displaystill copies user overrides verbatim whileserialize()only builds an ENTRYPOINT node when both IDs are set (base_workflow_display.py:299‑305). For a triggerless workflow that overrides only the viewport, e.g.workflow_display = WorkflowMetaDisplay(display_data=…), the IDs default toNone, the guard skips node creation, and the serialized workflow ends up missing the required ENTRYPOINT node. This newly breaks serialization for workflows without triggers whenever partial overrides are supplied.Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks legit