-
-
Notifications
You must be signed in to change notification settings - Fork 1
Implement RetryPolicy Trait and DefaultRetryPolicy #77
Copy link
Copy link
Open
Labels
SP:33 story points (small-medium)3 story points (small-medium)core-featureCore functionality and foundational featuresCore functionality and foundational featuresenhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomerspriority:highqualityCode quality and testingCode quality and testingtype:feature
Metadata
Metadata
Assignees
Labels
SP:33 story points (small-medium)3 story points (small-medium)core-featureCore functionality and foundational featuresCore functionality and foundational featuresenhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomerspriority:highqualityCode quality and testingCode quality and testingtype:feature
Implement RetryPolicy Trait and DefaultRetryPolicy
Overview
Create retry policy abstraction with hardcoded v1.0 defaults for per-query retry behavior. This enables transient error recovery while avoiding retry storms on permission errors.
Scope
What's Included:
RetryPolicytrait in new filefile:dbsurveyor-core/src/adapters/retry.rs:should_retry(&self, category: ErrorCategory, attempt: u32) -> boolbackoff_duration(&self, attempt: u32) -> DurationSend + Syncfor async compatibilityDefaultRetryPolicywith hardcoded constants:MAX_ATTEMPTS = 3BASE_BACKOFF_MS = 500MAX_BACKOFF_MS = 5000randcratetrueforErrorCategory::Timeout,ErrorCategory::Connection,ErrorCategory::Otherifattempt < MAX_ATTEMPTSfalseforErrorCategory::Permission,ErrorCategory::NotFound(never retry)min(BASE_BACKOFF_MS * 2^attempt + random_jitter(), MAX_BACKOFF_MS)file:dbsurveyor-core/src/adapters/mod.rsWhat's Explicitly Out:
DefaultRetryPolicyfor all adapters in v1.0)ticket:de2eeeb8-bfeb-4a11-98aa-84efc70568b2/6)Retry Logic Flow
sequenceDiagram participant Adapter participant RetryPolicy participant Database Adapter->>Database: Execute query (attempt 1) Database-->>Adapter: Timeout error Adapter->>RetryPolicy: should_retry(Timeout, 1)? RetryPolicy-->>Adapter: true Adapter->>RetryPolicy: backoff_duration(1) RetryPolicy-->>Adapter: 500ms + jitter Adapter->>Adapter: Wait 500ms Adapter->>Database: Execute query (attempt 2) Database-->>Adapter: Permission denied Adapter->>RetryPolicy: should_retry(Permission, 2)? RetryPolicy-->>Adapter: false (never retry permission) Adapter-->>Adapter: Record failure with retry_attempts=2Acceptance Criteria
RetryPolicytrait compiles and isSend + SyncDefaultRetryPolicyreturns correct retry decisions for allErrorCategoryvariantsErrorCategory::Permission) are never retriedReferences
spec:de2eeeb8-bfeb-4a11-98aa-84efc70568b2/820ca524-8c7d-4939-8097-f1158e7d67ea(Tech Plan - RetryPolicy Trait section)spec:de2eeeb8-bfeb-4a11-98aa-84efc70568b2/661dbe3d-b679-4287-991e-26f4a0dd98b9(Flow 6 - retry transient errors)