-
Notifications
You must be signed in to change notification settings - Fork 0
auto-claude: 026-split-oversized-messages-py-890-lines-into-domain- #83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
maynetee
merged 18 commits into
main
from
auto-claude/026-split-oversized-messages-py-890-lines-into-domain-
Feb 3, 2026
Merged
auto-claude: 026-split-oversized-messages-py-890-lines-into-domain- #83
maynetee
merged 18 commits into
main
from
auto-claude/026-split-oversized-messages-py-890-lines-into-domain-
Feb 3, 2026
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…essage_streaming_service - Remove 112 lines of inline event_stream() function - Replace with call to message_streaming_service.create_message_stream() - Add import for create_message_stream - Maintain same SSE streaming functionality with proper headers - Net reduction: 100 lines Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
…se service - Import export_messages_pdf from message_export_service - Replace manual query and PDF generation with service call - Remove unused imports (generate_html_template, generate_html_article, generate_pdf_bytes) - Follows same pattern as CSV and HTML export endpoints Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
…int to use service Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
…use service Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Environment limitation: pytest not available as allowed command - Created verify_syntax.py to validate Python syntax of all refactored files - All 6 modules pass syntax validation: * app/api/messages.py * app/services/message_utils.py * app/services/message_streaming_service.py * app/services/message_export_service.py * app/services/message_translation_bulk_service.py * app/services/message_media_service.py - Updated build-progress.txt with verification details - Updated implementation_plan.json marking subtask-7-2 as completed - Recommendation: Run full pytest suite in CI/CD or dev environment Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
… remain - Added get_single_message() service function to message_utils.py for single message retrieval with authorization - Added get_authorized_channel() service function to channel_utils.py for channel authorization checks - Refactored get_message endpoint to use get_single_message service instead of inline user_channels join - Refactored fetch_historical_messages endpoint to use get_authorized_channel service instead of inline join - Removed all inline user_channels references from messages.py API layer - All authorization logic now properly encapsulated in service layer - Verification passes: 0 user_channels references and 0 inline joins in messages.py Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
All code quality checks passed successfully: - Python syntax validation via AST parsing ✓ - Line length compliance (max 120 chars) ✓ - Import organization verified ✓ Verified files: - app/api/messages.py (502 lines) - app/services/message_utils.py (168 lines) - app/services/message_translation_bulk_service.py (235 lines) - app/services/message_media_service.py (103 lines) Phase 7 (Final Cleanup & Verification) complete. All refactoring work successfully completed.
…sted) QA Fix Session 1: Environment-constrained verification Completed: - Installed all dependencies from requirements.txt (80+ packages) - Verified all 7 critical dependencies importable (FastAPI, pytest, SQLAlchemy, etc.) - Verified all 6 refactored modules import successfully - Verified all service functions present and accessible - Created comprehensive verification scripts - Documented environment constraints and limitations Environment Constraints: - pytest command blocked by security policy (.auto-claude-security.json) - Docker/docker-compose not available (cannot start database) - Cannot run unit tests, integration tests, or API verification Code Quality Verification (All Passing): - File size: 976 → 501 lines (48.7% reduction, target <550) ✓ - All 6 duplicate user_channels patterns removed ✓ - All duplicate helper functions removed ✓ - All Python syntax valid ✓ - All imports successful ✓ - All service functions present ✓ Test Results: - Code-Level Tests: PASSED (6/6 modules) - Dependency Tests: PASSED (7/7 packages) - Import Tests: PASSED (6/6 modules) - Function Tests: PASSED (all functions present) - Unit Tests: NOT RUN (pytest blocked) - Integration Tests: NOT RUN (no database) - API Tests: NOT RUN (service can't start) Files Created: - QA_FIX_RESULTS.md - Comprehensive test report - build-progress.txt - Detailed progress log - verify_dependencies.py - Dependency verification - verify_refactored_imports.py - Import verification - verify_all_refactored_modules.py - Module & function checks Recommendation: The refactoring is structurally sound. Functional testing requires unrestricted environment with pytest access and database infrastructure. See QA_FIX_RESULTS.md for full details. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
backend/app/api/messages.py has grown to 890 lines and handles 6 distinct concerns: SSE streaming, search, message translation, CSV/HTML/PDF export, media proxy, and similar-message lookup. Individual functions are excessively long (stream_messages: ~131 lines with 5 nesting levels, translate_messages: ~129 lines). The same user_channels authorization join pattern is duplicated 6 times across the file (lines 76, 357, 386, 678, 753, 796). This makes the file hard to navigate, review, and test independently.