fix: return AlreadyExists gRPC code for duplicate account creation#2168
fix: return AlreadyExists gRPC code for duplicate account creation#2168
Conversation
The InitiateCurrentAccount endpoint returned codes.Internal when repo.Save hit an ErrAccountExists duplicate. The seed-dev fixture seeder checks for codes.AlreadyExists to skip existing accounts idempotently, so the wrong code caused the nightly demo reset to fail on re-runs.
|
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 (2)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthrough
Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~5 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Claude Code ReviewCommit: d9fa3ae | CI: running SummaryClean, targeted bug fix. The InitiateCurrentAccount endpoint was returning codes.Internal for duplicate account creation, but the seed-dev fixture seeder relies on codes.AlreadyExists for idempotent retries. The fix correctly intercepts persistence.ErrAccountExists and persistence.ErrVersionConflict before the generic Internal fallback. The test is well-structured: integration test against a real DB, creates an account then retries the same request, and asserts the specific gRPC status code. Risk Assessment
FindingsNo issues found. The fix is correct, minimal, and well-tested. Bot Review NotesNo unresolved bot threads. CodeRabbit review is still in progress. |
The InitiateCurrentAccount endpoint returned codes.Internal when repo.Save hit a duplicate account (via ErrAccountExists or ErrVersionConflict on existing external_identifier). The seed-dev fixture seeder checks for codes.AlreadyExists to skip existing accounts idempotently, so the wrong code caused the nightly demo reset to fail on re-runs.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Summary
InitiateCurrentAccountendpoint returnedcodes.Internalwhenrepo.Savehit a duplicate account (ErrAccountExists). The seed-dev fixture seeder'screateAccountIdempotentchecks forcodes.AlreadyExiststo skip existing accounts, so the wrong status code caused the nightly demo reset to fail on re-runs.persistence.ErrAccountExistsand returnscodes.AlreadyExists, making the seeder's idempotent retry logic work correctly.Test plan