Skip to content

log: silence 'service config not found' on per-rec lookup (closes #263)#863

Open
cristim wants to merge 1 commit into
feat/multicloud-web-frontendfrom
fix/263-wave18
Open

log: silence 'service config not found' on per-rec lookup (closes #263)#863
cristim wants to merge 1 commit into
feat/multicloud-web-frontendfrom
fix/263-wave18

Conversation

@cristim
Copy link
Copy Markdown
Member

@cristim cristim commented May 30, 2026

Summary

  • PostgresStore.GetServiceConfig was returning a plain error on pgx.ErrNoRows, not wrapping ErrNotFound, so globalConfigCache.lookup propagated it as a real error on every recommendation refresh for services without a global config row.
  • Wrap the no-rows path as %w ErrNotFound in both PostgresStore.GetServiceConfig (production) and the testablePostgresStore mock so callers get a consistent sentinel.
  • In globalConfigCache.lookup, use errors.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 ./... clean
  • go test github.com/LeanerCloud/CUDly/internal/api/... github.com/LeanerCloud/CUDly/internal/config/... passes (1906 tests)
  • TestGetServiceConfig_NotFound still asserts assert.Error + assert.Contains("not found") -- both hold because the wrapped error message still contains "not found"
  • TestResolveAccountConfigsForRecs_GlobalAbsentCachedNegative confirms the absent-global case is cached as missing (no second fetch) with no error returned

Closes #263.

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.
@cristim cristim added triaged Item has been triaged priority/p3 Polish / idea / may never ship severity/low Minor harm urgency/eventually No deadline impact/internal Team-internal only effort/s Hours type/bug Defect labels May 30, 2026
@cristim
Copy link
Copy Markdown
Member Author

cristim commented May 30, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 30, 2026

Warning

Review limit reached

@cristim, we couldn't start this review because you've reached your PR review rate limit.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: cfb9e71f-aafb-4059-9f6c-01f519c9ee45

📥 Commits

Reviewing files that changed from the base of the PR and between 4956d66 and fbf8092.

📒 Files selected for processing (3)
  • internal/config/recommendation_overrides.go
  • internal/config/store_postgres.go
  • internal/config/store_postgres_mock_test.go
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/263-wave18

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 30, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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

Labels

effort/s Hours impact/internal Team-internal only priority/p3 Polish / idea / may never ship severity/low Minor harm triaged Item has been triaged type/bug Defect urgency/eventually No deadline

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant