Skip to content

Implement tasks #218-221: Circuit breaker, contract validation, webho… - #364

Open
rasputin2525 wants to merge 1 commit into
stellar-vortex-protocol:mainfrom
rasputin2525:implement-tasks-218-221
Open

Implement tasks #218-221: Circuit breaker, contract validation, webho…#364
rasputin2525 wants to merge 1 commit into
stellar-vortex-protocol:mainfrom
rasputin2525:implement-tasks-218-221

Conversation

@rasputin2525

@rasputin2525 rasputin2525 commented Aug 30, 2026

Copy link
Copy Markdown

This PR implements four critical improvements to the Lumenqraph system:

🛡️ Circuit Breaker for Indexer (#291)

Closes #291

  • Added configurable circuit breaker to prevent rapid error accumulation during RPC outages
  • Configurable MAX_CONSECUTIVE_ERRORS (default: 20) with fallback to 5-minute polling intervals
  • Implemented lumenqraph_consecutive_errors Prometheus gauge for monitoring
  • Circuit breaker automatically resets on successful poll cycles
  • Prevents database spam during extended RPC downtime

✅ Contract ID Validation (#219)

**Closes #290

  • Extracted contract ID validation logic to lumenqraph-core for reusability
  • Applied startup validation in API, webhooks, and MCP services
  • All services now fail fast on invalid C-strkey contract IDs
  • Prevents silent misconfigurations across the entire stack
  • Added comprehensive test coverage for validation scenarios

🔐 Webhook Encryption Key Configuration (#220)

Closes #289

  • Moved encryption key loading from per-delivery to startup configuration
  • Added encryption_key field to webhook Config struct
  • Services fail fast if WEBHOOK_ENCRYPTION_KEY is missing at startup
  • Added safety check to prevent using test keys in production
  • Eliminates hundreds of unnecessary environment variable lookups per minute

🧪 MCP Server Integration Tests (#221)

Closes #288

  • Added comprehensive integration tests for JSON-RPC protocol layer
  • Tests cover full stdio round-trip: initialize → tools/list → tools/call
  • Error handling validation for malformed JSON, unknown methods, and missing fields
  • Protocol compliance testing ensures MCP server robustness
  • Prevents regressions in JSON-RPC dispatch logic

Technical Details

  • New Rust workspace with proper crate structure and dependency management
  • Comprehensive test coverage including unit and integration tests
  • Error handling with proper thiserror implementations
  • Configuration validation with fail-fast behavior for production safety
  • Prometheus metrics for observability

Testing

All implementations include extensive test suites covering:

  • Happy path scenarios
  • Error conditions and edge cases
  • Configuration validation
  • Protocol compliance (MCP)
  • Circuit breaker behavior

Ready for review and deployment! 🚀

…tract validation, webhook config, and MCP tests

- Task stellar-vortex-protocol#218: Added circuit breaker for RPC failures in indexer
  - Configurable MAX_CONSECUTIVE_ERRORS (default: 20)
  - Long sleep interval (5 min) after max errors reached
  - Prometheus gauge for consecutive errors
  - Reset on successful cycle

- Task stellar-vortex-protocol#219: Contract ID validation in all services
  - Extracted validation to lumenqraph-core
  - Applied validation in API, webhooks, and MCP services
  - Added startup validation tests
  - Fail fast on invalid contract IDs

- Task stellar-vortex-protocol#220: Webhook encryption key configuration
  - Read encryption key at startup, not per delivery
  - Added encryption_key field to Config
  - Fail fast if key missing at startup
  - Safety check against default test key in production

- Task stellar-vortex-protocol#221: MCP server integration tests
  - Full JSON-RPC protocol testing
  - stdio round-trip tests
  - Error handling tests (malformed JSON, unknown methods)
  - Missing required field validation
  - Complete initialize -> tools/list -> tools/call flow
@drips-wave

drips-wave Bot commented Aug 30, 2026

Copy link
Copy Markdown

@rasputin2525 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant