Skip to content

Conversation

@xxsc0529
Copy link

@xxsc0529 xxsc0529 commented Nov 18, 2025

OceanBase Database is a distributed relational database.
It is developed entirely by Ant Group. The OceanBase Database is built on a common server cluster.
Based on the Paxos protocol and its distributed structure, the OceanBase Database provides high availability and linear scalability.

Oceanbase supports vector storage and querying, and has strong vector ecological capabilities
image

Summary by CodeRabbit

Release Notes

  • New Features

    • Integrated OceanBase as a vector store backend with vector search capabilities.
    • Added OceanBase branding and UI components.
    • Support for multiple vector indexing strategies (HNSW, IVF, FLAT) with configurable search parameters and score-based result filtering.
  • Chores

    • Added required dependencies for OceanBase integration.

@github-actions github-actions bot added the community Pull Request from an external contributor label Nov 18, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 18, 2025

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.

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

Walkthrough

This PR adds comprehensive OceanBase vector store support to the project, including new Python dependencies, a React icon component, integration with icon loading systems, sidebar configuration, and a backend component that manages OceanBase connections, indexing strategies, and document search operations.

Changes

Cohort / File(s) Summary
Dependencies
pyproject.toml
Added runtime dependencies: langchain-oceanbase>=0.2.3 and pymysql>=1.1.1
OceanBase Icon Component
src/frontend/src/icons/OceanBase/OceanBase.jsx, src/frontend/src/icons/OceanBase/index.tsx
Created new React SVG icon component rendering OceanBase logo with forwardRef wrapper for integration
Icon Loading
src/frontend/src/icons/eagerIconImports.ts, src/frontend/src/icons/lazyIconImports.ts
Registered OceanBaseIcon in both eager and lazy icon loading mappings
Icon Styling & Display
src/frontend/src/utils/styleUtils.ts
Added OceanBase to sidebar bundles and mapped OceanBaseVectorStore to icon display configuration
Backend Component Registration
src/lfx/src/lfx/components/__init__.py
Registered oceanbase module in component exports and dynamic import registry
OceanBase Component Module
src/lfx/src/lfx/components/oceanbase/__init__.py
Created lazy-loading component module with __getattr__ and __dir__ for dynamic OceanBaseVectorStoreComponent discovery
OceanBase Vector Store Implementation
src/lfx/src/lfx/components/oceanbase/oceanbase.py
Implemented OceanBaseVectorStoreComponent with connection management, six index type strategies (HNSW, HNSW_SQ, IVF, IVF_SQ, IVF_PQ, FLAT), search parameter derivation, document search with score filtering, and embedding configuration

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant LFX as LFX UI
    participant Component as OceanBaseVectorStoreComponent
    participant DB as OceanBase
    participant Langchain as langchain-oceanbase

    User->>LFX: Configure OceanBase Vector Store
    LFX->>Component: build_vector_store()
    Component->>Component: Validate pymysql available
    Component->>DB: Test connection
    DB-->>Component: Connection OK
    Component->>Component: _get_index_params() for selected type
    Component->>Langchain: Create OceanbaseVectorStore
    Langchain->>DB: Initialize with parameters
    DB-->>Langchain: Ready
    Langchain-->>Component: Return instance
    Component-->>LFX: Vector store ready

    User->>LFX: Search documents
    LFX->>Component: search_documents()
    Component->>Component: _get_search_params() for index type
    Component->>Langchain: similarity_search_with_score()
    Langchain->>DB: Query vectors
    DB-->>Langchain: Results with scores
    Langchain-->>Component: Results
    Component->>Component: Filter by score_threshold
    Component->>Component: Convert to Data objects
    Component-->>LFX: Return search results
    LFX-->>User: Display results
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Primary attention areas:
    • src/lfx/src/lfx/components/oceanbase/oceanbase.py — New vector store component with complex logic across six index types, parameter derivation, and search operations; verify connection handling, error propagation, and parameter correctness for each index strategy
    • src/lfx/src/lfx/components/oceanbase/__init__.py — Lazy loading implementation; verify __getattr__ error handling and caching behavior align with project patterns
    • Connection validation and pymysql availability check in build_vector_store method

Possibly related issues

  • Issue #10637 — Directly related; this PR implements the OceanBase vector store component support referenced in the issue, adding both backend integration and frontend UI elements

Suggested reviewers

  • italojohnny

Pre-merge checks and finishing touches

Important

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

❌ Failed checks (1 error, 3 warnings)
Check name Status Explanation Resolution
Test Coverage For New Implementations ❌ Error PR introduces 274+ lines of OceanBase vector store functionality across multiple files but includes no test files in any established test directories. Add unit tests for component methods, integration tests for database operations, and frontend tests for icon components with comprehensive coverage of success/failure scenarios.
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Test Quality And Coverage ⚠️ Warning OceanBase vector store implementation lacks corresponding test files covering initialization, error handling, index types, search functionality, and edge cases. Add test_oceanbase.py with comprehensive pytest coverage for build_vector_store, parameter methods, search_documents, and error scenarios including missing pymysql dependency.
Test File Naming And Structure ⚠️ Warning No test files exist for the new OceanBase vector store component in either backend (test_oceanbase.py) or frontend (OceanBase.test.tsx) directories. Create test_oceanbase.py and OceanBase.test.tsx following project patterns to cover connection validation, search logic, and UI rendering.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat:add oceanbase vector store support' clearly and specifically describes the main change—adding OceanBase vector store functionality. It accurately reflects the comprehensive changes across dependencies, frontend icons, and backend components.
Excessive Mock Usage Warning ✅ Passed The PR does not include any test files for the OceanBase vector store component, so there is no excessive mock usage to evaluate.

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.

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: 4

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/lfx/src/lfx/components/__init__.py (1)

9-109: Address the Ruff import formatting issue.

The pipeline reports that the import block is un-sorted or un-formatted. While the oceanbase additions appear correctly placed, please run the Ruff formatter to resolve this issue.

#!/bin/bash
# Run Ruff to fix the import formatting issue
ruff check --select I --fix src/lfx/src/lfx/components/__init__.py
🧹 Nitpick comments (3)
pyproject.toml (1)

98-100: Verify new OceanBase dependencies and consider making them optional.

The additions of langchain-oceanbase>=0.2.3 and pymysql>=1.1.1 look aligned with the new component, but they make OceanBase support mandatory for all installs. Please double‑check version compatibility with the current langchain stack and deployment environment, and consider moving langchain-oceanbase (and possibly pymysql) into an optional extra if OceanBase is not a core/default backend.

src/frontend/src/icons/OceanBase/OceanBase.jsx (1)

1-29: SVG style override and theming behaviour.

Current implementation always applies filter: "none" after spreading style, which overrides any caller‑provided filter. If you want to preserve external styling (e.g., future dark‑mode adjustments), consider style={{ filter: "none", ...style }} or dropping the override entirely if unnecessary. Also, to align with the existing icon conventions, it would be good to support an optional isdark prop (even if it only tweaks basic styling around the raster logo) once SvgOceanBase is updated to use forwardRef as mentioned in the wrapper review.

src/lfx/src/lfx/components/oceanbase/oceanbase.py (1)

239-265: Minor simplification opportunity in threshold gating.

The guard if self.score_threshold is not None and str(self.score_threshold).strip(): plus a later try: float(self.score_threshold) is defensive but slightly noisy given score_threshold is already a FloatInput. You could simplify to:

  • Treat None as “no threshold” and skip the str(...).strip() check.
  • Convert once up front and bail out on ValueError/TypeError.

This would keep behaviour identical while tightening the control flow.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6606ae5 and f57a4b7.

⛔ Files ignored due to path filters (2)
  • src/frontend/src/assets/oceanbase_logo.png is excluded by !**/*.png
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (9)
  • pyproject.toml (1 hunks)
  • src/frontend/src/icons/OceanBase/OceanBase.jsx (1 hunks)
  • src/frontend/src/icons/OceanBase/index.tsx (1 hunks)
  • src/frontend/src/icons/eagerIconImports.ts (2 hunks)
  • src/frontend/src/icons/lazyIconImports.ts (1 hunks)
  • src/frontend/src/utils/styleUtils.ts (2 hunks)
  • src/lfx/src/lfx/components/__init__.py (3 hunks)
  • src/lfx/src/lfx/components/oceanbase/__init__.py (1 hunks)
  • src/lfx/src/lfx/components/oceanbase/oceanbase.py (1 hunks)
🧰 Additional context used
🧠 Learnings (5)
📚 Learning: 2025-06-23T12:46:52.420Z
Learnt from: CR
Repo: langflow-ai/langflow PR: 0
File: .cursor/rules/icons.mdc:0-0
Timestamp: 2025-06-23T12:46:52.420Z
Learning: The frontend icon mapping key (in 'lazyIconsMapping') must match the backend 'icon' attribute string exactly, including case sensitivity, to ensure correct icon rendering.

Applied to files:

  • src/frontend/src/icons/lazyIconImports.ts
📚 Learning: 2025-06-23T12:46:52.420Z
Learnt from: CR
Repo: langflow-ai/langflow PR: 0
File: .cursor/rules/icons.mdc:0-0
Timestamp: 2025-06-23T12:46:52.420Z
Learning: Export custom icon components in React using React.forwardRef to ensure proper ref forwarding and compatibility with parent components.

Applied to files:

  • src/frontend/src/icons/OceanBase/index.tsx
📚 Learning: 2025-06-16T11:14:04.200Z
Learnt from: dolfim-ibm
Repo: langflow-ai/langflow PR: 8394
File: src/frontend/src/icons/Docling/index.tsx:4-6
Timestamp: 2025-06-16T11:14:04.200Z
Learning: The Langflow codebase consistently uses `React.PropsWithChildren<{}>` as the prop type for all icon components using forwardRef, rather than `React.SVGProps<SVGSVGElement>`. This is an established pattern across hundreds of icon files in src/frontend/src/icons/.

Applied to files:

  • src/frontend/src/icons/OceanBase/index.tsx
  • src/frontend/src/icons/OceanBase/OceanBase.jsx
📚 Learning: 2025-06-23T12:46:52.420Z
Learnt from: CR
Repo: langflow-ai/langflow PR: 0
File: .cursor/rules/icons.mdc:0-0
Timestamp: 2025-06-23T12:46:52.420Z
Learning: Custom SVG icon components in React should always support both light and dark mode by accepting an 'isdark' prop and adjusting colors accordingly.

Applied to files:

  • src/frontend/src/icons/OceanBase/index.tsx
  • src/frontend/src/icons/OceanBase/OceanBase.jsx
📚 Learning: 2025-06-23T12:46:42.048Z
Learnt from: CR
Repo: langflow-ai/langflow PR: 0
File: .cursor/rules/frontend_development.mdc:0-0
Timestamp: 2025-06-23T12:46:42.048Z
Learning: Custom React Flow node types should be implemented as memoized components, using Handle components for connection points and supporting optional icons and labels.

Applied to files:

  • src/frontend/src/icons/OceanBase/index.tsx
🧬 Code graph analysis (4)
src/frontend/src/icons/eagerIconImports.ts (1)
src/frontend/src/icons/OceanBase/index.tsx (1)
  • OceanBaseIcon (5-10)
src/frontend/src/icons/OceanBase/index.tsx (1)
src/frontend/src/icons/OceanBase/OceanBase.jsx (2)
  • SvgOceanBase (3-26)
  • SvgOceanBase (3-26)
src/lfx/src/lfx/components/oceanbase/__init__.py (1)
src/lfx/src/lfx/components/oceanbase/oceanbase.py (1)
  • OceanBaseVectorStoreComponent (9-274)
src/lfx/src/lfx/components/oceanbase/oceanbase.py (2)
src/backend/base/langflow/helpers/data.py (1)
  • docs_to_data (14-23)
src/lfx/src/lfx/schema/data.py (2)
  • Data (26-288)
  • to_lc_document (142-152)
🪛 GitHub Actions: Ruff Style Check
src/lfx/src/lfx/components/__init__.py

[error] 9-9: Ruff: I001 Import block is un-sorted or un-formatted.

🪛 GitHub Check: Ruff Style Check (3.13)
src/lfx/src/lfx/components/oceanbase/oceanbase.py

[failure] 256-256: Ruff (SLF001)
src/lfx/src/lfx/components/oceanbase/oceanbase.py:256:46: SLF001 Private member accessed: _select_relevance_score_fn


[failure] 223-223: Ruff (RET505)
src/lfx/src/lfx/components/oceanbase/oceanbase.py:223:9: RET505 Unnecessary elif after return statement


[failure] 199-199: Ruff (RET505)
src/lfx/src/lfx/components/oceanbase/oceanbase.py:199:9: RET505 Unnecessary elif after return statement

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (23)
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 5/13
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 7/13
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 9/13
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 12/13
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 10/13
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 13/13
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 11/13
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 8/13
  • GitHub Check: Run Frontend Tests / Playwright Tests - Shard 2/13
  • GitHub Check: Run Backend Tests / Unit Tests - Python 3.10 - Group 4
  • GitHub Check: Lint Backend / Run Mypy (3.12)
  • GitHub Check: Lint Backend / Run Mypy (3.11)
  • GitHub Check: Lint Backend / Run Mypy (3.13)
  • GitHub Check: Lint Backend / Run Mypy (3.10)
  • GitHub Check: Run Backend Tests / Unit Tests - Python 3.10 - Group 5
  • GitHub Check: Run Backend Tests / Unit Tests - Python 3.10 - Group 2
  • GitHub Check: Run Backend Tests / Unit Tests - Python 3.10 - Group 1
  • GitHub Check: Run Backend Tests / Unit Tests - Python 3.10 - Group 3
  • GitHub Check: Run Backend Tests / LFX Tests - Python 3.10
  • GitHub Check: Run Backend Tests / Integration Tests - Python 3.10
  • GitHub Check: Test Starter Templates
  • GitHub Check: Update Component Index
  • GitHub Check: Update Starter Projects
🔇 Additional comments (13)
src/frontend/src/icons/eagerIconImports.ts (1)

73-73: OceanBase eager icon wiring looks consistent.

The eager import and eagerIconsMapping entry for OceanBase match the backend icon = "OceanBase" and the style utils mapping, so the icon should resolve correctly in eager paths.

Also applies to: 193-193

src/frontend/src/icons/lazyIconImports.ts (1)

338-339: Lazy icon mapping for OceanBase is correct and consistent.

The OceanBase lazy entry follows the existing pattern and matches the icon key used in the backend and eager mappings, so lazy loading should work as expected.

src/frontend/src/utils/styleUtils.ts (1)

300-300: OceanBase sidebar bundle and node icon mapping are consistent.

The new SIDEBAR_BUNDLES entry and nodeIconToDisplayIconMap["OceanBaseVectorStore"] = "OceanBase" correctly align with the backend component’s name and icon values, so the OceanBase vector store should render with the intended icon in both the sidebar and node views.

Also applies to: 462-462

src/lfx/src/lfx/components/oceanbase/oceanbase.py (2)

9-90: Overall component design is solid; verify external API assumptions.

The component wiring (inputs, name, icon, priority, and recommended) and the high‑level flow in build_vector_store/search_documents look coherent and consistent with other vector store components: you validate the DB connection early, normalize ingest data to Documents, derive index/search params, and expose a handle-based embedding input plus result controls. The main functional dependency is on langchain_oceanbase.OceanbaseVectorStore correctly supporting:

  • from_texts(texts, embedding, metadatas, table_name, connection_args, vidx_metric_type, vidx_algo_params, drop_old, normalize, index_type, **kwargs)
  • __init__(embedding_function, table_name, connection_args, vidx_metric_type, vidx_algo_params, drop_old, normalize, index_type, **kwargs)
  • similarity_search / similarity_search_with_score(..., param=search_params)

Please double‑check the exact keyword names (connection_args, vidx_metric_type, vidx_algo_params, index_type, param) against the current langchain-oceanbase API, since any mismatch will only show up at runtime.


115-187: Ingest and metadata handling look correct and robust.

The conversion of self.ingest_data into Documents, plus the deep‑copy and model_dump() normalization for complex metadata, should play well with docs_to_data and downstream consumers. This design avoids mutating the original documents while producing JSON‑serializable metadata for storage.

src/frontend/src/icons/OceanBase/index.tsx (1)

1-10: Ref is not actually forwarded to the <svg> element.

OceanBaseIcon uses forwardRef, but SvgOceanBase is a plain function component in OceanBase.jsx, so ref will not attach to the underlying <svg> and may trigger React “function components cannot be given refs” warnings. To match the existing icon pattern, you should make SvgOceanBase itself a forwardRef<SVGSVGElement, React.SVGProps<SVGSVGElement> & { isdark?: boolean }> and pass the ref directly to the <svg> element, then have OceanBaseIcon wrap that, as done for other icons.

⛔ Skipped due to learnings
Learnt from: dolfim-ibm
Repo: langflow-ai/langflow PR: 8394
File: src/frontend/src/icons/Docling/index.tsx:4-6
Timestamp: 2025-06-16T11:14:04.200Z
Learning: The Langflow codebase consistently uses `React.PropsWithChildren<{}>` as the prop type for all icon components using forwardRef, rather than `React.SVGProps<SVGSVGElement>`. This is an established pattern across hundreds of icon files in src/frontend/src/icons/.
Learnt from: CR
Repo: langflow-ai/langflow PR: 0
File: .cursor/rules/icons.mdc:0-0
Timestamp: 2025-06-23T12:46:52.420Z
Learning: Export custom icon components in React using React.forwardRef to ensure proper ref forwarding and compatibility with parent components.
Learnt from: CR
Repo: langflow-ai/langflow PR: 0
File: .cursor/rules/icons.mdc:0-0
Timestamp: 2025-06-23T12:46:52.420Z
Learning: Custom SVG icon components in React should always support both light and dark mode by accepting an 'isdark' prop and adjusting colors accordingly.
src/lfx/src/lfx/components/__init__.py (3)

72-72: LGTM! TYPE_CHECKING import correctly added.

The oceanbase import is properly placed in alphabetical order within the TYPE_CHECKING block.


177-177: LGTM! Dynamic import mapping correctly configured.

The oceanbase module is properly registered in the dynamic imports dictionary with the "__module__" value, enabling lazy loading.


308-308: LGTM! Public API export correctly added.

The oceanbase module is properly added to the __all__ list in alphabetical order.

src/lfx/src/lfx/components/oceanbase/__init__.py (4)

1-8: LGTM! Imports and TYPE_CHECKING setup are correct.

The import structure follows the established lazy-loading pattern, with TYPE_CHECKING imports for static analysis without runtime overhead.


10-16: LGTM! Dynamic imports and public API correctly configured.

The _dynamic_imports mapping and __all__ list are properly set up to enable lazy loading of OceanBaseVectorStoreComponent.


19-30: LGTM! Lazy loading implementation is correct.

The __getattr__ function properly implements lazy loading with appropriate error handling and caching. The simpler implementation compared to the parent module is appropriate for a single-component module.


33-34: LGTM! __dir__ implementation is correct.

The __dir__ function properly returns the public API list, enabling introspection of the module.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community Pull Request from an external contributor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant