Skip to content

fix(web): keep both halves of a file-to-symlink change in the PR diff - #12581

Open
Mnigos wants to merge 1 commit into
pingdotgg:mainfrom
Mnigos:pr-diff-order-type-change
Open

Mnigos wants to merge 1 commit into
pingdotgg:mainfrom
Mnigos:pr-diff-order-type-change

Conversation

@Mnigos

@Mnigos Mnigos commented Sep 19, 2026

Copy link
Copy Markdown
Contributor

When a pull request turns a file into a symlink (or back), Git writes the change as two blocks for the same path: a deletion of the old file and an addition of the new one. The Code tab orders diff blocks with orderDiffFiles, which indexed them in a Map keyed by path, so the second block overwrote the first and the deleted contents never appeared in the review. #11075 made those two blocks render safely; this is the remaining place that still assumed one block per path.

orderDiffFiles now groups blocks by path, orders the paths exactly as before, and emits every block of a path in patch order. Import detection reads the lines of all blocks a path owns.

Tests: pullRequestFileOrder.logic.test.ts gains two cases. One parses a real deleted-plus-symlink patch and asserts both blocks survive with distinct render keys; the other covers imports spread across two blocks. Both fail on main (['AGENTS.md:new', 'src/b.ts:new'] instead of the deleted block first) and pass here, along with the existing 15. Targeted lint and web typecheck are clean. The change is pure ordering logic, so there is no visual diff beyond the previously missing block showing up.

Implemented with Claude Code (Claude Fable 5.1).

Summary by CodeRabbit

  • Bug Fixes
    • Improved pull request file diff ordering when a file changes into or from a symbolic link.
    • Ensured related deletion and addition blocks remain grouped and displayed in the correct patch order.
    • Improved dependency-based ordering by considering imports across all diff blocks, including deleted lines.
    • Ensured each diff block is rendered distinctly when multiple blocks share the same file path.

Git writes a file turning into a symlink as a deletion and an addition of
the same path. The pull request Code tab ordered diff blocks through a map
keyed by path, so the addition overwrote the deletion and the removed
contents never showed. Group blocks by path, order the paths as before,
and emit every block of a path in patch order.
@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Sep 19, 2026
@macroscopeapp

macroscopeapp Bot commented Sep 19, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 413da8b

Macroscope's review found this PR approvable — This is a small, self-contained web bug fix that preserves existing diff ordering while retaining both blocks of file-to-symlink changes. Focused tests cover the affected representation and import ordering, with no production configuration, schema, security, or deployment impact.

You can add or adjust custom eligibility rules. Learn more.

@coderabbitai

coderabbitai Bot commented Sep 19, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: pingdotgg/t3code/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 6bd9b50c-24f9-443c-99da-d49dcf42297a

📥 Commits

Reviewing files that changed from the base of the PR and between dfbb11b and 413da8b.

📒 Files selected for processing (2)
  • apps/web/src/components/pullRequest/pullRequestFileOrder.logic.test.ts
  • apps/web/src/components/pullRequest/pullRequestFileOrder.logic.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The diff ordering logic now preserves multiple blocks for the same path, reads imports from all owned blocks, and returns blocks in patch order. Tests cover symlink conversion ordering, unique render keys, and imports found in deletion lines.

Changes

Diff block ordering

Layer / File(s) Summary
Group and expand repeated blocks
apps/web/src/components/pullRequest/pullRequestFileOrder.logic.ts
orderDiffFiles groups all blocks for each path, collects imports from additions and deletions across those blocks, and expands ordered paths back into patch-order blocks.
Validate repeated path behavior
apps/web/src/components/pullRequest/pullRequestFileOrder.logic.test.ts
Tests cover symlink conversion blocks, distinct buildFileDiffRenderKey values, and dependency ordering from imports in deletion lines.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Suggested reviewers: juliusmarminge

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main fix: preserving both parts of a file-to-symlink change in the pull request diff.
Description check ✅ Passed The description explains what changed, why it changed, the tests added, validation results, and the UI impact. It does not use the template headings or include the checklist, but the required informat…
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant