#16608

fix(code-review): display symlink targets without following links

DraftArman19941113wants to merge intofrom

Description

Adding a symlink to a 3,000-line file can make local Code review count and display the referent as newly added code. This change uses Git's link target paths for statistics and diffs, including directory and dangling links.

Symlink reviews use selectable buffers without file backing. Retargeting refreshes their content; file/link transitions rebuild the editor while preserving unsaved edits. Inline comments retain the repository path, and unbacked editors cannot revert hunks into an unsavable buffer.

Linked Issue

Closes #16606

  • The linked issue is labeled ready-to-spec or ready-to-implement. Triaged; awaiting a maintainer readiness label.
  • Where appropriate, screenshots or a short video of the implementation are included below. Earlier Linux GUI evidence is retained below.

Testing

Validated on macOS after merging upstream f8a9c719 into the feature branch (227b170c).

  • cargo nextest run -p warp --lib --features gui --locked --offline --build-jobs 2 --no-fail-fast -E 'test(code_review::code_review_view::tests::) | test(code_review::diff_state::local::tests::)': 65 passed.
  • cargo clippy -p warp --lib --tests --features gui --locked --offline --jobs 2 -- -D warnings: passed.
  • ./script/format: completed after tests and Clippy.
  • git diff refs/remotes/upstream/master...HEAD --check: passed.

The 20 new regression tests cover link targets, HEAD/branch counts and diffs, staging, retargeting, editor transitions, comment saving, and hunk reverts.

  • I have manually tested my changes locally with ./script/run. The latest head has not been launched through this script.

Screenshots / Videos

Earlier Linux GUI validation from #16589 used a direct OSS binary launch under Xvfb and Mesa llvmpipe on Debian 13. It showed three links, +3/-0, and only their target paths before and after staging. The referent remained unchanged.

This screenshot is from the initial patch revision (29bb39c6), before the final comment and revert fixes. Those paths are covered by the automated tests above.

Agent Mode

  • Warp Agent Mode - This PR was created via Warp's AI Agent Mode. Created with Codex.

CHANGELOG-BUG-FIX: Fixed local Code review following symbolic link referents instead of showing and counting their target paths.

Activity

2

This pull request is a draft

Merging is unavailable until it is marked ready for review.