Skip to content

fix(pr-review-canvas): preserve header-like source lines inside hunks - #656

Open
rudycelekli wants to merge 1 commit into
cursor:mainfrom
rudycelekli:fix/canvas-header-content-20261016
Open

rudycelekli wants to merge 1 commit into
cursor:mainfrom
rudycelekli:fix/canvas-header-content-20261016

Conversation

@rudycelekli

@rudycelekli rudycelekli commented Oct 16, 2026 •

Copy link
Copy Markdown

A JavaScript change from -- count; to ++ count; produces unified diff lines --- count; and +++ count;. The renderer currently mistakes these for file headers and silently drops both substantive changes from the review.

Track whether parsing has entered a hunk. Skip ---/+++ file headers only outside hunks, preserving source lines with those prefixes inside a hunk. A subsequent diff header resets that state for full multi-file diffs.

Validation: node --test cursor-team-kit/skills/pr-review-canvas/tests/header-content.test.cjs passes 3 tests using real Git-generated patches. Both API-patch and full-diff regressions fail on the unchanged base; the ordinary replacement control passes. JavaScript syntax and git diff --check pass.

Existing #482 and #489 fix import filtering/whitespace transformations; inspection of their current renderer patches confirms both retain the unconditional header-prefix skip addressed here.


Note

Low Risk
Localized diff-parsing fix in the review canvas renderer with targeted regression tests; no auth, data, or API surface changes.

Overview
Fixes a bug where pr-review-canvas dropped real code changes when deleted/added lines looked like diff file headers (e.g. -- count; → --- count; and ++ count; → +++ count;).

The diff parser now tracks inHunk: it still skips --- / +++ only before the first @@, but treats those prefixes as normal add/delete lines inside hunks. A new diff line resets hunk state for multi-file full diffs.

Adds header-content.test.cjs with Git-generated patches for API-style hunks and full diffs, plus a simple old/new control.

Reviewed by Cursor Bugbot for commit 17a5a58. Bugbot is set up for automated code reviews on this repo. Configure here.

Signed-off-by: Rudy Celekli <rudy@gradiahq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant