dify/api/tests/unit_tests/services/workflow
GareArc f533e992d4
fix(hitl): scope OpenAPI/Service-API resume to author-configured webapp forms
Pause-time token emission now draws only from the recipient set each API
surface is allowed to act on (emit ⊆ validate), so the CLI/OpenAPI caller is
never handed a token the resume endpoint would reject as 404 (WTA-867).

A form's recipients are partitioned once, per surface, into a single
FormDisposition: the surface-actionable recipient yields `form_token`, while
the rest are reported as `approval_channels` (e.g. ["email", "console"]) so the
caller is told where approval actually happens. Token and channels are two
projections of one decision (disposition_for_surface) loaded by one recipient
query (load_form_dispositions_by_form_id); the live pause path and the
reconnect snapshot path consume the same FormDisposition so they cannot drift.

RecipientType carries its user-facing approval-channel label as an enum tuple
value, set in __new__, so a new recipient type cannot be declared without one.

Tests: consolidate recipient/disposition/enrich tests into parametrized
matrices, add CONSOLE-surface and empty-token coverage, extract a shared fake
session for the pause-event tests.
2026-06-16 16:11:29 -07:00
..
__init__.py FEAT: NEW WORKFLOW ENGINE (#3160) 2024-04-08 18:51:46 +08:00
test_draft_var_loader_simple.py refactor: port WorkflowDraftVariableFile (#30923) 2026-04-29 22:21:20 +00:00
test_inspector_events.py feat(api): Node Output Inspector service + 3 REST endpoints (Stage 4 §8) (#36644) 2026-05-26 07:34:33 +00:00
test_node_output_inspector_service.py feat(dify-agent): sync shell and back proxy updates (#37159) 2026-06-10 03:04:32 +00:00
test_queue_dispatcher.py chore(api): convert BaseQueueDispatcher from ABC to Protocol (#37200) 2026-06-09 02:56:29 +00:00
test_scheduler.py chore(api): Fix several typing errors (#37119) 2026-06-06 01:44:32 +00:00
test_workflow_converter_additional.py test: add unit tests for services and tasks part-4 (#33223) 2026-04-02 08:35:46 +00:00
test_workflow_draft_variable_service.py fix: validate conversation variable description length to prevent varchar(255) truncation error (#33038) 2026-06-10 07:28:12 +00:00
test_workflow_event_snapshot_service_additional.py chore: add Type to test (#35942) 2026-05-09 03:16:22 +00:00
test_workflow_event_snapshot_service.py fix(hitl): scope OpenAPI/Service-API resume to author-configured webapp forms 2026-06-16 16:11:29 -07:00
test_workflow_human_input_delivery.py feat(api): introduce select, file and file list form input types to Human Input node (#36322) 2026-06-04 01:54:28 +00:00
test_workflow_restore.py fix: adding a restore API for version control on workflow draft (#33582) 2026-03-20 14:54:23 +08:00