fix(search): backend rate-limit no longer cascades into GitHub-direct storm + global dialog#524
Conversation
…on so direct-GitHub fallback storm doesn't fire
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughThis PR adds translated release-note bullets in 13 languages and updates search error handling: backend failures now decide between rethrow vs. GitHub fallback, and RateLimitException produces localized retry-aware messages surfaced to the UI. ChangesSearch Error Handling & Release Notes
Sequence Diagram(s)sequenceDiagram
autonumber
participant UI as Client(UI)
participant VM as SearchViewModel
participant Repo as SearchRepository
participant Backend as Backend Search Service
participant GH as GitHub REST
UI->>VM: performSearch(query)
VM->>Repo: backendSearch(query)
Repo->>Backend: request
alt Backend success
Backend-->>Repo: results
Repo-->>VM: mapped PaginatedDiscoveryRepositories
VM-->>UI: display results
else Backend failure
Backend-->>Repo: error (e)
Repo->>Repo: shouldFallbackToGithubOrRethrow(e)?
alt Rethrow
Repo-->>VM: throw e
VM->>UI: show error (RateLimitException handled specially)
else Fallback
Repo-->>GH: fallbackSearch(query)
GH-->>Repo: results
Repo-->>VM: mapped GitHub results
VM-->>UI: display results
end
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@feature/search/data/src/commonMain/kotlin/zed/rainxch/search/data/repository/SearchRepositoryImpl.kt`:
- Around line 158-170: The onFailure lambda in SearchRepositoryImpl's
tryBackendSearch is currently returning null in both branches so non-fallback
errors silently trigger the GitHub REST fallback; change the logic so that when
shouldFallbackToGithubOrRethrow(e) returns false you rethrow the exception (or
propagate it) instead of returning null, and only return null when the function
indicates a fallback (true) so the caller falls back to GitHub; update the
onFailure branch that references shouldFallbackToGithubOrRethrow to throw e (or
rethrow) and keep the null return only for the fallback path.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 957bb937-48e6-4e2c-bf4f-ee620e72901e
📒 Files selected for processing (15)
core/presentation/src/commonMain/composeResources/files/whatsnew/16.jsoncore/presentation/src/commonMain/composeResources/files/whatsnew/ar/16.jsoncore/presentation/src/commonMain/composeResources/files/whatsnew/bn/16.jsoncore/presentation/src/commonMain/composeResources/files/whatsnew/es/16.jsoncore/presentation/src/commonMain/composeResources/files/whatsnew/fr/16.jsoncore/presentation/src/commonMain/composeResources/files/whatsnew/hi/16.jsoncore/presentation/src/commonMain/composeResources/files/whatsnew/it/16.jsoncore/presentation/src/commonMain/composeResources/files/whatsnew/ja/16.jsoncore/presentation/src/commonMain/composeResources/files/whatsnew/ko/16.jsoncore/presentation/src/commonMain/composeResources/files/whatsnew/pl/16.jsoncore/presentation/src/commonMain/composeResources/files/whatsnew/ru/16.jsoncore/presentation/src/commonMain/composeResources/files/whatsnew/tr/16.jsoncore/presentation/src/commonMain/composeResources/files/whatsnew/zh-CN/16.jsonfeature/search/data/src/commonMain/kotlin/zed/rainxch/search/data/repository/SearchRepositoryImpl.ktfeature/search/presentation/src/commonMain/kotlin/zed/rainxch/search/presentation/SearchViewModel.kt
…retrying via GitHub direct
Why
Logged-in user reported the global "rate limit exceeded" dialog firing on Search even with auth.
Root cause cascade
End state: backend says "I'm busy" → client tries to compensate by hammering GitHub → both buckets exhausted → noisy dialog instead of soft retry-after toast.
Fix
Test plan
Summary by CodeRabbit