langflow icon indicating copy to clipboard operation
langflow copied to clipboard

chore: clean up watsonx urls usage

Open Adam-Aghili opened this issue 1 year ago • 3 comments

clean up watsonx urls

Summary by CodeRabbit

Release Notes

  • Refactor
    • Centralized IBM Watsonx API endpoint configuration from multiple component locations into a shared resource for improved maintainability and consistency.

Adam-Aghili avatar Nov 11 '25 16:11 Adam-Aghili

[!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

The PR consolidates hardcoded IBM Watsonx API endpoint lists across four component and model files by replacing them with a shared constant IBM_WATSONX_URLS imported from lfx.base.models.watsonx_constants, reducing duplication and centralizing URL management.

Changes

Cohort / File(s) Change Summary
IBM Components
src/lfx/src/lfx/components/ibm/watsonx.py, src/lfx/src/lfx/components/ibm/watsonx_embeddings.py
Updated to import and reference IBM_WATSONX_URLS constant instead of hardcoded endpoint lists; WatsonxAIComponent._urls and WatsonxEmbeddingsComponent url dropdown now use the shared constant
Models
src/lfx/src/lfx/components/models/embedding_model.py, src/lfx/src/lfx/components/models/language_model.py
Updated to import and use IBM_WATSONX_URLS instead of hardcoded or locally-defined URL lists; embedding model default URL selection and language model URL options now source from the shared constant

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

  • Repetitive refactoring pattern applied consistently across all affected files
  • No behavioral or logic changes; straightforward constant reference replacement
  • Changes are homogeneous and low-risk—primarily import additions and variable substitutions

Possibly related PRs

  • langflow-ai/langflow#10524: Directly related; introduces and uses IBM_WATSONX_URLS in embedding model and components
  • langflow-ai/langflow#10356: Related; consolidates IBM WatsonX configuration by adopting shared watsonx constants across components and embedding functionality

Suggested labels

size:S

Suggested reviewers

  • lucaseduoli
  • edwinjosechittilappilly

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.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 PR lacks test coverage for watsonx URL constant refactoring; no tests validate centralized URL references or catch syntax errors like curly braces. Add unit tests verifying components correctly reference IBM_WATSONX_URLS, validate dropdown options render properly, and confirm default URL selection functions correctly.
Test File Naming And Structure ❓ Inconclusive The PR refactors hardcoded IBM Watsonx URLs into shared constants but no corresponding test files or updates were found in the repository. Verify whether test files are required for this refactoring PR and confirm if existing test coverage adequately covers the modified components.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Test Coverage For New Implementations ✅ Passed Refactoring PR consolidating hardcoded URL lists into shared constants without altering functionality or introducing new behavior.
Excessive Mock Usage Warning ✅ Passed PR refactors watsonx URL constants without modifying test files. No excessive mock usage patterns detected in affected components.
Title check ✅ Passed The title accurately reflects the main objective of the PR: consolidating hard-coded Watsonx URLs across multiple files into a shared constant (IBM_WATSONX_URLS), thereby reducing duplication and improving maintainability.

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.

coderabbitai[bot] avatar Nov 11 '25 16:11 coderabbitai[bot]

Frontend Unit Test Coverage Report

Coverage Summary

Lines Statements Branches Functions
Coverage: 15%
14.67% (3963/26999) 7.46% (1535/20568) 9.02% (534/5918)

Unit Test Results

Tests Skipped Failures Errors Time
1602 0 :zzz: 0 :x: 0 :fire: 19.409s :stopwatch:

github-actions[bot] avatar Nov 11 '25 16:11 github-actions[bot]

Codecov Report

:white_check_mark: All modified and coverable lines are covered by tests. :white_check_mark: Project coverage is 31.66%. Comparing base (17e4b83) to head (ad7fa05).

:exclamation: There is a different number of reports uploaded between BASE (17e4b83) and HEAD (ad7fa05). Click for more details.

HEAD has 6 uploads less than BASE
Flag BASE (17e4b83) HEAD (ad7fa05)
frontend 2 1
backend 10 5
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #10562      +/-   ##
==========================================
- Coverage   39.03%   31.66%   -7.37%     
==========================================
  Files        1482     1330     -152     
  Lines       85923    60416   -25507     
  Branches    10348     9030    -1318     
==========================================
- Hits        33539    19132   -14407     
+ Misses      51330    40374   -10956     
+ Partials     1054      910     -144     
Flag Coverage Δ
backend 51.38% <ø> (-5.70%) :arrow_down:
frontend 13.57% <ø> (-0.71%) :arrow_down:
lfx 39.58% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more. see 378 files with indirect coverage changes

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

codecov[bot] avatar Nov 11 '25 16:11 codecov[bot]