Skip to content

fix: keep one unparseable file from zeroing the whole review - #975

Open
vkurilyak wants to merge 1 commit into
modem-dev:mainfrom
vkurilyak:fix/one-bad-file-zeroes-review
Open

fix: keep one unparseable file from zeroing the whole review#975
vkurilyak wants to merge 1 commit into
modem-dev:mainfrom
vkurilyak:fix/one-bad-file-zeroes-review

Conversation

@vkurilyak

Copy link
Copy Markdown

I tried Hunk after reading https://x.com/mitchellh/status/2052128048288567617 by Mitchell Hashimoto (https://github.com/mitchellh).

I need better tooling for code reviews before merging changes into production (main branches on GitHub), so a terminal review tool for changesets is exactly what I was looking for.

Hunk showed 0 files +0 -0 and No files match the current filter. on a working copy with 2275 changed files, while a scoped hunk diff -- <single-file> worked fine.

Root cause was 2 PDF files in the same review, both emitted by the VCS as text rather than Binary files ... differ:

  • one is a DocuSign PDF
  • one is a PDF with lots of images

Both contain ESC ] ... BEL-looking binary bytes spanning newlines. stripTerminalControl ate across the newlines, corrupting @@ hunk line counts, so @pierre/diffs threw hunk line count mismatch / hunk has more lines than expected and changesetFromPatch returned zero files for the whole review.

This change limits DCS/OSC stripping to the same line so binary-looking bytes cannot eat newlines, and adds a per-file-chunk fallback so one unparseable file becomes a visible placeholder instead of discarding all files. It also adds regression coverage for both the newline guarantee and the keep-good-files fallback.

Tests:

  • bun test src/core/patch src/core/changeset
  • verified Hunk's real changesetFromPatch on the original 6.1 MB patch: 2275 files (was 0)

@greptile-apps

greptile-apps Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

PR author is not in the allowed authors list.

@vercel

vercel Bot commented Sep 3, 2026

Copy link
Copy Markdown

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

A member of the Team first needs to authorize it.

- Limit DCS/OSC stripping to same line so binary-looking bytes cannot eat newlines
- Fall back to per-file parsing with visible placeholder when whole-patch parse throws
- Add regression coverage for newline guarantee and keep-good-files fallback
@vkurilyak
vkurilyak force-pushed the fix/one-bad-file-zeroes-review branch from 7ce0308 to bf390c8 Compare September 3, 2026 10:58
@benvinegar

Copy link
Copy Markdown
Member

@vkurilyak Thanks for fixing this!

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.

2 participants