Skip to content

fix: log session scope errors at appropriate error - #10546

Merged
jordanrfrazier merged 6 commits into
mainfrom
log-as-info-instead-of-error-for-404
Nov 10, 2025
Merged

fix: log session scope errors at appropriate error#10546
jordanrfrazier merged 6 commits into
mainfrom
log-as-info-instead-of-error-for-404

Conversation

@jordanrfrazier

@jordanrfrazier jordanrfrazier commented Nov 10, 2025

Copy link
Copy Markdown
Collaborator

Fixes log level of session scope errors. e.g. don't log 404s as errors.

Summary by CodeRabbit

  • Chores
    • Enhanced error logging with status-aware categorization to improve error diagnostics and monitoring capabilities.

@coderabbitai

coderabbitai Bot commented Nov 10, 2025

Copy link
Copy Markdown
Contributor

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

Added import of HTTPException from fastapi and enhanced exception handling in session_scope to log HTTP 4xx errors at info level and 5xx or other errors at error level, while maintaining existing rollback and re-raise behavior.

Changes

Cohort / File(s) Summary
Session scope exception logging
src/backend/base/langflow/services/deps.py
Added HTTPException import; enhanced session_scope exception handler with status-aware logging distinguishing between HTTP 4xx (info level) and 5xx/other errors (error level) before re-raising.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

  • Single file modification with focused scope
  • Logic addition is straightforward (status-code-based conditional logging)
  • No structural or behavioral changes to existing control flow

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, 1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Test Coverage For New Implementations ❌ Error PR modifies error logging in session scope but includes no test files verifying the new status-code-aware logging behavior for HTTPException handling. Add test file verifying logging behavior: 4xx errors log at info level, 5xx errors log at error level, and non-HTTP exceptions log at error level.
Test Quality And Coverage ⚠️ Warning PR modifies session_scope exception handling and logging behavior but adds no tests to validate the new status-aware logging logic. Add async pytest tests validating that HTTPException with 4xx logs at info-level, 5xx at error-level, and non-HTTP exceptions at error-level.
Title check ❓ Inconclusive The title is vague and incomplete, lacking specificity about the actual change. It mentions 'log session scope errors at appropriate error' but doesn't clarify what 'appropriate error' means or why the change matters. Revise the title to be more specific and complete, such as 'fix: log session scope errors with status-aware levels' or 'fix: log HTTP 4xx errors at info level instead of error level'.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Test File Naming And Structure ✅ Passed The PR modifies only a backend service file to improve logging behavior in exception handling, not adding new test files or test structure changes.
Excessive Mock Usage Warning ✅ Passed PR modifies only source code (deps.py), no test files included; excessive mock usage assessment is not applicable.

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 the bug Something isn't working label Nov 10, 2025
@codecov

codecov Bot commented Nov 10, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 85.71429% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 31.41%. Comparing base (403b939) to head (8192357).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
src/backend/base/langflow/services/deps.py 85.71% 1 Missing ⚠️

❌ Your project status has failed because the head coverage (39.35%) is below the target coverage (60.00%). You can increase the head coverage or adjust the target coverage.

❗ There is a different number of reports uploaded between BASE (403b939) and HEAD (8192357). Click for more details.

HEAD has 5 uploads less than BASE
Flag BASE (403b939) HEAD (8192357)
backend 10 5
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #10546      +/-   ##
==========================================
- Coverage   38.90%   31.41%   -7.50%     
==========================================
  Files        1477     1325     -152     
  Lines       85270    60001   -25269     
  Branches    10240     8983    -1257     
==========================================
- Hits        33175    18848   -14327     
+ Misses      51048    40246   -10802     
+ Partials     1047      907     -140     
Flag Coverage Δ
backend 50.94% <85.71%> (-5.91%) ⬇️
lfx 39.35% <ø> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/backend/base/langflow/services/deps.py 86.66% <85.71%> (-2.81%) ⬇️

... and 371 files with indirect coverage changes

🚀 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.

@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Nov 10, 2025

@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.

Actionable comments posted: 1

📜 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 403b939 and deb3806.

📒 Files selected for processing (1)
  • src/backend/base/langflow/services/deps.py (2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
{src/backend/**/*.py,tests/**/*.py,Makefile}

📄 CodeRabbit inference engine (.cursor/rules/backend_development.mdc)

{src/backend/**/*.py,tests/**/*.py,Makefile}: Run make format_backend to format Python code before linting or committing changes
Run make lint to perform linting checks on backend Python code

Files:

  • src/backend/base/langflow/services/deps.py
🪛 GitHub Actions: Ruff Style Check
src/backend/base/langflow/services/deps.py

[error] 187-187: Ruff: PLR2004 Magic value used in comparison. Consider replacing '400' with a named constant. Command: uv run --only-dev ruff check --output-format=github .

🪛 GitHub Check: Ruff Style Check (3.13)
src/backend/base/langflow/services/deps.py

[failure] 187-187: Ruff (PLR2004)
src/backend/base/langflow/services/deps.py:187:43: PLR2004 Magic value used in comparison, consider replacing 500 with a constant variable


[failure] 187-187: Ruff (PLR2004)
src/backend/base/langflow/services/deps.py:187:20: PLR2004 Magic value used in comparison, consider replacing 400 with a constant variable

⏰ 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). (15)
  • GitHub Check: Test Docker Images / Test docker images
  • GitHub Check: Lint Backend / Run Mypy (3.13)
  • GitHub Check: Run Frontend Tests / Determine Test Suites and Shard Distribution
  • GitHub Check: Run Backend Tests / Integration Tests - Python 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 1
  • GitHub Check: Run Backend Tests / Unit Tests - Python 3.10 - Group 2
  • GitHub Check: Run Backend Tests / Unit Tests - Python 3.10 - Group 3
  • GitHub Check: Run Backend Tests / Unit Tests - Python 3.10 - Group 4
  • GitHub Check: Run Backend Tests / LFX Tests - Python 3.10
  • GitHub Check: Test Starter Templates
  • GitHub Check: Update Starter Projects
  • GitHub Check: Update Component Index
  • GitHub Check: Run Ruff Check and Format
  • GitHub Check: Optimize new Python code in this PR
🔇 Additional comments (1)
src/backend/base/langflow/services/deps.py (1)

6-6: LGTM: Import added for enhanced exception handling.

The HTTPException import is correctly added to support the differentiated logging logic in the session_scope context manager.

Comment thread src/backend/base/langflow/services/deps.py
@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Nov 10, 2025
@github-actions

github-actions Bot commented Nov 10, 2025

Copy link
Copy Markdown
Contributor

Frontend Unit Test Coverage Report

Coverage Summary

Lines Statements Branches Functions
Coverage: 15%
14.67% (3955/26947) 7.45% (1533/20552) 9% (532/5906)

Unit Test Results

Tests Skipped Failures Errors Time
1588 0 💤 0 ❌ 0 🔥 19.549s ⏱️

Comment thread src/backend/base/langflow/services/deps.py
@github-actions github-actions Bot added the lgtm This PR has been approved by a maintainer label Nov 10, 2025
@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Nov 10, 2025
@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Nov 10, 2025
@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Nov 10, 2025
@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Nov 10, 2025
@jordanrfrazier
jordanrfrazier added this pull request to the merge queue Nov 10, 2025
Merged via the queue into main with commit 1a34d84 Nov 10, 2025
55 of 57 checks passed
@jordanrfrazier
jordanrfrazier deleted the log-as-info-instead-of-error-for-404 branch November 10, 2025 21:15
korenLazar pushed a commit to kiran-kate/langflow that referenced this pull request Nov 13, 2025
* Log db session scope errors at appropriate error

* [autofix.ci] apply automated fixes

* uses http status codes

* [autofix.ci] apply automated fixes

* [autofix.ci] apply automated fixes (attempt 2/3)

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working lgtm This PR has been approved by a maintainer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants