fix(store): return transaction errors from rql search repositories#1768
fix(store): return transaction errors from rql search repositories#1768AmanGIT07 wants to merge 3 commits into
Conversation
WithTxn's return value was discarded in the org billing, org projects, org users, and project users search methods. A failed transaction begin or commit returned empty results with no error. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Review limit reached
Next review available in: 25 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughFour PostgreSQL repository 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
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 |
Coverage Report for CI Build 29571017138Coverage increased (+0.2%) to 46.288%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
A canceled context makes the transaction begin fail. Each Search method must return that error instead of an empty result. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
… files Each repository test file gets a Search case using a client whose connections always fail, so no database container is needed. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Summary
Search methods in four rql repositories discarded the error returned by
WithTxn. A failed transaction begin or commit produced an empty result with no error.Changes
WithTxnerror inOrgBillingRepository.Search,OrgProjectsRepository.Search,OrgUsersRepository.Search, andProjectUsersRepository.SearchTechnical Details
WithTxnreturns errors from transaction begin, commit, and the callback. Only callback errors reached the caller, through a captured outer variable. InOrgBillingRepository.Searchthe group-by branch shadowed that variable, so its failures were dropped as well.Test Plan
go test ./internal/store/postgres/passes (covers the four Search methods)SQL Safety (if your PR touches
*_repository.goorgoqu.*)?placeholders,goqu.Ex{}, orgoqu.Record{}— neverfmt.Sprintfor+building a query that gets executed.ToSQL()callers capture and forward params (query, params, err := stmt.ToSQL(); db.…Context(ctx, …, query, params...)). Neverquery, _, err := ….?placeholders inside single-quoted SQL literals ingoqu.L(usemake_interval(hours => ?)-style functions instead).//nolint:forbidigoor// #nosec G20xannotation has a one-line justification on the same line that a reviewer can verify.