You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(source-control): renamed files in GitHub, GitLab and Azure DevOps diffs show as renames - #29774
In a GitHub, GitLab or Azure DevOps pull request, a renamed file shows up as an ordinary change under its new name. The diff gives no sign that it moved, and a rename with no edits appears as an empty change.
The server builds each forge's diff as a git-style patch with rename from and rename to lines, but leaves out similarity index. @pierre/diffs marks a git-style section as a rename only when it sees that line. Without it, the parser sets the type to change and drops prevName. Hunk expansion is affected too: the file contents loader has no old path, so it sends the new path for the old side. For GitHub this reads the new path at the merge base, where the file does not exist yet, and expanding context on a renamed and edited file fails.
Change
Each builder now writes similarity index before the rename lines, like the GitCafe builder already does (added in #24276, with the comment that Pierre needs this header). None of these APIs gives a score, so the value is 100% for a rename with no hunks and no withheld changes, and 0% otherwise. Pierre reads 100% as rename-pure and anything else as rename-changed.
GitHub toFilesPatch: changed if it has hunks or a non-zero additions/deletions count.
GitLab mergeRequestPatch: changed if it has hunks or is too_large/collapsed.
Azure DevOps patchHeader: uses the rename-pure/rename-changed kind Azure already reports.
Scope and approval
Very small, focused fix for an obvious bug, so no prior issue: three forge builders leave out a header that their GitCafe sibling already writes for the same reason, and real git always writes it. This is one root cause, so all three builders are in one PR. No contract, client or default changes.
Overlap search: I searched the local PR index and GitHub for "similarity index" and for rename + diff/pull request. The only hit is #10822 (closed, unrelated). #27331 changes the Azure diff slice budget but not the rename header lines.
Verification
Red on main: the 5 extended rename assertions fail in gitHubPullRequestJson.test.ts (2), gitLabMergeRequestJson.test.ts (1) and azureDevOpsDiff.test.ts (2), for example AssertionError: expected 'diff --git a/src/old.ts b/src/new.ts\…' to be 'diff --git a/src/old.ts b/src/new.ts\…', because the similarity index line is missing.
Green: vp test run passes 56/56 (GitHub), 44/44 (GitLab) and 14/14 (Azure DevOps), rerun after rebasing onto the latest main.
vp run check:changed passes: format, lint, knip, graphql, typecheck (13 packages), tests (4 files, 115 passed).
End to end, I parsed each builder's real output with the web app's @pierre/diffs:
Before, the GitHub/GitLab text for a renamed and edited file gave {"name":"src/new.ts","type":"change"} with no prevName.
After, GitHub, GitLab and Azure DevOps give {"name":"src/new.ts","prevName":"src/old.ts","type":"rename-changed"}, and a rename with no hunks gives rename-pure.
Not checked: I did not open a real GitHub, GitLab or Azure DevOps pull request in a client, so the rendered rename label and the expansion request are inferred from the parser output and from createDiffFileContentsLoader, not captured.
Reviewed with sol-loop: 1 round with GPT-6.1 Sol on high. Sol verdict: approved.
Created with Claude Opus 5.5 in Claude Code (T3 Code).
Macroscope's review found this PR approvable — Adds rename metadata to GitHub, GitLab and Azure DevOps diff output so renamed files remain recognizable as renames. The change is limited to diff representation and does not modify repository contents or product defaults.
No code changes detected at eb53486. Prior analysis still applies.
You can add or adjust custom eligibility rules. Learn more.
Reviewing files that changed from the base of the PR and between b84f59e and eb53486.
You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.
Use the checkbox below for a quick retry:
Trigger review
No actionable comments were generated in the recent review.
Walkthrough
Azure DevOps and GitLab now include similarity-index headers in patches for renamed files. GitHub retains its existing similarity calculation, with a comment documenting the rename-header requirement. Tests assert the expected headers across the three providers.
Azure DevOps adds 100% for pure renames and 0% for other renames. GitLab adds 0% when hunks exist or the diff is too large or collapsed, and 100% otherwise. GitHub documents its existing calculation. Tests assert the expected headers.
A narrow GitHub binary-rename case may be shown as unchanged; address or explicitly accept this before merging.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title clearly and concisely describes the main fix across GitHub, GitLab, and Azure DevOps diffs.
Description check
The description includes complete Problem, Change, Scope and approval, and Verification sections. It explains the root cause, implementation, test results, limitations, and approval rationale.
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Tip
🎯 Customize your risk assessments
Guide how CodeRabbit assesses merge risk and security architecture risk. Highlight sensitive changes and explain your security boundaries using Merge Risk Instructions and Security Risk Instructions in your review settings. Security architecture risk assessments require the Advanced plan or above.
✅ Automatic approvals, with your rules
Let CodeRabbit approve pull requests once required threads are resolved, pre-merge checks pass, and your risk limits are met. Enable Automatic approvals in review settings, with overrides for teams or file paths.
CodeRabbit Verify
Run CodeRabbit Verify to test the changes in this pull request.
merged current main into the existing head without rebasing. this brings in the upstream fix for the file-save browser test's discovery-poll hang; no additional source changes were needed. the diff remains six files with 11 added lines.
verified on b84f59eff76a53b3471e7cf9f867194110f5ee12: blacksmith vp run check:changed github/main passed format, lint, knip, graphql, 13 package typechecks, and 115 tests. the exact previously failing fileSaveSessions.browser.test.tsx also passed on blacksmith. runtime checks passed each adapter's pure and edited rename output through the client's installed pierre parser and confirmed the old path and rename type. two independent source reviews approved this head.
the github binary-rename ambiguity mentioned in the bot summary predates this change: a hunkless response with zero line counts exposes neither binary content changes nor a similarity score. this patch preserves the rename paths without expanding scope to binary-content detection. live forge requests and client rendering remain unverified.
verified unchanged head eb53486db5405d39367ceb6151971e356b1a92f2 against github/main at 61c3794c32 on a linux boat vm. installed both checkouts with vp i and ran one dev server at a time with isolated state. drove the web app using repository playwright and /usr/bin/google-chrome.
created a project and thread through the app and completed real codex gpt-6.1-sol turns on both versions. opened the live github diff for pingdotgg/t3code pr 19463, selected commit 23d9dbd, and exercised its renamed files without changing that pr.
main: boundedZip.ts and zipDirectory.ts appeared only under their new paths. expanding unchanged context on the edited rename failed with PullRequestOperationError: This file is not part of the change request.
this head: both show the old path, arrow, and new path. expanding the edited rename loaded the previously omitted lines, including const entries = Object.values(zip.files) and the archive-entry guard.
neighboring behavior: the pure rename preserves both paths; the ordinary officeArchive.ts edit renders its changed import; switching back to the whole-pr diff preserves both renames.
blacksmith: the three existing adapter suites passed, 114 tests total (github 56, gitlab 44, azure devops 14). no source changes or pushes were needed.
main, same live commit:
pr head, same live commit:
Not verified
live gitlab and azure devops requests: those integrations are not configured in this environment; their coverage here is the existing adapter tests. native desktop, ios/android, remote/tunnel connections, binary renames, and the oversized github whole-pr fallback were not exercised. the github per-commit view exercised the changed files-api builder directly. the uploaded recording was inspected and its browser playback and seeking passed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
size:XS0-9 changed lines (additions + deletions).vouch:trustedPR author is trusted by repo permissions or the VOUCHED list.
2 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
In a GitHub, GitLab or Azure DevOps pull request, a renamed file shows up as an ordinary change under its new name. The diff gives no sign that it moved, and a rename with no edits appears as an empty change.
The server builds each forge's diff as a git-style patch with
rename fromandrename tolines, but leaves outsimilarity index.@pierre/diffsmarks a git-style section as a rename only when it sees that line. Without it, the parser sets the type tochangeand dropsprevName. Hunk expansion is affected too: the file contents loader has no old path, so it sends the new path for the old side. For GitHub this reads the new path at the merge base, where the file does not exist yet, and expanding context on a renamed and edited file fails.Change
Each builder now writes
similarity indexbefore the rename lines, like the GitCafe builder already does (added in #24276, with the comment that Pierre needs this header). None of these APIs gives a score, so the value is100%for a rename with no hunks and no withheld changes, and0%otherwise. Pierre reads100%asrename-pureand anything else asrename-changed.toFilesPatch: changed if it has hunks or a non-zero additions/deletions count.mergeRequestPatch: changed if it has hunks or istoo_large/collapsed.patchHeader: uses therename-pure/rename-changedkind Azure already reports.Scope and approval
Very small, focused fix for an obvious bug, so no prior issue: three forge builders leave out a header that their GitCafe sibling already writes for the same reason, and real git always writes it. This is one root cause, so all three builders are in one PR. No contract, client or default changes.
Overlap search: I searched the local PR index and GitHub for "similarity index" and for rename + diff/pull request. The only hit is #10822 (closed, unrelated). #27331 changes the Azure diff slice budget but not the rename header lines.
Verification
gitHubPullRequestJson.test.ts(2),gitLabMergeRequestJson.test.ts(1) andazureDevOpsDiff.test.ts(2), for exampleAssertionError: expected 'diff --git a/src/old.ts b/src/new.ts\…' to be 'diff --git a/src/old.ts b/src/new.ts\…', because thesimilarity indexline is missing.vp test runpasses 56/56 (GitHub), 44/44 (GitLab) and 14/14 (Azure DevOps), rerun after rebasing onto the latest main.vp run check:changedpasses: format, lint, knip, graphql, typecheck (13 packages), tests (4 files, 115 passed).@pierre/diffs:{"name":"src/new.ts","type":"change"}with noprevName.{"name":"src/new.ts","prevName":"src/old.ts","type":"rename-changed"}, and a rename with no hunks givesrename-pure.createDiffFileContentsLoader, not captured.Reviewed with sol-loop: 1 round with GPT-6.1 Sol on high. Sol verdict: approved.
Created with Claude Opus 5.5 in Claude Code (T3 Code).
🤖 Generated with Claude Code