Skip to content

fix(hunkHeader): use per-side total count in the fallback @@ header - #696

Open
YuriNachos wants to merge 1 commit into
modem-dev:mainfrom
YuriNachos:YuriNachos/w11-hunk-headerformat
Open

fix(hunkHeader): use per-side total count in the fallback @@ header#696
YuriNachos wants to merge 1 commit into
modem-dev:mainfrom
YuriNachos:YuriNachos/w11-hunk-headerformat

Conversation

@YuriNachos

Copy link
Copy Markdown

Summary

formatHunkHeader's fallback branch emitted a malformed @@ -l,s +l,s @@ header for any hunk carrying context lines, because it used the changed-lines count (*Lines) instead of the per-side total count (*Count).

Root cause

The fallback built the header from hunk.deletionLines /hunk.additionLines, which count only the changed +/- lines. The unified-diff @@ count is the per-side total (context + changed), so any hunk with context was undercounted and malformed.

Fix

Use hunk.deletionCount /hunk.additionCount (the per-side totals). Hunks with no context are unchanged.

Tests

New hunkHeader.test.ts covers the context-carrying case (was malformed, now correct) and the no-context case (unchanged).

The fallback branch of formatHunkHeader built the @@ -l,s +l,s @@ header
from the changed-lines count (*Lines) instead of the per-side total
count (*Count). For any hunk carrying context, *Lines undercounts and
emits a malformed header. Use *Count (context + changed), matching the
unified-diff spec.

Co-authored-by: Claude <noreply@anthropic.com>
@greptile-apps

greptile-apps Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

PR author is not in the allowed authors list.

@vercel

vercel Bot commented Aug 9, 2026

Copy link
Copy Markdown

@YuriNachos is attempting to deploy a commit to the Modem Team on Vercel.

A member of the Team first needs to authorize it.

@YuriNachos

Copy link
Copy Markdown
Author

Heads-up on the red check, so it doesn't read as a problem with this branch: the failing Vercel job is the fork-deployment authorization gate, not a build or test failure. Its status text is:

Authorization required to deploy.

and the target URL is vercel.com/git/authorize?team=Modem&…, i.e. a request for someone on the Modem team to authorize a deployment from a fork. It is red on every open fork PR in this repo right now, mine and other people's alike — sampled just now: #696, #695, #689 (mine) and #686, #682, #678, #676 (not mine), all with the identical message.

Every check a fork PR can actually influence is green here: Socket Security: Project Report and Socket Security: Pull Request Alerts both pass.

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.

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