Skip to content

fix(patch): only compare existing source lines - #758

Open
sogav21 wants to merge 1 commit into
kpdecker:masterfrom
sogav21:fix/compareline-missing-lines-20261126
Open

sogav21 wants to merge 1 commit into
kpdecker:masterfrom
sogav21:fix/compareline-missing-lines-20261126

Conversation

@sogav21

@sogav21 sogav21 commented Nov 26, 2026

Copy link
Copy Markdown

Fuzzy patch matching could call compareLine after passing the end of the source, supplying undefined despite its declared string parameter. Compare only existing source lines and let the existing mismatch paths handle missing lines. Missing deletions still fail, missing context can still consume the fuzz budget, and real blank lines still reach the callback.

Fixes #745.

Validation:

  • The two new regression cases fail on the unchanged runtime and pass with this fix; the existing callback test now uses direct string access.
  • Official corepack yarn test passes on Linux/Node 22.23.1 with Yarn 4.18.1: 379 tests, lint, ESM/CommonJS builds, type/package checks, bundles and coverage thresholds.
  • Independent review passed the 80 affected tests, type checks and 17,280 output comparisons, including multi-hunk, custom comparator and LF/CRLF cases.

Full native Windows attempts encountered README line-ending fixtures, Unix permission checks and async timing thresholds; the focused Windows suite passes. No browser or hosted CI result is claimed here.

Integration note for the separate, unmerged #748: the patches apply together and preserve its fixture's output, but its callback-count assertion must expect 2 rather than 3. This fix intentionally omits the initial comparison against an absent line; the iterator change itself remains independent.

Prepared with Codex assistance and independent review.

This branch has not been deployed

No deployments
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.

options.compareLine is mistyped?

1 participant