Skip to content

fix: remove unsupported Cassandra batch size kwarg#13557

Open
qybaihe wants to merge 2 commits into
langflow-ai:release-1.10.0from
qybaihe:fix-6255-cassandra-batch-size
Open

fix: remove unsupported Cassandra batch size kwarg#13557
qybaihe wants to merge 2 commits into
langflow-ai:release-1.10.0from
qybaihe:fix-6255-cassandra-batch-size

Conversation

@qybaihe

@qybaihe qybaihe commented Jun 9, 2026

Copy link
Copy Markdown

Fixes #6255

Summary

  • remove the unsupported batch_size kwarg from Cassandra.from_documents(...)
  • add a regression test that captures the kwargs passed to LangChain's Cassandra vector store

Verification

  • cd src/lfx && uv sync
  • cd src/lfx && uv run pytest tests/unit/components/cassandra/test_cassandra_vector_store_component.py
  • cd src/lfx && uv run ruff format --check src/lfx/components/cassandra/cassandra.py tests/unit/components/cassandra/test_cassandra_vector_store_component.py tests/unit/components/cassandra/__init__.py
  • cd src/lfx && uv run ruff check src/lfx/components/cassandra/cassandra.py tests/unit/components/cassandra/test_cassandra_vector_store_component.py tests/unit/components/cassandra/__init__.py

Summary by CodeRabbit

Release Notes

  • Bug Fixes

    • Modified document ingestion process in the Cassandra vector store component to refine configuration during document processing.
  • Tests

    • Added comprehensive unit test coverage for the Cassandra vector store component to validate correct behavior and integration.

@coderabbitai

coderabbitai Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 28453d83-71a3-4e39-aecc-dd605fa437e3

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Walkthrough

This PR fixes issue #6255 by removing the batch_size parameter from the Cassandra.from_documents() call, which is no longer supported by the underlying LangChain library. A unit test validates the fix.

Changes

Cassandra batch_size parameter removal

Layer / File(s) Summary
Remove batch_size parameter and add test validation
src/lfx/src/lfx/components/cassandra/cassandra.py, src/lfx/tests/unit/components/cassandra/__init__.py, src/lfx/tests/unit/components/cassandra/test_cassandra_vector_store_component.py
The batch_size=self.batch_size argument is removed from the Cassandra.from_documents() call. A new unit test mocks the integration and asserts that batch_size is omitted while table_name and keyspace are still passed correctly.

🎯 2 (Simple) | ⏱️ ~8 minutes

🚥 Pre-merge checks | ✅ 8 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (8 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: removing the unsupported batch_size keyword argument from the Cassandra.from_documents() call.
Linked Issues check ✅ Passed The PR successfully addresses issue #6255 by removing the unsupported batch_size kwarg from Cassandra.from_documents() and adds a regression test to prevent reoccurrence.
Out of Scope Changes check ✅ Passed All changes are directly related to fixing the batch_size issue: the kwarg removal, test file additions, and init.py file for test module organization.
Test Coverage For New Implementations ✅ Passed Test file follows naming convention, imports actual component, mocks Cassandra.from_documents, and asserts batch_size is NOT passed, directly validating the bug fix.
Test Quality And Coverage ✅ Passed Regression test properly validates the fix by mocking cassio/from_documents, asserting batch_size is NOT passed, and verifying table_name/keyspace ARE passed correctly using pytest patterns.
Test File Naming And Structure ✅ Passed Test file follows test_*.py naming, uses proper pytest structure with fixtures, is in appropriate unit test directory, and has a highly descriptive test function name.
Excessive Mock Usage Warning ✅ Passed Mocks target external dependencies appropriately (cassio, Cassandra). The 4 mock objects are necessary and justified for testing the regression: batch_size not passed to Cassandra.from_documents().

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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 and usage tips.

@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Jun 9, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
src/lfx/tests/unit/components/cassandra/test_cassandra_vector_store_component.py (1)

10-40: ⚡ Quick win

Consider verifying that critical parameters are still correctly passed.

The test correctly validates that batch_size is not passed to Cassandra.from_documents() (the main PR objective). However, verifying that other critical parameters—especially documents and embedding—are still correctly forwarded would increase confidence that the fix doesn't inadvertently break existing functionality.

✅ Enhancement: Add assertions for documents and embedding
     assert "batch_size" not in captured_kwargs
     assert captured_kwargs["table_name"] == "test_table"
     assert captured_kwargs["keyspace"] == "test_keyspace"
+    assert "documents" in captured_kwargs
+    assert "embedding" in captured_kwargs
🤖 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/tests/unit/components/cassandra/test_cassandra_vector_store_component.py`
around lines 10 - 40, Add assertions to ensure documents and embedding are still
forwarded to Cassandra.from_documents: after calling
CassandraVectorStoreComponent().set(...).build_vector_store(), assert that
captured_kwargs contains "documents" with the expected list (e.g., contains a
Data instance with data {"text": "hello"}) and that "embedding" equals the
MagicMock passed into component.set; keep the existing checks that "batch_size"
is absent and "table_name"/"keyspace" are correct, referencing
fake_from_documents, captured_kwargs, and
CassandraVectorStoreComponent.build_vector_store to locate the test 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.

Nitpick comments:
In
`@src/lfx/tests/unit/components/cassandra/test_cassandra_vector_store_component.py`:
- Around line 10-40: Add assertions to ensure documents and embedding are still
forwarded to Cassandra.from_documents: after calling
CassandraVectorStoreComponent().set(...).build_vector_store(), assert that
captured_kwargs contains "documents" with the expected list (e.g., contains a
Data instance with data {"text": "hello"}) and that "embedding" equals the
MagicMock passed into component.set; keep the existing checks that "batch_size"
is absent and "table_name"/"keyspace" are correct, referencing
fake_from_documents, captured_kwargs, and
CassandraVectorStoreComponent.build_vector_store to locate the test logic.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 90be981b-7290-4faf-b6e4-5d8ff332a560

📥 Commits

Reviewing files that changed from the base of the PR and between 2524604 and 91d1e9f.

📒 Files selected for processing (3)
  • src/lfx/src/lfx/components/cassandra/cassandra.py
  • src/lfx/tests/unit/components/cassandra/__init__.py
  • src/lfx/tests/unit/components/cassandra/test_cassandra_vector_store_component.py
💤 Files with no reviewable changes (1)
  • src/lfx/src/lfx/components/cassandra/cassandra.py

@qybaihe qybaihe force-pushed the fix-6255-cassandra-batch-size branch from c7b4f6a to 8fb25a7 Compare June 9, 2026 13:02
@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Jun 9, 2026
@qybaihe qybaihe force-pushed the fix-6255-cassandra-batch-size branch from 6282920 to 17602ea Compare June 9, 2026 13:09
@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Jun 9, 2026
@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Jun 9, 2026
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