[Bug]: Fix duplicate create_user call in setup_dummy_user#818
Conversation
The setup_dummy_user method was calling create_user twice with the same user object. The first call correctly creates the user, but the second duplicate call either raises an IntegrityError (unique constraint violation) or silently overwrites the uid with an empty string. This fix removes the duplicate call so the user is only created once. Fixes potpie-ai#726
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
💤 Files with no reviewable changes (1)
WalkthroughThis PR fixes a bug in ChangesDummy User Initialization Fix
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning Review ran into problems🔥 ProblemsGit: Failed to clone repository. Please run the 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 |
|
Hi maintainers, just a gentle bump on this PR. It's a small fix for the duplicate I noticed there are now merge conflicts with the base branch — I'm happy to resolve those and update the PR if you'd like to have this reviewed. Would appreciate a look when you have time. Thanks! 🙏 |
…te-create-user # Conflicts: # legacy/app/modules/users/user_service.py
|
Update: I've resolved the merge conflict with the main branch. The directory restructuring caused the conflict — I've merged the latest main and the fix (removing the duplicate |



Summary
Fixes #726 —
setup_dummy_userwas callingcreate_usertwice with the same user object. The second duplicate call would either:IntegrityError(unique constraint violation), rolling back and logging an erroruid, silently overwriting the correct value from the first callChanges
uid, _, _ = user_service.create_user(user)line inapp/modules/users/user_service.pyTesting
The fix is straightforward — a single redundant line was removed. No test changes needed as existing tests continue to verify the correct behavior.
Fixes #726
Summary by CodeRabbit