Fix malformed @@ header in formatHunkHeader fallback - #695
Conversation
The fallback branch of formatHunkHeader emitted a malformed unified-diff @@ header for the edge-case Hunk shape. Produce a valid @@ -l,s +l,s @@ header matching the standard git format. Adds a regression test.
|
PR author is not in the allowed authors list. |
|
@YuriNachos is attempting to deploy a commit to the Modem Team on Vercel. A member of the Team first needs to authorize it. |
benvinegar
left a comment
There was a problem hiding this comment.
The code change is correct, but this user-visible fix needs a patch Changeset for hunkdiff per the repository's release policy. The current branch fails:
bun run changeset:status --since=origin/main
# Some packages have been changed but no changesets were found.
Please add a .changeset/*.md entry with a concise user-facing summary.
This comment was generated by Pi using GPT-5.6 Sol
|
Heads-up on the red check, so it doesn't read as a problem with this branch: the failing
and the target URL is Every check a fork PR can actually influence is green here: Nothing on this branch can turn Vercel green — it needs the authorize link clicked on your side. Happy to rebase or re-trigger if that helps. |
|
Added a patch changeset for (The red |
Summary
The fallback branch of
formatHunkHeadernow emits a well-formed unified-diff@@header for every Hunk, including the edge case that previously produced a malformed one.Root cause
The fallback used
*Lines(changed-lines count) instead of*Count(total lines incl context) for the@@ -start,count +start,count @@fields, so a Hunk with context lines got a malformed header.Changes
src/core/hunkHeader.ts— use*Countin the fallback@@construction (matches the field semantics documented in@pierre/diffs+ the existing primary branch).src/core/hunkHeader.test.ts(new, bun:test) — proves red→green: a fallback Hunk withdeletionStart:10, deletionCount:4now yields@@ -10,4 +10,4 @@(was@@ -10,1 +10,1 @@), plus a pure-addition@@ -0,0 +1,3 @@case and a context-suffix case.Test plan
bun test src/core/hunkHeader.test.ts— 3 pass, 0 fail.This change was developed with AI assistance (Claude Code); every changed line was reviewed and understood.