π v0.9.6 - Comprehensive GraphQL Schema Monitoring
π Comprehensive GraphQL Schema Monitoring
Major New Feature: Proactive Schema Monitoring
This release introduces a comprehensive GraphQL schema monitoring system to prevent API compatibility issues and proactively detect schema changes in MonarchMoney's API.
π Key Features
Core Infrastructure
- SchemaMonitor: Complete schema introspection, caching, and diff detection
- RobustGraphQLOperation: Base class for schema-resilient operations with automatic fallbacks
- Automated Validation: Continuous testing of all GraphQL operations against current schema
Smart Operations
- UpdateHoldingQuantityOperation: Robust holding updates with automatic field fallbacks
- GetAccountHoldingsOperation: Portfolio queries with schema adaptation
- GetSecurityDetailsOperation: Security search with field validation
Automation & Monitoring
- Daily CI/CD Monitoring: Automatic schema validation with breaking change detection
- Schema Reporter CLI: Comprehensive analysis and continuous monitoring tool
- Automatic Issue Creation: GitHub issues for breaking changes with detailed reports
π οΈ Technical Improvements
Robust Operations
# Operations now automatically adapt to schema changes
operation = UpdateHoldingQuantityOperation()
await operation.validate_against_schema(schema_monitor)
result = await operation.execute_with_fallbacks(client, variables)Schema Monitoring
# Monitor schema changes
monitor = SchemaMonitor(client)
schema = await monitor.introspect_schema()
diff = await monitor.diff_schemas(old_schema, new_schema)CLI Tools
# Generate comprehensive schema reports
python tools/schema_reporter.py report --email EMAIL --password PASS
# Continuous monitoring
python tools/schema_reporter.py monitor --interval 3600π§ Enhanced Error Handling
- SchemaValidationError: New exception type for schema-related issues
- Automatic Fallbacks: Operations gracefully handle missing/deprecated fields
- Detailed Warnings: Clear information about schema compatibility issues
π¨ Breaking Change Prevention
The monitoring system now:
- Detects field removals and deprecations automatically
- Tests all operations against current schema daily
- Creates GitHub issues for breaking changes
- Provides migration recommendations
π Comprehensive Reporting
- Schema Statistics: Type counts, field analysis, deprecation tracking
- Operation Compatibility: Validation status for all operations
- Historical Analysis: Schema evolution tracking over time
- Markdown Reports: Human-readable summaries and recommendations
π CI/CD Integration
- Daily Schema Validation: Automatic testing in GitHub Actions
- Breaking Change Alerts: Immediate notifications for critical issues
- Artifact Storage: Schema history and diff reports
- Slack Integration: Optional notifications for schema changes
π Benefits
This release addresses the core issue where MonarchMoney's GraphQL schema changes would cause "Something went wrong" errors. Now:
- β Proactive Detection: Changes detected before they break operations
- β Automatic Adaptation: Operations adjust to available fields
- β Clear Reporting: Detailed analysis of schema health
- β Continuous Monitoring: Daily validation prevents surprises
π― Use Cases
For Developers
- Monitor API changes automatically
- Get early warnings about deprecations
- Generate detailed schema reports
- Validate operation compatibility
For CI/CD
- Daily schema validation workflows
- Automatic issue creation for problems
- Schema artifact storage and comparison
- Integration with existing pipelines
π Documentation
The schema monitoring system includes:
- Comprehensive test suite (
tests/test_schema_validation.py) - CLI tool with full documentation (
tools/schema_reporter.py) - GitHub Actions workflow (
.github/workflows/schema-monitoring.yml) - Robust operation examples in the investment module
β‘ Quick Start
from monarchmoney import MonarchMoney
from monarchmoney.schema_monitor import SchemaMonitor
from monarchmoney.graphql.investment_operations import UpdateHoldingQuantityOperation
# Initialize monitoring
mm = MonarchMoney()
await mm.login_with_email(email, password)
monitor = SchemaMonitor(mm)
# Validate operation
operation = UpdateHoldingQuantityOperation()
validation = await operation.validate_against_schema(monitor)
# Execute with automatic fallbacks
result = await operation.execute_with_fallbacks(mm, variables, monitor)This release represents a major step forward in API reliability and developer experience. The proactive monitoring system ensures that schema changes are detected and handled gracefully, preventing the "Something went wrong" errors that previously occurred when MonarchMoney updated their GraphQL schema.
Full Changelog: v0.9.5...v0.9.6