Skip to content

fix: change LoopComponent data input to DataFrame type and update display name #8297

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 18 commits into from
Jun 3, 2025

Conversation

edwinjosechittilappilly
Copy link
Collaborator

@edwinjosechittilappilly edwinjosechittilappilly commented May 30, 2025

Summary by CodeRabbit

  • Refactor

    • Updated the Loop component to accept only "DataFrame" inputs and renamed the input label from "Data or DataFrame" to "Inputs" for improved clarity.
  • Tests

    • Adjusted test selectors to align with the updated input label in the Loop component.

@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label May 30, 2025
Copy link
Contributor

coderabbitai bot commented May 30, 2025

Walkthrough

The changes update the LoopComponent's input specification to accept only "DataFrame" types instead of both "Data" and "DataFrame", and rename the input display name from "Data or DataFrame" to "Inputs". Corresponding updates are made in the backend, starter project JSON, and frontend tests without altering any processing logic or control flow.

Changes

File(s) Change Summary
src/backend/base/langflow/components/logic/loop.py Renamed LoopComponent's "data" input display name and restricted input types to only "DataFrame".
src/backend/base/langflow/initial_setup/starter_projects/Research Translation Loop.json Updated LoopComponent input display name and allowed input types to only "DataFrame".
src/frontend/tests/extended/features/loop-component.spec.ts Changed Playwright selector test ID to match new input display name ("Inputs").

Suggested reviewers

  • edwinjosechittilappilly

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3ea8808 and 888f26b.

📒 Files selected for processing (1)
  • src/frontend/tests/extended/features/loop-component.spec.ts (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • src/frontend/tests/extended/features/loop-component.spec.ts
⏰ Context from checks skipped due to timeout of 90000ms (9)
  • GitHub Check: Lint Backend / Run Mypy (3.12)
  • GitHub Check: Lint Backend / Run Mypy (3.10)
  • GitHub Check: Lint Backend / Run Mypy (3.11)
  • GitHub Check: Lint Backend / Run Mypy (3.13)
  • GitHub Check: Ruff Style Check (3.13)
  • GitHub Check: Run Ruff Check and Format
  • GitHub Check: Update Starter Projects
  • GitHub Check: Optimize new Python code in this PR
  • GitHub Check: Ruff Style Check (3.13)
✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@coderabbitai coderabbitai bot changed the title @coderabbit Restrict LoopComponent data input to DataFrame type and update display name May 30, 2025
@edwinjosechittilappilly edwinjosechittilappilly changed the title Restrict LoopComponent data input to DataFrame type and update display name fix:LoopComponent data input to DataFrame type and update display name May 30, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🔭 Outside diff range comments (1)
src/backend/base/langflow/components/logic/loop.py (1)

46-55: 🛠️ Refactor suggestion

Update validation logic to match input type restriction.

The _validate_data method still handles Data objects and lists of Data objects (lines 50-52), but the input specification now only accepts DataFrame. This creates dead code and inconsistent behavior.

If DataFrame-only input is intended, simplify the validation method:

def _validate_data(self, data):
-   """Validate and return a list of Data objects."""
+   """Validate DataFrame and return a list of Data objects."""
    if isinstance(data, DataFrame):
        return data.to_data_list()
-   if isinstance(data, Data):
-       return [data]
-   if isinstance(data, list) and all(isinstance(item, Data) for item in data):
-       return data
-   msg = "The 'data' input must be a DataFrame, a list of Data objects, or a single Data object."
+   msg = "The 'data' input must be a DataFrame."
    raise TypeError(msg)
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6582f06 and ec11bf3.

📒 Files selected for processing (1)
  • src/backend/base/langflow/components/logic/loop.py (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: Optimize new Python code in this PR
  • GitHub Check: Update Starter Projects
  • GitHub Check: Run Ruff Check and Format
  • GitHub Check: Ruff Style Check (3.13)

Comment on lines 17 to 19
display_name="DataFrame",
info="The initial list of Data objects or DataFrame to iterate over.",
input_types=["Data", "DataFrame"],
input_types=["DataFrame"],
Copy link
Contributor

@coderabbitai coderabbitai bot May 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Inconsistent input type restriction - requires comprehensive update.

The change restricts input types to only "DataFrame", but several parts of the codebase still expect to handle "Data" objects:

  1. The info string (line 18) still mentions "Data objects or DataFrame"
  2. The class description (line 10) still mentions "Data objects"
  3. The _validate_data method (lines 50-52) still handles Data objects and lists of Data objects
  4. The error message (line 54) still mentions Data objects

This creates inconsistencies that could confuse users and result in dead code.

Apply this diff to make the component consistent with DataFrame-only input:

- info="The initial list of Data objects or DataFrame to iterate over.",
+ info="The DataFrame to iterate over.",

And update the class description:

- description = (
-     "Iterates over a list of Data objects, outputting one item at a time and aggregating results from loop inputs."
- )
+ description = (
+     "Iterates over a DataFrame, outputting one item at a time and aggregating results from loop inputs."
+ )

Alternatively, if Data objects should still be supported, revert the input_types change:

- input_types=["DataFrame"],
+ input_types=["Data", "DataFrame"],
- display_name="DataFrame",
+ display_name="Data or DataFrame",

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In src/backend/base/langflow/components/logic/loop.py around lines 10 to 54,
there is inconsistency between the input_types restriction to only "DataFrame"
and other parts of the code and documentation that still reference "Data"
objects. To fix this, either update the class description, info string,
_validate_data method, and error messages to reflect that only DataFrame inputs
are supported, removing all mentions and handling of Data objects, or revert the
input_types change to include both "Data" and "DataFrame" to maintain
consistency with the existing code and documentation.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@edwinjosechittilappilly I agree with these

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!

@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. and removed size:XS This PR changes 0-9 lines, ignoring generated files. labels May 30, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/backend/base/langflow/initial_setup/starter_projects/Research Translation Loop.json (1)

1725-1731: Align input info text with the new single-type restriction
You updated display_name to “DataFrame” and restricted input_types to ["DataFrame"]. The accompanying info string still mentions “Data objects or DataFrame”, which is now outdated. Please revise it to something like:

"info": "The DataFrame to iterate over."

to keep the description accurate.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ec11bf3 and 5fe9293.

📒 Files selected for processing (1)
  • src/backend/base/langflow/initial_setup/starter_projects/Research Translation Loop.json (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (5)
  • GitHub Check: Run Ruff Check and Format
  • GitHub Check: Optimize new Python code in this PR
  • GitHub Check: Run benchmarks (3.12)
  • GitHub Check: Update Starter Projects
  • GitHub Check: Ruff Style Check (3.13)

@@ -112,7 +111,7 @@
"source": "ArXivComponent-ylKFb",
"sourceHandle": "{œdataTypeœ: œArXivComponentœ, œidœ: œArXivComponent-ylKFbœ, œnameœ: œdataframeœ, œoutput_typesœ: [œDataFrameœ]}",
"target": "LoopComponent-9BK8B",
"targetHandle": "{œfieldNameœ: œdataœ, œidœ: œLoopComponent-9BK8Bœ, œinputTypesœ: [œDataœ, œDataFrameœ], œtypeœ: œotherœ}"
"targetHandle": "{œfieldNameœ: œdataœ, œidœ: œLoopComponent-9BK8Bœ, œinputTypesœ: [œDataFrameœ], œtypeœ: œotherœ}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Ensure edge id consistency after restricting input types
The targetHandle now correctly restricts inputTypes to ["DataFrame"]. However, the edge’s "id" property (line 109) still embeds the old ["Data", "DataFrame"] metadata, causing a mismatch. Please update the "id" to reflect only DataFrame or switch to a stable identifier that doesn’t hardcode input metadata.

🤖 Prompt for AI Agents
In src/backend/base/langflow/initial_setup/starter_projects/Research Translation
Loop.json at line 114, the targetHandle restricts inputTypes to ["DataFrame"],
but the edge "id" at line 109 still references the old input metadata ["Data",
"DataFrame"]. Update the "id" property at line 109 to reflect only "DataFrame"
or replace it with a stable identifier that does not hardcode input metadata to
ensure consistency.

@ogabrielluiz ogabrielluiz changed the title fix:LoopComponent data input to DataFrame type and update display name fix: change LoopComponent data input to DataFrame type and update display name May 30, 2025
@github-actions github-actions bot added the bug Something isn't working label May 30, 2025
Copy link

codspeed-hq bot commented May 30, 2025

CodSpeed Performance Report

Merging #8297 will degrade performances by 13%

Comparing fix-df-input (5fe9293) with main (10d0e13)

Summary

⚡ 2 improvements
❌ 2 regressions
✅ 15 untouched benchmarks

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Benchmark BASE HEAD Change
test_build_flow_invalid_job_id 8.6 ms 9.8 ms -13%
test_build_flow_start_with_inputs 218.8 ms 243.2 ms -10.03%
test_cancel_build_with_cancelled_error 420.7 ms 248.2 ms +69.48%
test_cancel_nonexistent_build 9.7 ms 8.2 ms +17.76%

Copy link
Collaborator

@Yukiyukiyeah Yukiyukiyeah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label May 30, 2025
@github-actions github-actions bot added bug Something isn't working and removed bug Something isn't working labels May 30, 2025
@github-actions github-actions bot added bug Something isn't working and removed bug Something isn't working labels May 30, 2025
@github-actions github-actions bot added bug Something isn't working and removed bug Something isn't working labels May 30, 2025
@edwinjosechittilappilly edwinjosechittilappilly added this pull request to the merge queue May 31, 2025
@github-actions github-actions bot added bug Something isn't working and removed bug Something isn't working labels Jun 3, 2025
@github-actions github-actions bot added bug Something isn't working and removed bug Something isn't working labels Jun 3, 2025
@github-actions github-actions bot added bug Something isn't working and removed bug Something isn't working labels Jun 3, 2025
@github-actions github-actions bot added bug Something isn't working and removed bug Something isn't working labels Jun 3, 2025
@ogabrielluiz ogabrielluiz added the fast-track Skip tests and sends PR into the merge queue label Jun 3, 2025
@carlosrcoelho carlosrcoelho added this pull request to the merge queue Jun 3, 2025
…e a maximum of 10 shards instead of 40 for better test distribution

🐛 (loop-component.spec.ts): fix getByTestId selector to match the updated element ID for testing purposes
@Cristhianzl Cristhianzl removed this pull request from the merge queue due to a manual request Jun 3, 2025
@Cristhianzl Cristhianzl enabled auto-merge June 3, 2025 19:44
@github-actions github-actions bot added bug Something isn't working and removed bug Something isn't working labels Jun 3, 2025
@Cristhianzl Cristhianzl added this pull request to the merge queue Jun 3, 2025
Merged via the queue into main with commit 68f4905 Jun 3, 2025
22 checks passed
@Cristhianzl Cristhianzl deleted the fix-df-input branch June 3, 2025 20:08
ogabrielluiz pushed a commit that referenced this pull request Jun 4, 2025
…play name (#8297)

* Update loop.py

* [autofix.ci] apply automated fixes

* Update loop-component.spec.ts

* change dataframe input name to inputs

* [autofix.ci] apply automated fixes

* 🐛 (typescript_test.yml): increase the maximum shard count to 40 to improve test distribution and efficiency

* 🔧 (typescript_test.yml): adjust optimal shard count calculation to use a maximum of 10 shards instead of 40 for better test distribution
🐛 (loop-component.spec.ts): fix getByTestId selector to match the updated element ID for testing purposes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Yuqi Tang <[email protected]>
Co-authored-by: cristhianzl <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fast-track Skip tests and sends PR into the merge queue lgtm This PR has been approved by a maintainer size:S This PR changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants