Skip to content

fix(workflow): recognize hyphenated node references consistently - #44036

Open
zyssyz123 wants to merge 1 commit into
mainfrom
fix/hyphenated-template-node-ids
Open

zyssyz123 wants to merge 1 commit into
mainfrom
fix/hyphenated-template-node-ids

Conversation

@zyssyz123

Copy link
Copy Markdown
Contributor

Important

  1. Contribution guidelines reviewed.
  2. Associated issue: Snippet-inserted nodes get hyphenated IDs that the variable template regex cannot parse, so {{#nodeId.var#}} is sent to the LLM unsubstituted #43830.
  3. This is the Dify-side companion to the Graphon runtime fix; it does not close the issue independently.

Summary

Refs #43830.

Recognize existing hyphenated node IDs in workflow-aware Prompt parsing, skipped-branch reference warnings, and RAG datasource parameter/input discovery. These paths currently ignore references such as {{#input-check.text#}} even though the frontend accepts the node ID. Only the node-ID character class is extended; IDs are not renamed and the remaining grammar is unchanged.

The Graphon runtime parser fix is langgenius/graphon#340. This PR deliberately leaves the pinned Graphon 0.7.0 dependency unchanged: normal rollout needs a compatible Graphon release/backport followed by a dependency update. It should not trigger an unrelated upgrade to Graphon 0.8.0. The workflow generator's existing ID-generation policy is unchanged.

Validation:

  • New cases failed before the changes: 8 failed / 8 passing controls.
  • Four complete affected test modules: 164 passed.
  • Ruff formatting/lint, target-file type checks, and git diff --check passed.
  • Verified together with the Graphon runtime edits on dev using the existing deployed 0.7.0 dependency. LLMNode.run() passed the resolved red and blue inputs to a local capture model adapter, without external model calls.

Screenshots

Backend change; representative captured USER prompt:

Before After
Please process: {{#input-check.validated_input#}} Please process: red

Checklist

  • This change requires a documentation update, included: Dify Document
  • I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!)
  • I've verified the change and added or updated tests where meaningful regression risk justifies coverage.
  • I've updated the documentation accordingly.
  • I ran make lint && make type-check (backend) and vp staged (frontend) to appease the lint gods

No frontend changes or documentation update required. Targeted backend lint/type checks are listed above; the full repository-wide lint/type commands were not run.

From Codex

@github-actions github-actions Bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Oct 14, 2026
@ghfind-review ghfind-review Bot added the review: high ghfind author score; see https://ghfind.com label Oct 14, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Pyrefly Type Coverage

Metric Base PR Delta
Type coverage 74.19% 74.19% +0.00%
Strict coverage 73.85% 73.85% +0.00%
Typed symbols 60,163 60,173 +10
Untyped symbols 21,030 21,029 -1
Modules 3746 3746 0

@github-actions

Copy link
Copy Markdown
Contributor

Pyrefly Diff

base → PR
--- /tmp/pyrefly_base.txt	2026-10-14 02:30:05.174143202 +0000
+++ /tmp/pyrefly_pr.txt	2026-10-14 02:29:54.406079422 +0000
@@ -5801,13 +5801,13 @@
 ERROR Argument `dict[str, list[dict[str, dict[str, str | dict[str, str] | dict[str, int | str]]]]]` is not assignable to parameter `graph` with type `dict[str, object] | None` in function `_make_workflow` [bad-argument-type]
    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:623:67
 ERROR Argument `() -> tuple[SimpleNamespace, Generator[NodeRunFailedEvent, Unknown]]` is not assignable to parameter `getter` with type `() -> tuple[Node[Unknown], Generator[GraphNodeEventBase | IterationFrameRequest | LoopFrameRequest]]` in function `services.rag_pipeline.rag_pipeline.RagPipelineService._handle_node_run_result` [bad-argument-type]
-    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:1462:16
+    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:1472:16
 ERROR Argument `() -> tuple[SimpleNamespace, Generator[object, Unknown]]` is not assignable to parameter `getter` with type `() -> tuple[Node[Unknown], Generator[GraphNodeEventBase | IterationFrameRequest | LoopFrameRequest]]` in function `services.rag_pipeline.rag_pipeline.RagPipelineService._handle_node_run_result` [bad-argument-type]
-    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:1866:20
+    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:1877:20
 ERROR Argument `() -> tuple[SimpleNamespace, Iterator[NodeRunFailedEvent]]` is not assignable to parameter `getter` with type `() -> tuple[Node[Unknown], Generator[GraphNodeEventBase | IterationFrameRequest | LoopFrameRequest]]` in function `services.rag_pipeline.rag_pipeline.RagPipelineService._handle_node_run_result` [bad-argument-type]
-    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:1886:16
+    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:1897:16
 ERROR Argument `() -> tuple[SimpleNamespace, Iterator[NodeRunFailedEvent]]` is not assignable to parameter `getter` with type `() -> tuple[Node[Unknown], Generator[GraphNodeEventBase | IterationFrameRequest | LoopFrameRequest]]` in function `services.rag_pipeline.rag_pipeline.RagPipelineService._handle_node_run_result` [bad-argument-type]
-    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:1906:16
+    --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_service.py:1917:16
 ERROR No matching overload found for function `typing.MutableMapping.update` called with arguments: (dict[str, object]) [no-matching-overload]
   --> tests/unit_tests/services/rag_pipeline/test_rag_pipeline_transform_service.py:29:18
 ERROR No matching overload found for function `typing.MutableMapping.update` called with arguments: (dict[str, object]) [no-matching-overload]

@codecov

codecov Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.92%. Comparing base (e2ae06a) to head (1a209a6).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #44036      +/-   ##
==========================================
- Coverage   88.92%   88.92%   -0.01%     
==========================================
  Files        5327     5327              
  Lines      328950   328950              
  Branches    65847    65847              
==========================================
- Hits       292532   292530       -2     
- Misses      31230    31231       +1     
- Partials     5188     5189       +1     
Flag Coverage Δ
api 88.47% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@zyssyz123
zyssyz123 enabled auto-merge October 14, 2026 07:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review: high ghfind author score; see https://ghfind.com size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant