feat(correlator): Implement multi-dimensional correlation engine#60
Merged
feat(correlator): Implement multi-dimensional correlation engine#60
Conversation
- Add StreamConsumer for consuming from stripe-events and chain-transactions streams - Implement CorrelationEngine with multi-dimensional matching: - Exact amount matching with configurable tolerance (default 0.01 USDC) - Timing window matching (default +/- 30 minutes) - Chain matching (optional hint from Stripe) - Token contract matching - Implement confidence scoring (0.0-1.0) based on match quality: - Amount match: base 40%, up to 50% for exact match - Timing match: up to 25% based on proximity - Chain match: 15% - Token match: 10% - Add RedisCorrelationPublisher for publishing results to correlation-results stream - Add comprehensive types: CorrelationCandidate, MatchDetails, CorrelationResult - Add 24 unit tests covering all matching scenarios Closes #18 Made-with: Cursor
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
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.
Summary
Build the core correlation engine that consumes events from both the stripe-events and chain-transactions Redis Streams, and matches Stripe Payment Intents to on-chain transactions using multi-dimensional heuristics.
Changes
stripe-eventsandchain-transactionsstreamscorrelation-resultsstreamCorrelationCandidate,MatchDetails,CorrelationResult,StripeEventMessageHow to Test
npm cinpm run typechecknpm test --workspace=@stripeonchain/correlatorTests
npm test)npm run lint)npm run format:check)Checklist
npm run migrate:up/npm run migrate:down)docker compose up)Related Issues
Closes #18
Made with Cursor