Handle unborn branches in VCS status#3046
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 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.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit c6e560c. Configure here.
ApprovabilityVerdict: Needs human review Unable to check for correctness in a53c8a0. This PR changes runtime behavior for how VCS status handles unborn branches (returning valid status instead of erroring). There is also an unresolved review comment about Windows compatibility in the telemetry file that should be addressed before merging. You can customize Macroscope's approvability policy. Learn more. |
c6e560c to
a53c8a0
Compare

Summary
Closes #3045.
Testing
Note: local verification emitted the repository's existing unsupported-engine warning because this environment uses Node v26.1.0 while the root package requests Node ^24.13.1.
Note
Medium Risk
Changes how
branchis derived for remote status (null on detached HEAD vs"HEAD") and alters git failure paths; limited scope but may affect UI or consumers ofstatusDetailsRemote.Overview
Remote VCS status and Alchemy telemetry now resolve the current branch with
git symbolic-ref --quiet --short HEADinstead ofgit rev-parse --abbrev-ref HEAD, so freshly initialized repos with no commits (unborn branches) still report a branch name.In
readStatusDetailsRemote, when symbolic-ref fails, the driver checksgit rev-parse --verify --quiet HEADand only errors if both fail; otherwise it treats the repo as valid (e.g. unborn). Detached HEAD is reported asbranch: nullrather than the string"HEAD".A new integration test covers
statusDetailsRemoteon an initialized repo with no commits.Reviewed by Cursor Bugbot for commit a53c8a0. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Handle unborn branches in VCS status by switching to
git symbolic-refgit rev-parse --abbrev-ref HEADwithgit symbolic-ref --quiet --short HEADinGitVcsDriverCore.tsfor branch discovery, which correctly handles unborn branches (repos with no commits).symbolic-reffails (e.g. detached HEAD), a fallbackgit rev-parse --verify --quiet HEADcheck runs; only if both fail does the function return an error. Branch is set tonullwhensymbolic-reffails but HEAD is still valid.GitVcsDriverCore.test.tsassertingisRepo: true,branchequals thesymbolic-refoutput, andhasUpstream: false.statusDetailsRemoteno longer errors on detached HEAD or unborn branches; it now returnsbranch: nullin those cases instead.Macroscope summarized a53c8a0.