Repository navigation
fix(pr-review-canvas): preserve header-like source lines inside hunks - #656
Open
rudycelekli wants to merge 1 commit into
Open
rudycelekli wants to merge 1 commit into
rudycelekli wants to merge 1 commit into
Conversation
Signed-off-by: Rudy Celekli <rudy@gradiahq.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
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 subsequentdiffheader resets that state for full multi-file diffs.Validation:
node --test cursor-team-kit/skills/pr-review-canvas/tests/header-content.test.cjspasses 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 andgit diff --checkpass.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 newdiffline resets hunk state for multi-file full diffs.Adds
header-content.test.cjswith 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.