feat: unify JSON/Table/Text operations into a single Operations component#13743
feat: unify JSON/Table/Text operations into a single Operations component#13743erichare wants to merge 4 commits into
Conversation
…nent Combine the three data-type-specific operation components — JSON Operations, Table Operations, and Text Operations — into one Operations component that exposes every operation across all three Langflow data types from a single flat operation picker. Selecting an operation reveals the matching input (JSON / Table / Text), its operation-specific fields, and the appropriate output type. - Remove the "Filter Values" operation from JSON Operations (a leftover from the old Data List operations); it is not carried over to Operations. - Mark JSON Operations, Table Operations, and Text Operations as legacy. They keep working for existing flows but are hidden from the default sidebar. - Repoint the replacement pointers of 12 already-legacy processing components from the now-legacy DataOperations/DataFrameOperations to the new Operations component, so deprecation guidance leads to a live successor. - Add unit tests for Operations, update the JSON Operations tests for the removed operation, retarget two Playwright e2e tests, regenerate the component index and backend locales, and add docs.
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
WalkthroughIntroduces a new unified ChangesUnified Operations Component
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 8 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (8 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
✅ Test Coverage AdvisorNo source changes detected without accompanying tests. Thanks for keeping coverage up! 🎉
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## release-1.11.0 #13743 +/- ##
==================================================
- Coverage 58.71% 58.69% -0.02%
==================================================
Files 2309 2309
Lines 220388 220388
Branches 31204 33012 +1808
==================================================
- Hits 129391 129358 -33
- Misses 89528 89562 +34
+ Partials 1469 1468 -1
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 4
🧹 Nitpick comments (1)
src/lfx/src/lfx/components/processing/operations.py (1)
926-931: 💤 Low valueDead code: the
len(self.data) == 1check is unreachable.
data_is_list()returnsTrueonly whenlen(self.data) > 1. The early return at line 927 handles all cases wherelen <= 1, so the check at line 929 can never evaluate toTrue.♻️ Suggested simplification
def combine_data(self) -> Data: """Combine multiple data objects into one.""" logger.info("combining data") if not self.data_is_list(): return self.data[0] if self.data else Data(data={}) - if len(self.data) == 1: - msg = "Combine operation requires multiple data inputs." - raise ValueError(msg) - data_dicts = [data.model_dump().get("data", data.model_dump()) for data in self.data]🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/lfx/src/lfx/components/processing/operations.py` around lines 926 - 931, The len(self.data) == 1 check is unreachable dead code because the early return when not self.data_is_list() is true already handles all cases where len(self.data) is 1 or less. Since data_is_list() only returns True when len(self.data) > 1, after the first conditional return, the length is guaranteed to be greater than 1. Remove the entire if block with the len(self.data) == 1 check and its associated ValueError to eliminate the unreachable code and simplify the logic.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/docs/Components/operations.mdx`:
- Around line 35-36: The documentation contains inconsistencies between the
described behavior and the actual implementation of the Operation component.
Update line 35 to reflect that operations are presented in a flat picker rather
than grouped by data type. Update line 85 to accurately document the Text Join
operation's output types, and update line 95 to include Text as a valid output
option for the Operation component, ensuring all references to the as_text path
and Text output behavior are consistent across the documentation.
In `@src/lfx/src/lfx/components/processing/data_operations.py`:
- Line 35: The legacy operation handling in the data processing code currently
returns empty Data(data={}) when encountering removed legacy operations like
"Filter Values", which silently changes behavior instead of alerting users to
the broken flow. Instead of silently returning empty data when legacy is True at
line 35 and in the corresponding code block around lines 461-487, raise an
appropriate exception (such as a ValueError or NotImplementedError) with a clear
message indicating that the legacy operation is no longer supported and the flow
must be updated. This will fail fast and prevent silent data corruption in
downstream flow results.
In `@src/lfx/src/lfx/components/processing/filter_data_values.py`:
- Line 18: The replacement target for FilterDataValues in the replacement
variable is incorrect because it points to processing.Operations, which no
longer contains the value-based comparison operator functionality that
DataFilterComponent provides. Identify where the value-based comparison
operators that FilterDataValues depends on have been moved to or what component
now provides equivalent functionality, and update the replacement list to point
to the correct component that preserves the original behavior instead of
pointing to processing.Operations.
In `@src/lfx/src/lfx/components/processing/operations.py`:
- Around line 1352-1361: The _text_clean method has a logic issue where the
remove_extra_spaces operation processes before remove_empty_lines, causing
remove_empty_lines to become ineffective. The regex pattern \s+ in
remove_extra_spaces matches all whitespace including newlines and replaces them
with a single space, which removes the newline characters that
remove_empty_lines depends on for splitting and filtering empty lines. To fix
this, either reorder the operations to process remove_empty_lines before
remove_extra_spaces, or modify the regex pattern in the remove_extra_spaces
block from \s+ to [ ]+ to match only spaces and preserve newlines.
---
Nitpick comments:
In `@src/lfx/src/lfx/components/processing/operations.py`:
- Around line 926-931: The len(self.data) == 1 check is unreachable dead code
because the early return when not self.data_is_list() is true already handles
all cases where len(self.data) is 1 or less. Since data_is_list() only returns
True when len(self.data) > 1, after the first conditional return, the length is
guaranteed to be greater than 1. Remove the entire if block with the
len(self.data) == 1 check and its associated ValueError to eliminate the
unreachable code and simplify the logic.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 18bb2a94-732d-4ed4-93d7-c1c78284c1e4
📒 Files selected for processing (28)
docs/docs/Components/data-operations.mdxdocs/docs/Components/dataframe-operations.mdxdocs/docs/Components/operations.mdxdocs/docs/Components/text-operations.mdxdocs/sidebars.jssrc/backend/base/langflow/locales/en.jsonsrc/backend/tests/unit/components/processing/test_data_operations_component.pysrc/backend/tests/unit/components/processing/test_operations_component.pysrc/frontend/tests/core/features/filterSidebar.spec.tssrc/frontend/tests/extended/features/loop-component.spec.tssrc/lfx/src/lfx/_assets/component_index.jsonsrc/lfx/src/lfx/components/processing/__init__.pysrc/lfx/src/lfx/components/processing/alter_metadata.pysrc/lfx/src/lfx/components/processing/combine_text.pysrc/lfx/src/lfx/components/processing/create_data.pysrc/lfx/src/lfx/components/processing/data_operations.pysrc/lfx/src/lfx/components/processing/data_to_dataframe.pysrc/lfx/src/lfx/components/processing/dataframe_operations.pysrc/lfx/src/lfx/components/processing/extract_key.pysrc/lfx/src/lfx/components/processing/filter_data.pysrc/lfx/src/lfx/components/processing/filter_data_values.pysrc/lfx/src/lfx/components/processing/merge_data.pysrc/lfx/src/lfx/components/processing/operations.pysrc/lfx/src/lfx/components/processing/parse_data.pysrc/lfx/src/lfx/components/processing/parse_dataframe.pysrc/lfx/src/lfx/components/processing/select_data.pysrc/lfx/src/lfx/components/processing/text_operations.pysrc/lfx/src/lfx/components/processing/update_data.py
- Give the Operations component three default outputs (JSON/Table/Message) so base_classes is populated and it appears in connection-filtered sidebars. Fixes the filterSidebar Playwright test and restores the discoverability the legacy components had with their static outputs. - Fix broken docs links: the legacy-component banners now use version-aware relative links (./operations.mdx) so they resolve within the unreleased docs version (the new page is not in the released 1.10.0 snapshot). - JSON Operations raises a clear error for a removed operation (e.g. the old "Filter Values") instead of silently returning empty data. - Text Clean's remove_extra_spaces preserves newlines so remove_empty_lines stays effective when both are enabled. - Point FilterDataValues' replacement to [] (its capability was removed, not carried into Operations). - Drop an unreachable branch in combine_data; clarify operations.mdx text. - Regenerate component index and locales; add regression tests.
This comment has been minimized.
This comment has been minimized.
|
Build successful! ✅ |
Summary
Combines the three data-type-specific operation components — JSON Operations, Table Operations, and Text Operations — into a single Operations component that exposes every operation across all three Langflow data types from one flat operation picker.
Selecting an operation reveals the matching input (JSON / Table / Text), its operation-specific fields, and sets the appropriate output type. Operation names don't collide across the three sets, so a single picker is unambiguous.
What's included
Operationscomponent (processing/operations.py) — flatOperationpicker with all 30 operations; contextual inputs and dynamic outputs (as_data/as_dataframe/as_message/as_text), reusing the exact logic of the three originals.Filter Valuesoperation from JSON Operations (a leftover from the old Data List operations) — and does not carry it forward, per the request.legacy = True— they keep working for existing flows but are hidden from the default sidebar.replacementpointers of 12 already-legacy processing components from the now-legacyDataOperations/DataFrameOperationsto the liveOperationssuccessor, so deprecation guidance no longer leads to another legacy component.Operations(one per data type + dynamic UI/output routing), updated JSON Operations tests for the removed operation, and two Playwright e2e specs retargeted toOperations.component_index.json(surgically — only the 16 processing components changed; no optional-dependency version drift) and backendlocales/en.json.operations.mdx+ sidebar entry, with legacy banners on the three superseded pages.Design notes
Testing
272 passedacrosssrc/backend/tests/unit/components/processing/test_build_component_index,test_component_index,test_cli_gate)ruff check/ruff formatclean;biomeclean on the e2e specs--checkand component-index sha integrity verifiedTest plan
filterSidebar,loop-component) — retargeted toOperations; validate in CISummary by CodeRabbit
New Features
Documentation
Bug Fixes
Tests