Skip to content

fix(processing): keep JSON Operations inputs visible after Update Component - #15833

Merged
erichare merged 2 commits into
release-1.13.0from
fix/json-operations-update-visibility
Oct 17, 2026
Merged

erichare merged 2 commits into
release-1.13.0from
fix/json-operations-update-visibility

Conversation

@erichare

Copy link
Copy Markdown
Member

Summary

Clicking Update on a saved JSON Operations node (the legacy DataOperationsComponent) hides the selected operation's inputs. The node keeps its operation and saved values, but the field disappears, and the graph build skips hidden fields. A Select Keys ['text'] node then returns {} instead of {"text": ...}, with no error.

The cause is the same one #15812 fixed for Data Operations. update_frontend_node rebuilds the template from class defaults, where every operation field has show=False. The generic merge copies back values only, so nothing re-applies visibility.

This adds an update_frontend_node override to DataOperationsComponent, following the #15812 pattern in operations.py:

  • Read the selected operation from template["operations"]["value"].
  • Show only that operation's fields from actions_data. Hide the rest of ALL_OPERATION_FIELDS. Saved values are not touched.
  • Restore data.is_list from ACTION_CONFIG, as update_build_config does.
  • For Path Selection, rebuild the selected_key dropdown options from the saved mapped_json_display. Hide selected_key if the saved JSON does not parse.

No operation, more than one, or a removed one such as Filter Values leaves every operation field hidden. That matches what update_build_config produces.

The component index entry for DataOperationsComponent (code and code_hash) is regenerated.

Found by the 1.13.0rc1 smoke test. The bug is also in 1.12.6, so it is not an rc1 regression.

Tests

New class TestUpdateFrontendNodeRestoresVisibility in src/backend/tests/unit/components/processing/test_data_operations_component.py. Each test builds a node the way the canvas saves it, by running the component's own update_build_config for the chosen operation and values. It then puts that node through the Update path: a fresh class-default template plus update_frontend_node.

  • For every operation in actions_data: the visible operation fields after Update match that operation's fields and the saved node's flags. data.is_list matches ACTION_CONFIG.
  • The saved Select Keys value ['text'] survives Update.
  • No operation, or the removed Filter Values operation, keeps all operation fields hidden.
  • Path Selection gets its selected_key options back. Invalid saved JSON keeps selected_key hidden.
  • Run output is unchanged by Update for Select Keys, Remove Keys, Rename Keys, Append or Update, JQ Expression, and Path Selection. The node is loaded through a real Graph.from_payload, so ParameterHandler drops hidden fields just as it does in a real run.

Verification

# Before the fix (new tests only)
uv run pytest src/backend/tests/unit/components/processing/test_data_operations_component.py -k TestUpdateFrontendNodeRestoresVisibility -q -p no:randomly
# 17 failed, 2 passed. The run test for Select Keys failed with `assert {} == {'text': 'hello'}`, the smoke-test symptom.

# After the fix
uv run pytest src/backend/tests/unit/components/processing/test_data_operations_component.py src/backend/tests/unit/components/processing/test_operations_component.py src/backend/tests/unit/components/processing/test_append_data_payload.py -q -p no:randomly
# 207 passed, 8 skipped (the existing version tests, which have no file mapping)

uv run pytest src/backend/tests/unit/test_code_hash.py src/backend/tests/unit/components/processing/ -q -p no:randomly -n auto
# 499 passed, 37 skipped

# lfx index tests, in an isolated venv because they require langflow not to be installed
cd src/lfx && UV_PROJECT_ENVIRONMENT=<scratch venv> uv sync --group dev && uv run pytest tests/unit/test_component_index.py -q -p no:randomly
# 31 passed

uv run ruff format --check src/lfx/src/lfx/components/processing/data_operations.py src/backend/tests/unit/components/processing/test_data_operations_component.py
uv run ruff check src/lfx/src/lfx/components/processing/data_operations.py src/backend/tests/unit/components/processing/test_data_operations_component.py
# formatted, all checks passed

The index was regenerated with LFX_DEV=1 uv run python scripts/build_component_index.py. The local venv had numpy 2.5.1, while uv.lock pins 2.4.6. That changed three unrelated numpy dependency entries, so I reverted them and recomputed the index sha256 with the script's method. The same method reproduces the committed checksum on release-1.13.0.

Not verified: clicking Update in the browser. The tests call the same two functions the /api/v1/custom_component endpoint calls: build_custom_component_template, then update_frontend_node.

Open questions

  • update_build_config (here and in operations.py) sets data["is_list"], but the serialized template key is list, and nothing on the canvas or in ParameterHandler reads is_list. So the Combine-versus-single-input switch may never reach the canvas handle. This PR restores is_list the same way the existing code writes it, to keep the port faithful. Switching to list would change handle behavior and deserves its own PR.

…ponent

Updating an outdated JSON Operations node (the legacy DataOperations
component) rebuilt its template from class defaults, where every
operation field is hidden. The generic merge restores only values, so the
selected operation's input disappeared from the node and the graph build
skipped it. A Select Keys ['text'] node then returned {} instead of the
selected key.

Re-apply the saved operation's field visibility and data.is_list in
update_frontend_node, and rebuild the Path Selection dropdown options from
the saved JSON. Saved values are left untouched. This ports the Data
Operations fix from #15812.
@coderabbitai

coderabbitai Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration
  • Configuration used: Repository: langflow-ai/langflow/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ccd0b069-1cdd-47e2-a1b2-a77e6200e2d8
📥 Commits

Reviewing files that changed from the base of the PR and between 753072c and 2c8ce28.

📒 Files selected for processing: 3
  • src/backend/tests/unit/components/processing/test_data_operations_component.py
  • src/lfx/src/lfx/_assets/component_index.json
  • src/lfx/src/lfx/components/processing/data_operations.py
+---------------------------------------------------+
| Brace yourself. Winter is coming...for your bugs. |
+---------------------------------------------------+
  \
   \     /)/)
        ( '')
        /  |
      o(___)
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added the bug Something isn't working label Oct 17, 2026
@erichare
erichare marked this pull request as ready for review October 17, 2026 14:48
@erichare
erichare merged commit d2db961 into release-1.13.0 Oct 17, 2026
82 of 83 checks passed
@erichare
erichare deleted the fix/json-operations-update-visibility branch October 17, 2026 14:49
@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Oct 17, 2026
@github-actions
github-actions Bot restored the fix/json-operations-update-visibility branch October 17, 2026 14:49
@github-actions

Copy link
Copy Markdown
Contributor

✅ Test Coverage Advisor

No source changes detected without accompanying tests. Thanks for keeping coverage up! 🎉

Advisory check only — never blocks merge.

@codecov

codecov Bot commented Oct 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.85%. Comparing base (a0adbeb) to head (2c8ce28).
⚠️ Report is 16 commits behind head on release-1.13.0.

Additional details and impacted files

Impacted file tree graph

@@                Coverage Diff                 @@
##           release-1.13.0   #15833      +/-   ##
==================================================
+ Coverage           69.51%   70.85%   +1.33%     
==================================================
  Files                2788     2798      +10     
  Lines              303015   303080      +65     
  Branches            45155    44246     -909     
==================================================
+ Hits               210644   214750    +4106     
+ Misses              89877    85836    -4041     
  Partials             2494     2494              

see 418 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

erichare added a commit that referenced this pull request Oct 17, 2026
…vas reads (#15836)

* fix(processing): set the JSON input's list flag under the key the canvas reads

Operations and the legacy JSON Operations component mean to let only the
Combine operation take several JSON edges. They wrote data["is_list"], but
the serialized template stores that flag as "list", and the canvas and the
graph read only "list". The flag stayed at its class default (True), so
every operation accepted several edges, and a single-input operation such
as Select Keys failed at run time with "not supported for multiple data
objects" instead of refusing the second edge on the canvas. The stray
is_list key was also saved into flows.

Write "list" and drop any is_list left by an earlier save. This covers
operation changes and the Update Component path in both components,
including the JSON Operations update_frontend_node added in #15833.
Regenerate the component index.

* fix(processing): fail when several JSON edges feed a single-input operation

A node keeps its edges when its operation changes, and nothing prunes
extra edges when the JSON input stops being a list. With "list" false the
graph passes only the last edge's data, so a node switched from Combine to
Select Keys would run on partial input and report no error.

Count the node's incoming "data" edges before running any operation other
than Combine, and raise the existing "not supported for multiple data
objects" error when there is more than one. This also covers Path
Selection and JQ Expression, which used only the first item of a list.
Regenerate the component index.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant