log: silence 'service config not found' on per-rec lookup (closes #263)#863
log: silence 'service config not found' on per-rec lookup (closes #263)#863cristim wants to merge 1 commit into
Conversation
GetServiceConfig now wraps pgx.ErrNoRows as ErrNotFound so callers can distinguish "no row" from a real DB error. globalConfigCache.lookup uses errors.Is to treat ErrNotFound as (nil,nil) instead of propagating it, stopping the INFO noise emitted on every refresh for unconfigured services.
|
@coderabbitai review |
|
Warning Review limit reached
More reviews will be available in 25 minutes and 54 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
✅ Actions performedReview triggered.
|
Summary
PostgresStore.GetServiceConfigwas returning a plain error onpgx.ErrNoRows, not wrappingErrNotFound, soglobalConfigCache.lookuppropagated it as a real error on every recommendation refresh for services without a global config row.%w ErrNotFoundin bothPostgresStore.GetServiceConfig(production) and thetestablePostgresStoremock so callers get a consistent sentinel.globalConfigCache.lookup, useerrors.Is(err, ErrNotFound)to treat the absent-config case as(nil, nil)rather than returning an error, silencing the INFO log noise on each refresh cycle.Test plan
go build ./...cleango test github.com/LeanerCloud/CUDly/internal/api/... github.com/LeanerCloud/CUDly/internal/config/...passes (1906 tests)TestGetServiceConfig_NotFoundstill assertsassert.Error+assert.Contains("not found")-- both hold because the wrapped error message still contains "not found"TestResolveAccountConfigsForRecs_GlobalAbsentCachedNegativeconfirms the absent-global case is cached as missing (no second fetch) with no error returnedCloses #263.