feat(human-input): expose selected action value (#35451)

This commit is contained in:
Blackoutta
2026-05-11 02:16:29 +00:00
committed by GitHub
parent e8dc706414
commit 0b70eec695
9 changed files with 33 additions and 13 deletions
+5
View File
@@ -1066,8 +1066,13 @@ class WorkflowService:
)
rendered_content = node.render_form_content_before_submission()
selected_action = next(
(user_action for user_action in node_data.user_actions if user_action.id == action),
None,
)
outputs: dict[str, Any] = dict(form_inputs)
outputs["__action_id"] = action
outputs["__action_value"] = selected_action.title if selected_action else ""
outputs["__rendered_content"] = node.render_form_content_with_outputs(
rendered_content, outputs, node_data.outputs_field_names()
)
@@ -11,6 +11,7 @@ This test suite covers:
import json
import uuid
from types import SimpleNamespace
from typing import Any, cast
from unittest.mock import ANY, MagicMock, Mock, patch, sentinel
@@ -2649,7 +2650,12 @@ class TestWorkflowServiceHumanInputOperations:
mock_node = MagicMock()
mock_node.node_data = MagicMock()
mock_node.node_data.user_actions = [
SimpleNamespace(id="submit", title="card_visa_enterprise_001"),
]
mock_node.node_data.outputs_field_names.return_value = ["field1"]
mock_node.render_form_content_before_submission.return_value = "Ticket: {{#$output.field1#}}"
mock_node.render_form_content_with_outputs.return_value = "Ticket: val1"
with (
patch("services.workflow_service.db"),
@@ -2665,6 +2671,8 @@ class TestWorkflowServiceHumanInputOperations:
app_model=app_model, account=account, node_id="node-1", form_inputs={"field1": "val1"}, action="submit"
)
assert result["__action_id"] == "submit"
assert result["__action_value"] == "card_visa_enterprise_001"
assert result["__rendered_content"] == "Ticket: val1"
mock_saver_cls.return_value.save.assert_called_once()
def test_test_human_input_delivery_success(self, service: WorkflowService) -> None: