Skip to content

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

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

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.

Evidence

Captured in the web client on macOS 15.7.5 (Playwright, headless Chromium 1400×900) with a temporary draft PR on my fork that replaces LICENSE with a symlink to README.md, viewed in the PR panel's Code tab (All commits, stacked layout, hunks expanded, light appearance). Before is today's main (5cc99e1), after is this branch (413da8b); both panels are cropped identically.

before (main @ 5cc99e1) after (PR @ 413da8b)
before: only the added symlink block is listed after: the deleted LICENSE block and the added symlink block are both listed

Observed: on main the Code tab lists one block for LICENSE, the added one-line symlink, and the 21 deleted lines never appear. On this branch the deleted LICENSE block renders first, followed by the added symlink block, matching gh pr diff. The tab's counter reads "2 files" for the two blocks of that path while the PR header reads "1 file"; that counter counts diff blocks and is unchanged by this PR. Desktop and mobile clients were not exercised; the ordering logic is shared.

Implemented with Claude Code (Claude Fable 5.1).

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.

Copy link
Copy Markdown
Member

Note

This comment is posted by Julius' dot

Closing for missing UI verification. The tests show that both diff blocks survive ordering, but the PR supplies no before/after capture of the Code tab displaying the previously missing deletion. Add those screenshots and the observed client result, then request reconsideration.

@Mnigos

Mnigos commented Oct 1, 2026

Copy link
Copy Markdown
Contributor Author

Note

🤖 Claude Fable 5.1 on behalf of Mnigos

Added the missing verification to the description: before/after screenshots of the Code tab on macOS (headless Chromium 1400×900) using a draft PR on my fork that replaces LICENSE with a symlink. On main only the added symlink block is listed; on this branch the deleted LICENSE block renders first, followed by the symlink block, matching gh pr diff. The description also states the observed counter behavior and what was not exercised. The branch itself is unchanged (413da8b). Requesting reconsideration.

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.

2 participants