Skip to content

Refactor: REST API langfuse api-key - #14315

Merged
wangq8 merged 1 commit into
infiniflow:mainfrom
wangq8:qi/api-refactor-langfuse
Apr 23, 2026
Merged

wangq8 merged 1 commit into
infiniflow:mainfrom
wangq8:qi/api-refactor-langfuse

Conversation

@wangq8

@wangq8 wangq8 commented Apr 23, 2026 •

Copy link
Copy Markdown
Collaborator

What problem does this PR solve?

As descripotion

Type of change

  • Refactoring

@coderabbitai

coderabbitai Bot commented Apr 23, 2026 •

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

The Langfuse API key management endpoints are being standardized to use a consistent route path structure. The backend route changes from /api_key to /langfuse/api-key, with corresponding updates to the test module import and the frontend client API call configuration to align with this new path.

Changes

Cohort / File(s) Summary
Backend Route Path Standardization
api/apps/restful_apis/langfuse_api.py
HTTP route paths for POST/PUT, GET, and DELETE handlers updated from "/api_key" to "/langfuse/api-key". Handler logic and decorators remain unchanged.
Test Module Import Update
test/testcases/test_web_api/test_connector_app/test_langfuse_app_unit.py
Test loader changed to import Langfuse API implementation from langfuse_api.py instead of langfuse_app.py.
Frontend Client Configuration
web/src/utils/api.ts
API endpoint path updated from ${webAPI}/langfuse/api_key to ${restAPIv1}/langfuse/api-key, changing both the base prefix and route segment naming convention.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 The paths we hop, now unified and clean,
From /api_key to /langfuse/api-key we've been,
Frontend and backend in perfect harmony,
A tidy route structure for all to see! ✨

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is largely incomplete with a typo ('As descripotion') and missing critical context about the refactoring purpose and technical details. Replace the placeholder text with a clear explanation of why the API routes are being refactored and what the specific changes accomplish.
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 (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Refactor: REST API langfuse api-key' accurately describes the main change: refactoring API routes for Langfuse API key endpoints.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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


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.

@wangq8 wangq8 added the ci Continue Integration label Apr 23, 2026
@wangq8
wangq8 marked this pull request as ready for review April 23, 2026 02:10
@dosubot dosubot Bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Apr 23, 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.

Caution

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

⚠️ Outside diff range comments (1)
api/apps/restful_apis/langfuse_api.py (1)

26-85: ⚠️ Potential issue | 🟠 Major

Update the remaining contract tests to use the new /langfuse/api-key endpoint path.

The backend now registers /langfuse/api-key (with hyphen), but test/testcases/test_web_api/test_connector_app/test_connector_oauth_contract.py:25 still defines LANGFUSE_API_KEY_URL = f"{HOST_ADDRESS}/{VERSION}/langfuse/api_key" (with underscore and missing the /api/ prefix). This causes the POST/GET/PUT contract tests at lines 133, 138, and 143 to target the wrong endpoint. Update the URL to f"{HOST_ADDRESS}/api/{VERSION}/langfuse/api-key" to match the new route and align with the CONNECTOR_BASE_URL pattern.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@api/apps/restful_apis/langfuse_api.py` around lines 26 - 85, The tests are
targeting the wrong Langfuse endpoint path; update the constant
LANGFUSE_API_KEY_URL in
test/testcases/test_web_api/test_connector_app/test_connector_oauth_contract.py
to use the new route and correct prefix by changing its value to
f"{HOST_ADDRESS}/api/{VERSION}/langfuse/api-key" so the POST/GET/PUT contract
tests reference the registered /langfuse/api-key route (matches the server's
manager.route and CONNECTOR_BASE_URL pattern).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@api/apps/restful_apis/langfuse_api.py`:
- Around line 26-85: The tests are targeting the wrong Langfuse endpoint path;
update the constant LANGFUSE_API_KEY_URL in
test/testcases/test_web_api/test_connector_app/test_connector_oauth_contract.py
to use the new route and correct prefix by changing its value to
f"{HOST_ADDRESS}/api/{VERSION}/langfuse/api-key" so the POST/GET/PUT contract
tests reference the registered /langfuse/api-key route (matches the server's
manager.route and CONNECTOR_BASE_URL pattern).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c9bb5783-ee51-4dac-b3ce-a2dfb1989063

📥 Commits

Reviewing files that changed from the base of the PR and between ffa8738 and 3278f3c.

📒 Files selected for processing (3)
  • api/apps/restful_apis/langfuse_api.py
  • test/testcases/test_web_api/test_connector_app/test_langfuse_app_unit.py
  • web/src/utils/api.ts

@codecov

codecov Bot commented Apr 23, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.97%. Comparing base (ffa8738) to head (3278f3c).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #14315      +/-   ##
==========================================
- Coverage   97.41%   95.97%   -1.44%     
==========================================
  Files          10       10              
  Lines         695      695              
  Branches      111      111              
==========================================
- Hits          677      667      -10     
- Misses          7       11       +4     
- Partials       11       17       +6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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

@wangq8
wangq8 merged commit e79b896 into infiniflow:main Apr 23, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Continue Integration size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant