Skip to content

feat: diff parser hardening — Phase 1 (#195) - #218

Merged
ajianaz merged 1 commit into
developfrom
feat/diff-parser-hardening
Jun 7, 2026
Merged

ajianaz merged 1 commit into
developfrom
feat/diff-parser-hardening

Conversation

@ajianaz

@ajianaz ajianaz commented Jun 7, 2026

Copy link
Copy Markdown
Collaborator

Summary

Implements Phase 1 of #195 — diff parser hardening for real-world edge cases.

Changes

Binary Detection

  • GIT binary patch prefix now detected (was only Binary files)
  • Binary file singular form now detected

Truncated Diff Handling

  • Partial diffs now return parsed lines instead of silently dropping data
  • Hunk line count validation: warns on mismatch between header counts and actual lines
  • Debug logging shows expected vs actual counts for troubleshooting

Tests (3 new)

  • truncated_diff_returns_partial_parse — simulates truncated git output
  • git_binary_patch_detected — GIT binary patch format
  • binary_file_marker_variants — singular "Binary file" form

Total: 15 diff parser tests passing.

Test Plan

  • Pre-commit hook: no issues found
  • All 383 tests pass
  • Clippy clean

- Hunk line count validation: warn on mismatch (truncated diffs)
- Broader binary detection: GIT binary patch, Binary file singular
- Graceful truncated diff handling: return partial parse instead of drop
- 3 new tests: truncated diff, git binary patch, binary file variant
- 15 total diff parser tests passing
@ajianaz
ajianaz merged commit 6e8316d into develop Jun 7, 2026
11 checks passed
@ajianaz
ajianaz deleted the feat/diff-parser-hardening branch June 8, 2026 04:22
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