fix: align human input ci expectations

This commit is contained in:
-LAN-
2026-03-17 19:37:56 +08:00
parent 5cdce96580
commit 5ea7dcb1a8
7 changed files with 22 additions and 8 deletions

View File

@@ -15,6 +15,7 @@ from core.workflow.human_input_compat import (
EmailRecipients,
ExternalRecipient,
InteractiveSurfaceDeliveryMethod,
is_human_input_webapp_enabled,
)
from dify_graph.nodes.human_input.entities import FormDefinition, HumanInputNodeData
from dify_graph.nodes.human_input.enums import HumanInputFormKind, HumanInputFormStatus
@@ -406,7 +407,7 @@ class HumanInputFormRepositoryImpl:
if self._invoke_source == "debugger":
return True
if self._invoke_source == "explore":
return form_config.is_webapp_enabled()
return is_human_input_webapp_enabled(form_config)
return False
def _should_create_backstage_recipient(self, *, form_kind: HumanInputFormKind) -> bool:

View File

@@ -601,6 +601,9 @@ class DifyHumanInputNodeRuntime(HumanInputNodeRuntimeProtocol):
if self._form_repository is not None:
return self._form_repository
return self._build_form_repository()
def _build_form_repository(self) -> HumanInputFormRepository:
invoke_source = self._invoke_source()
return HumanInputFormRepositoryImpl(
tenant_id=self._run_context.tenant_id,

View File

@@ -19,6 +19,10 @@ VariableValue = Union[str, int, float, dict[str, object], list[object], File]
VARIABLE_PATTERN = re.compile(r"\{\{#([a-zA-Z0-9_]{1,50}(?:\.[a-zA-Z_][a-zA-Z0-9_]{0,29}){1,10})#\}\}")
def _default_variable_dictionary() -> defaultdict[str, dict[str, Variable]]:
return defaultdict(dict)
class VariablePool(BaseModel):
_SYSTEM_VARIABLE_NODE_ID = "sys"
_ENVIRONMENT_VARIABLE_NODE_ID = "env"
@@ -31,7 +35,7 @@ class VariablePool(BaseModel):
# elements of the selector except the first one.
variable_dictionary: defaultdict[str, Annotated[dict[str, Variable], Field(default_factory=dict)]] = Field(
description="Variables mapping",
default_factory=lambda: defaultdict(dict),
default_factory=_default_variable_dictionary,
)
system_variables: Sequence[Variable] = Field(default_factory=tuple, exclude=True)
environment_variables: Sequence[Variable] = Field(default_factory=tuple, exclude=True)

View File

@@ -310,7 +310,7 @@ class TestStorageKeyLoader(unittest.TestCase):
with pytest.raises(ValueError) as context:
self.loader.load_storage_keys([file_other])
assert "invalid file, expected tenant_id" in str(context.value)
assert "Upload file not found for id:" in str(context.value)
# Current tenant's file should still work
self.loader.load_storage_keys([file_current])
@@ -334,7 +334,7 @@ class TestStorageKeyLoader(unittest.TestCase):
with pytest.raises(ValueError) as context:
self.loader.load_storage_keys([file_current, file_other])
assert "invalid file, expected tenant_id" in str(context.value)
assert "Upload file not found for id:" in str(context.value)
def test_load_storage_keys_duplicate_file_ids(self):
"""Test handling of duplicate file IDs in the batch."""

View File

@@ -311,7 +311,7 @@ class TestStorageKeyLoader(unittest.TestCase):
with pytest.raises(ValueError) as context:
self.loader.load_storage_keys([file_other])
assert "invalid file, expected tenant_id" in str(context.value)
assert "Upload file not found for id:" in str(context.value)
# Current tenant's file should still work
self.loader.load_storage_keys([file_current])
@@ -335,7 +335,7 @@ class TestStorageKeyLoader(unittest.TestCase):
with pytest.raises(ValueError) as context:
self.loader.load_storage_keys([file_current, file_other])
assert "invalid file, expected tenant_id" in str(context.value)
assert "Upload file not found for id:" in str(context.value)
def test_load_storage_keys_duplicate_file_ids(self):
"""Test handling of duplicate file IDs in the batch."""

View File

@@ -7,6 +7,7 @@ from dify_graph.graph_events import (
NodeRunStartedEvent,
NodeRunStreamChunkEvent,
NodeRunSucceededEvent,
NodeRunVariableUpdatedEvent,
)
from .test_mock_config import MockConfigBuilder
@@ -44,12 +45,16 @@ def test_loop_with_tool():
NodeRunStartedEvent,
NodeRunSucceededEvent,
NodeRunStartedEvent,
NodeRunVariableUpdatedEvent,
NodeRunVariableUpdatedEvent,
NodeRunSucceededEvent,
NodeRunLoopNextEvent,
# 2024
NodeRunStartedEvent,
NodeRunSucceededEvent,
NodeRunStartedEvent,
NodeRunVariableUpdatedEvent,
NodeRunVariableUpdatedEvent,
NodeRunSucceededEvent,
# LOOP END
NodeRunLoopSucceededEvent,

View File

@@ -305,8 +305,9 @@ class TestRecipients:
with pytest.raises(ValidationError):
MemberRecipient(type=EmailRecipientType.MEMBER, user_id="user-123")
with pytest.raises(ValidationError):
EmailRecipients(whole_workspace=True, items=[])
recipients = EmailRecipients(whole_workspace=True, items=[])
assert recipients.include_bound_group is True
assert recipients.items == []
class TestHumanInputNodeVariableResolution: