feat (desktop): rename branches one word and smaller#787
Conversation
|
Caution Review failedThe pull request is closed. 📝 WalkthroughWalkthroughWorkspace branch-name generation now avoids collisions by listing existing local and remote branches and using a friendly-words-based generator. The repo dependency was switched from Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
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 |
🚀 Preview Deployment🔗 Preview Links
Preview updates automatically with new commits |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@apps/desktop/src/lib/trpc/routers/workspaces/utils/git.ts`:
- Around line 292-311: The generateBranchName function should avoid magic
numbers and ensure the fallback cannot collide: introduce named constants (e.g.,
MAX_ATTEMPTS and FALLBACK_MAX_SUFFIX) and use them instead of 10 and 100, keep
the existingSet from existingBranches for case-insensitive checks, and change
the fallback to loop up to MAX_ATTEMPTS (or another bounded count) generating
candidates like `${word}-${n}` with n in [0, FALLBACK_MAX_SUFFIX) and returning
the first candidate that is not in existingSet; if none found after the bounded
attempts, return a deterministic safe value (e.g., append Date.now() or an
increment) to guarantee uniqueness. Ensure all membership checks use the same
lowercasing logic as before and reference generateBranchName, words, and
existingSet when implementing.
Description
Related Issues
Type of Change
Testing
Screenshots (if applicable)
Additional Notes
Summary by CodeRabbit
Bug Fixes
Chores
✏️ Tip: You can customize this high-level summary in your review settings.