refactor: extract shared frame upload helpers (DRY)#854
Conversation
Extract common logic from read_file and _on_filesystem_load into shared helper functions: - upload_frames_to_room(): batch processing with lock and progress - apply_adaptive_resolution(): adaptive sphere resolution for large systems This removes ~60 lines of duplicated code and fixes a bug in _on_filesystem_load where it tried to modify a frozen Pydantic model. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
📝 WalkthroughWalkthroughTwo helper functions for frame loading and adaptive resolution were introduced, consolidating frame upload logic and geometry resolution adjustments into shared utilities. The filesystem load flow refactored to delegate frame streaming and resolution adaptation to these helpers instead of inlined implementations. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧹 Recent nitpick comments
📜 Recent review detailsConfiguration used: defaults Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
🧰 Additional context used📓 Path-based instructions (1)**/*.py📄 CodeRabbit inference engine (AGENTS.md)
Files:
🧬 Code graph analysis (2)src/zndraw/app/tasks.py (4)
src/zndraw/socket_manager.py (1)
🪛 Ruff (0.14.11)src/zndraw/app/tasks.py148-148: Do not catch blind exception: (BLE001) 228-228: Abstract (TRY301) 228-228: Avoid specifying long messages outside the exception class (TRY003) 236-236: Abstract (TRY301) 236-236: Avoid specifying long messages outside the exception class (TRY003) 260-260: Abstract (TRY301) 260-260: Avoid specifying long messages outside the exception class (TRY003) 270-270: Abstract (TRY301) 270-270: Avoid specifying long messages outside the exception class (TRY003) src/zndraw/socket_manager.py544-544: Abstract (TRY301) 544-544: Avoid specifying long messages outside the exception class (TRY003) 572-572: Abstract (TRY301) 572-572: Avoid specifying long messages outside the exception class (TRY003) 578-578: Abstract (TRY301) 578-578: Avoid specifying long messages outside the exception class (TRY003) 591-591: Abstract (TRY301) 591-591: Avoid specifying long messages outside the exception class (TRY003) 593-593: Abstract (TRY301) 593-593: Avoid specifying long messages outside the exception class (TRY003) 600-600: Abstract (TRY301) 600-600: Avoid specifying long messages outside the exception class (TRY003) 642-646: Consider moving this statement to an (TRY300) ⏰ 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). (3)
🔇 Additional comments (4)
✏️ Tip: You can disable this entire section by setting 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❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #854 +/- ##
==========================================
+ Coverage 79.97% 80.02% +0.04%
==========================================
Files 165 165
Lines 20143 20128 -15
==========================================
- Hits 16110 16107 -3
+ Misses 4033 4021 -12 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Extract common logic from read_file and _on_filesystem_load into shared helper functions:
This removes ~60 lines of duplicated code and fixes a bug in _on_filesystem_load where it tried to modify a frozen Pydantic model.
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.