Skip to content

fix(pipeline): read diff path headers only before a file's first hunk - #687

Merged
piekstra merged 1 commit into
mainfrom
fix/hunk-lines-not-headers
Oct 22, 2026
Merged

piekstra merged 1 commit into
mainfrom
fix/hunk-lines-not-headers

Conversation

@piekstra

@piekstra piekstra commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

Summary

Fixes #686.

parseUnifiedDiff now reads --- /+++ path headers only before a file's first @@ hunk header. After that, a removed -- comment line (--- comment) or an added ++ x line (+++ x) stays hunk content instead of replacing the file's paths. Git writes no path header after a file's hunks begin, so nothing legitimate is skipped.

Tests

  • New TestParseUnifiedDiffKeepsHeaderLikeHunkLinesAsContent: two files that each remove a -- TODO line, one also adding ++ counter and one with an added +++ /dev/null content line. Both keep their paths, hunk counts and content, and neither is marked deleted.
  • Against the old parser the test fails with old "TODO" path "counter" and old "TODO" ... deleted true.
  • go test ./... and golangci-lint run pass.

Model: Claude Opus 5.5 (1M context, xhigh effort) in Claude Code.

A removed '-- comment' line or an added '++ x' line appears in a hunk as '--- ...' or '+++ ...', and the parser read it as a path header, replacing the file's paths. Headers now count only between 'diff --git' and the first '@@'.

Fixes #686

@monit-reviewer monit-reviewer left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated PR Review

Reviewed commit: 84b2861152b7
Profile: claude-monit-reviewer - Posting as: monit-reviewer

Summary

Reviewer Findings
go:implementation-tests 0
harness-engineering:repo-health 0
security:code-auditor 0

Reviewer Coverage

Complete coverage details are retained in the local coverage.json artifact.

  • go:implementation-tests — complete (broad); scope: 2 files; examples: internal/pipeline/diff.go, internal/pipeline/diff_test.go; body-inspected: 2 files; examples: internal/pipeline/diff.go, internal/pipeline/diff_test.go; skipped: none; constraints: Reviewed the diff only; did not run go test or golangci-lint.
  • harness-engineering:repo-health — complete (constrained); scope: 2 files; examples: internal/pipeline/diff.go, internal/pipeline/diff_test.go; body-inspected: 2 files; examples: internal/pipeline/diff.go, internal/pipeline/diff_test.go; skipped: none; constraints: Reviewed the diff only; did not run tests or linters.
  • security:code-auditor — complete (constrained); scope: 1 file; examples: internal/pipeline/diff.go; body-inspected: 1 file; examples: internal/pipeline/diff.go; skipped: none; constraints: Reviewed only the parseUnifiedDiff change in internal/pipeline/diff.go; tests were not run.

0 PR discussion threads considered. 0 summarized; 0 resolved.


Completed in 1m 04s | ~$0.27 (est.) | claude-sonnet-5-5 | cr 0.10.345
Field Value
Model claude-sonnet-5-5
Reviewers go:implementation-tests, harness-engineering:repo-health, security:code-auditor
Engine claude_cli · claude-sonnet-5-5
Reviewed by cr · monit-reviewer
Duration 1m 04s wall · 1m 37s compute
Cost ~$0.27 (est.)
Pricing basis baseline-2026-10-02/pricing
Tokens 34 in / 4.2k out

Per-workstream usage

  • orchestrator-selection — claude-sonnet-5-5
    • In: 6
    • Out: 996
    • Cache read: 23.0k
    • Cache create: 10.9k
    • Cost: ~$0.06 (est.)
    • Duration: 14s
  • go:implementation-tests — claude-sonnet-5-5
    • In: 8
    • Out: 1.0k
    • Cache read: 42.2k
    • Cache create: 12.2k
    • Cost: ~$0.07 (est.)
    • Duration: 23s
  • harness-engineering:repo-health — claude-sonnet-5-5
    • In: 8
    • Out: 874
    • Cache read: 42.6k
    • Cache create: 12.3k
    • Cost: ~$0.07 (est.)
    • Duration: 26s
  • security:code-auditor — claude-sonnet-5-5
    • In: 6
    • Out: 896
    • Cache read: 26.2k
    • Cache create: 11.8k
    • Cost: ~$0.06 (est.)
    • Duration: 23s
  • orchestrator-rollup — claude-sonnet-5-5
    • In: 6
    • Out: 374
    • Cache read: 45.1k
    • Cache create: 2.3k
    • Cost: ~$0.02 (est.)
    • Duration: 9s

@piekstra
piekstra marked this pull request as ready for review October 22, 2026 18:19
@piekstra
piekstra merged commit 22a67af into main Oct 22, 2026
12 checks passed
@piekstra
piekstra deleted the fix/hunk-lines-not-headers branch October 22, 2026 21:15
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.

Diff parser reads hunk lines starting with --- or +++ as file headers

2 participants