Skip to content

Commit ddf963e

Browse files
malinosquiclaude
andcommitted
fix(code-review): use new-file line numbers when parsing changed ranges
parseChangedRanges was returning hunk.oldStart/oldLines, but the ranges are consumed against content.split('\n') (new file) and graph nodes parsed from the PR head — so any lines added or removed earlier in the file shifted offsets and the formatter sliced the wrong code, feeding garbage to the reviewer. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent bb609fb commit ddf963e

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

libs/code-review/infrastructure/adapters/services/graphContentFormatter.service.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,9 @@ export class GraphContentFormatter {
200200

201201
for (const file of parsed) {
202202
for (const hunk of file.hunks) {
203-
const start = hunk.oldStart;
204-
const end = start + hunk.oldLines - 1;
203+
const start = hunk.newStart;
204+
const end =
205+
hunk.newLines > 0 ? start + hunk.newLines - 1 : start;
205206
if (start > 0 && end >= start) {
206207
ranges.push([start, end]);
207208
}

0 commit comments

Comments
 (0)