Repository navigation
Feat/idempotency logic on dreamsync adapter - #377
Conversation
|
Caution Review failedThe pull request is closed. WalkthroughThis PR introduces a request-scoped operation context system to track database operation origins and control webhook processing. It adds a singleton OperationContextManager with automatic expiry, integrates context wrapping into ConsentService, and gates webhook processing in subscriber.ts based on active operation contexts. Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant ConsentService
participant OperationContextManager
participant Subscriber
participant Webhook
Client->>ConsentService: Request consent response
ConsentService->>OperationContextManager: createContext('ConsentService', operationId)
OperationContextManager->>OperationContextManager: Store context with 30s TTL
ConsentService->>ConsentService: processConsentResponse()
ConsentService->>Subscriber: Trigger data changes
Subscriber->>OperationContextManager: shouldProcessWebhook(entityId, 'groups')
OperationContextManager->>OperationContextManager: Check if ConsentService context active
alt Context Active
OperationContextManager-->>Subscriber: true
Subscriber->>Webhook: Send webhook
else No Active Context
OperationContextManager-->>Subscriber: false
Subscriber->>Subscriber: Skip webhook (log)
end
ConsentService->>OperationContextManager: removeContext() [on completion]
OperationContextManager->>OperationContextManager: Clear context entry
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes The PR introduces a new context management system with integration across three distinct files. While individually straightforward, the review requires understanding the singleton pattern, context lifecycle, automatic expiry mechanics, and how the gating logic correctly handles edge cases (protected tables, ConsentService bypass). The changes are cohesive but not repetitive, warranting moderately careful examination. Possibly related PRs
Poem
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (3)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
* fix: idempotency in dreamsync adapter * chore: add file
Description of change
Issue Number
Type of change
How the change has been tested
Change checklist
Summary by CodeRabbit
Release Notes