fix: guard logger carriage return on empty buffer#14788
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📜 Recent review details🧰 Additional context used📓 Path-based instructions (2)**/*.py📄 CodeRabbit inference engine (AGENTS.md)
Files:
**⚙️ CodeRabbit configuration file
Files:
⚙️ CodeRabbit configuration file
Files:
🧠 Learnings (1)📚 Learning: 2026-02-21T14:01:41.482ZApplied to files:
🔇 Additional comments (2)
📝 WalkthroughWalkthroughChangesThis PR fixes a bug in Related PRs: None identified. Suggested labels: bug, tests Suggested reviewers: None identified. 🐰 A carriage returns, but logs weren't there, 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
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 |
Refs #14754.
The logger tries to collapse carriage-return progress updates by checking the previous buffered log entry. If the first intercepted write starts with
\r, the log buffer is still empty andlogs[-1]raisesIndexError.This keeps the existing overwrite behavior, but only reads the previous entry when one exists. I added a small unit test for the empty-buffer case and the existing incomplete-line replacement behavior.
Tests:
uv run pytest tests-unit/app_test/logger_test.py -quv run --with ruff ruff check app/logger.py tests-unit/app_test/logger_test.pypython3 -m py_compile app/logger.py tests-unit/app_test/logger_test.pygit diff --check