feat: add git tools and fix issue bug (#151-#155)#157
Conversation
Some MCP clients serialize parameters as a JSON string with literal control characters (newlines, tabs) inside string values instead of the escaped forms required by the JSON spec (\n, \t). This caused github_create_issue to fail with "Parameters must be a JSON object, got unparseable string" when the body contained markdown. Fix: when json.loads() raises JSONDecodeError on a string parameter, apply _sanitize_json_string() to escape bare control chars inside string literals using a DOTALL regex, then retry the parse. Truly invalid (non-JSON) strings still return the existing error response. Add tests/unit/lean/test_meta_tools_json_parsing.py with 17 tests covering the sanitization helper directly and the coercion path. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…remove masked bare-except
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Claude finished @MementoRC's task —— View job PR Review Complete ✅This is an excellent PR that demonstrates careful planning, robust implementation, and comprehensive testing. Here's my detailed review:
✅ Code Quality & ArchitectureExcellent separation of concerns:
Code consistency:
🔒 Security - ExcellentRobust input validation:
Security best practices:
🐛 Bug Analysis - Clean ImplementationRobust error handling:
Edge cases covered:
JSON parsing fix for #151:
⚡ Performance ConsiderationsEfficient implementations:
🧪 Test Coverage - Exceptional Quality80+ comprehensive unit tests across 6 files:
Test quality highlights:
🚀 Best Practices & MaintainabilityFollows established patterns:
Documentation quality:
Code organization:
💡 Minor Suggestions
🎯 Overall AssessmentThis PR exemplifies excellent software engineering practices:
The JSON parsing fix for issue #151 is particularly well-executed, handling the complex edge case of markdown content with control characters through a robust sanitization approach. Recommendation: ✅ APPROVE - This PR is ready for merge. It adds valuable functionality while maintaining the high code quality standards of the project. |
Summary
Architecture
New tools in
git/operations_extended.pyto avoid bloating the 2284-lineoperations.py. Follows established 3-layer pattern: Pydantic model, operation function, lean registry entry.Test plan