[PR #23766] fix: update integration tests to use 2-element variable selectors #30387

Closed
opened 2026-02-21 20:47:24 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/langgenius/dify/pull/23766

State: closed
Merged: Yes


Problem

After the VariablePool refactoring in commit 577062b93, 24 integration tests are failing with the error:

ValueError: Invalid selector: expected 2 elements (node_id, variable_name), got 3 elements

This is blocking multiple PRs from being merged as CI consistently fails on the integration test phase.

Root Cause

The VariablePool API was refactored to only accept 2-element variable selectors, but the integration tests were not updated to match this change.

What changed:

  • Before: ["node_id", "node_title", "variable_name"] (3 elements)
  • After: ["node_id", "variable_name"] (2 elements only)

Why the original refactor PR passed CI:

  1. Unit tests were properly updated by the author
  2. Integration tests still used the old 3-element format
  3. Integration tests likely failed silently due to Docker environment issues or CI configuration problems

Solution

Remove the middle element (node_title) from all variable selectors in integration tests, keeping only the essential node_id and variable_name.

Example fixes:

# Before (❌)
variable_pool.add(["code", "123", "args1"], 1)
"value_selector": ["1", "123", "args1"]

# After (✅)
variable_pool.add(["code", "args1"], 1)  
"value_selector": ["1", "args1"]

Files Changed

  • api/tests/integration_tests/workflow/nodes/test_code.py
  • api/tests/integration_tests/workflow/nodes/test_http.py
  • api/tests/integration_tests/workflow/nodes/test_template_transform.py
  • api/tests/integration_tests/workflow/nodes/test_parameter_extractor.py
  • api/tests/integration_tests/workflow/nodes/test_tool.py

Impact

  • Fixes 24 failing integration tests
  • Unblocks CI for all pending PRs
  • Maintains test semantic correctness (node_id is sufficient for identification)
  • Aligns tests with the new VariablePool architecture

This fix restores the integration test suite to working condition and allows normal development workflow to resume.

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 added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.
  • I ran dev/reformat(backend) and cd web && npx lint-staged(frontend) to appease the lint gods
**Original Pull Request:** https://github.com/langgenius/dify/pull/23766 **State:** closed **Merged:** Yes --- ## Problem After the VariablePool refactoring in commit `577062b93`, 24 integration tests are failing with the error: ``` ValueError: Invalid selector: expected 2 elements (node_id, variable_name), got 3 elements ``` This is blocking multiple PRs from being merged as CI consistently fails on the integration test phase. ## Root Cause The VariablePool API was refactored to only accept 2-element variable selectors, but the integration tests were not updated to match this change. **What changed:** - **Before**: `["node_id", "node_title", "variable_name"]` ✅ (3 elements) - **After**: `["node_id", "variable_name"]` ✅ (2 elements only) **Why the original refactor PR passed CI:** 1. Unit tests were properly updated by the author 2. Integration tests still used the old 3-element format 3. Integration tests likely failed silently due to Docker environment issues or CI configuration problems ## Solution Remove the middle element (node_title) from all variable selectors in integration tests, keeping only the essential node_id and variable_name. **Example fixes:** ```python # Before (❌) variable_pool.add(["code", "123", "args1"], 1) "value_selector": ["1", "123", "args1"] # After (✅) variable_pool.add(["code", "args1"], 1) "value_selector": ["1", "args1"] ``` ## Files Changed - `api/tests/integration_tests/workflow/nodes/test_code.py` - `api/tests/integration_tests/workflow/nodes/test_http.py` - `api/tests/integration_tests/workflow/nodes/test_template_transform.py` - `api/tests/integration_tests/workflow/nodes/test_parameter_extractor.py` - `api/tests/integration_tests/workflow/nodes/test_tool.py` ## Impact - ✅ Fixes 24 failing integration tests - ✅ Unblocks CI for all pending PRs - ✅ Maintains test semantic correctness (node_id is sufficient for identification) - ✅ Aligns tests with the new VariablePool architecture This fix restores the integration test suite to working condition and allows normal development workflow to resume. ## Checklist - [ ] This change requires a documentation update, included: [Dify Document](https://github.com/langgenius/dify-docs) - [x] I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!) - [x] I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change. - [x] I've updated the documentation accordingly. - [x] I ran `dev/reformat`(backend) and `cd web && npx lint-staged`(frontend) to appease the lint gods
yindo added the pull-request label 2026-02-21 20:47:24 -05:00
yindo closed this issue 2026-02-21 20:47:24 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#30387