Honor debug level for file logging#99
Conversation
|
Warning Review limit reached
More reviews will be available in 48 minutes and 55 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more credits in the billing tab to continue. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughFixed a bug where ChangesFile Log Level Handler Fix
Estimated code review effort🎯 2 (Simple) | ⏱️ ~15 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
tests/test_logging_utils.py (1)
25-42: 💤 Low valueRedundant cleanup in
test_env_debug_level_reaches_file_log,test_explicit_debug_level_reaches_file_log, andtest_reconfigured_debug_level_updates_existing_file_handler.All three test functions call
_remove_renderkit_handlers()at the start and in a finally block for cleanup. This is redundant because the autouse fixturecleanup_renderkit_logging_handlersintests/conftest.py(lines 18-23) already removes and closes RenderKit handlers before and after each test. The shared root cause is defensive cleanup that duplicates the fixture's responsibility. Consider removing the explicit cleanup calls from all three tests and relying on the autouse fixture for test isolation.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@tests/test_logging_utils.py` around lines 25 - 42, Remove the redundant manual cleanup calls to _remove_renderkit_handlers() in the three tests test_env_debug_level_reaches_file_log, test_explicit_debug_level_reaches_file_log, and test_reconfigured_debug_level_updates_existing_file_handler; rely on the autouse fixture cleanup_renderkit_logging_handlers in tests/conftest.py to perform pre-/post-test handler removal and closing instead of calling _remove_renderkit_handlers() at the start and in the finally block of these tests, leaving the rest of each test intact.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@tests/test_logging_utils.py`:
- Around line 11-16: The function _remove_renderkit_handlers duplicates
_close_renderkit_logging_handlers from conftest; remove the duplicate helper
from tests/test_logging_utils.py and either import and reuse
_close_renderkit_logging_handlers (replace any calls to
_remove_renderkit_handlers with _close_renderkit_logging_handlers) or delete all
explicit calls and rely on the autouse fixture in conftest to perform the
cleanup; ensure no remaining references to _remove_renderkit_handlers remain and
run tests to confirm no regressions.
---
Nitpick comments:
In `@tests/test_logging_utils.py`:
- Around line 25-42: Remove the redundant manual cleanup calls to
_remove_renderkit_handlers() in the three tests
test_env_debug_level_reaches_file_log,
test_explicit_debug_level_reaches_file_log, and
test_reconfigured_debug_level_updates_existing_file_handler; rely on the autouse
fixture cleanup_renderkit_logging_handlers in tests/conftest.py to perform
pre-/post-test handler removal and closing instead of calling
_remove_renderkit_handlers() at the start and in the finally block of these
tests, leaving the rest of each test intact.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 47ca61bd-b658-464b-8b4d-bf5ee6950b46
📒 Files selected for processing (3)
src/renderkit/logging_utils.pytests/conftest.pytests/test_logging_utils.py
|



Summary
Root Cause
setup_logging()appliedRENDERKIT_LOG_LEVELto the RenderKit logger and console/UI handlers, but the rotating file handler was hard-coded to INFO. That meant DEBUG records were filtered out of the durable file log even when the logger accepted them.Validation
uv --native-tls run --extra dev pytest tests/test_logging_utils.pyuv --native-tls run --extra dev pytestuv --native-tls run --extra dev ruff check src\renderkit\logging_utils.py tests\test_logging_utils.py tests\conftest.pyuv --native-tls run --extra dev ruff format --check src\renderkit\logging_utils.py tests\test_logging_utils.py tests\conftest.pyCloses #97
Summary by CodeRabbit
Release Notes
Bug Fixes
Tests