fix(lfx): include components path in flow builder registry
Fixes #13619.
Summary
- merge
settings.components_pathcustom components into the flow-builder local registry - keep the existing user-component overlay path while allowing it to use the same base registry
- add search, describe, and build regressions for components from
LANGFLOW_COMPONENTS_PATH
Tests
uv run pytest tests/unit/test_flow_builder_tools.py -quv run ruff check src/lfx/graph/flow_builder/builder.py src/lfx/mcp/flow_builder_tools/_state.py ../backend/base/langflow/agentic/services/user_components_overlay.py tests/unit/test_flow_builder_tools.pyuv run ruff format --check src/lfx/graph/flow_builder/builder.py src/lfx/mcp/flow_builder_tools/_state.py ../backend/base/langflow/agentic/services/user_components_overlay.py tests/unit/test_flow_builder_tools.pygit diff --check
Summary by CodeRabbit
Release Notes
-
New Features
- Registry loading now supports configurable custom component paths, allowing additional components to be loaded from user-specified locations alongside default components.
- User overlay system now respects configured component paths for seamless integration.
-
Tests
- Added comprehensive test coverage for component discovery and flow-building with custom component paths.
[!IMPORTANT]
Review skipped
Auto incremental reviews are disabled on this repository.
Please check the settings in the CodeRabbit UI or the
.coderabbit.yamlfile in this repository. To trigger a single review, invoke the@coderabbitai reviewcommand.⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID:
d63ff0bb-7fa8-47e9-bea3-90c8ba6ea29eYou can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.Use the checkbox below for a quick retry:
- [ ] 🔍 Trigger review
Walkthrough
This PR extends registry loading throughout the stack to accept optional custom components paths, enabling bundled component indexes to be merged with custom component registries from caller-provided paths for search, description, and flow-building operations.
Changes
Custom Components Path Registry Integration
| Layer / File(s) | Summary |
|---|---|
Flow builder registry merging core logic src/lfx/src/lfx/graph/flow_builder/builder.py |
load_local_registry reworked to accept optional components_paths, cache results per distinct path set, normalize path inputs, flatten bundled and custom component structures, merge custom entries over the base registry, and return the unified dictionary. |
Backend overlay API contract updates src/backend/base/langflow/agentic/services/user_components_overlay.py |
load_registry_with_user_overlay and load_registry_for_current_user updated to accept optional components_paths parameter and forward it to load_local_registry for base registry sourcing. |
MCP settings-aware registry loading src/lfx/src/lfx/mcp/flow_builder_tools/_state.py |
New _components_paths_from_settings() helper reads components_path from settings service; _load_registry_user_aware() now passes settings-derived components_path to both the local registry loader (fallback) and user-overlay registry loader. |
End-to-end test coverage for components_path registry src/lfx/tests/unit/test_flow_builder_tools.py |
Test helpers for cache reset and settings/registry mocking; three new tests verify SearchComponentTypes, DescribeComponentType, and BuildFlowFromSpec correctly incorporate component types from the configured components_path registry (e.g., BundleSearchTool with category operator_bundle). |
Estimated code review effort
🎯 3 (Moderate) | ⏱️ ~20 minutes
🚥 Pre-merge checks | ✅ 8 | ❌ 1
❌ Failed checks (1 warning)
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| Test Quality And Coverage | ⚠️ Warning | Tests cover only happy path scenarios (components found, described, built). Missing: cache correctness tests, fallback behavior when langflow import fails, None/empty components_path handling, erro... | Add tests for: caching with same path set, ImportError fallback, None components_path edge cases, build_custom_components failures, component merging behavior validation, and settings.components_path missing scenarios. |
✅ 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 clearly describes the main change: enabling the flow builder registry to include custom components from the configured components path. |
| Linked Issues check | ✅ Passed | The PR addresses issue #13619 by extending registry-loading APIs to accept components_paths, allowing custom components from LANGFLOW_COMPONENTS_PATH to be incorporated into the flow builder's registry alongside user overlays and built-in components. |
| Out of Scope Changes check | ✅ Passed | All changes are scoped to extending registry loading to accept and merge custom components from configured paths; no unrelated refactoring or unintended modifications are present. |
| Docstring Coverage | ✅ Passed | No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. |
| Test Coverage For New Implementations | ✅ Passed | PR includes comprehensive test coverage with 3 new functional tests covering search, describe, and build operations; helper functions for cache management and mocking; proper mocking of new setting... |
| Test File Naming And Structure | ✅ Passed | Test file follows correct patterns: test_*.py naming, proper pytest structure with 14 test classes and 58 test methods. Descriptive test names explain what is being tested. Tests are logically orga... |
| Excessive Mock Usage Warning | ✅ Passed | The PR adds only 3 new test methods with 6 patch() calls across 2 dependencies (get_settings_service, build_custom_components). These are appropriate external/IO dependencies that require mocking:... |
✏️ 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.
Comment @coderabbitai help to get the list of available commands.
Addressed the CodeRabbit test-quality warning by adding coverage for components_path normalization/cache reuse and missing-settings fallback, alongside the existing search/describe/build path coverage. Re-verified with uv run pytest tests/unit/test_flow_builder_tools.py -q from src/lfx, ruff check/format, and git diff --check.
Also addressed CodeRabbit’s cached-registry nit: components_path cache hits and newly merged registries now return shallow copies so caller mutations cannot corrupt cached entries. The registry test now covers that behavior. Re-verified with uv run pytest tests/unit/test_flow_builder_tools.py -q from src/lfx, ruff check/format, and git diff --check.
CI looks blocked by runner package repository setup rather than this PR change: Playwright shard 63 failed before tests ran while installing browsers because apt update hit 403 Forbidden from packages.microsoft.com and exited with code 100. A failed-job rerun should be enough, but I do not have repository admin permission to rerun the upstream workflow.