Skip to content

[diffs] Add an option to disable diff line similarity matching - #1240

Merged
amadeus merged 8 commits into
mainfrom
amadeus/disable-line-matching-option
Oct 30, 2026
Merged

amadeus merged 8 commits into
mainfrom
amadeus/disable-line-matching-option

Conversation

@amadeus

@amadeus amadeus commented Oct 28, 2026

Copy link
Copy Markdown
Member

Adds disableLineMatching as a parse-time escape hatch to preserve a patch’s change blocks and line order without similarity matching. Existing behavior stays the default, and generated cache keys distinguish the two modes.

Patch parsers now take an options object. Includes regression tests and updated API docs.

Fixes #1229

Move the cache-key prefix and error flag into an options object for
parsePatchFiles and processPatch. Update callers, tests, docs, and
skill references. Add parser option types for line-matching control.
Set disableLineMatching to preserve the patch's change blocks and line
order. Forward the option through raw patch parsers and skip similarity
realignment when enabled.
Honor disableLineMatching when parsing two files so callers can keep
jsdiff's change blocks and line order. Pass the flag to the parser
separately from jsdiff options.
Give diffs parsed with disableLineMatching their own cache-key scopes
so switching modes cannot reuse the other mode's rendered result.
Preserve default keys and explicit processFile keys.
Cover windowed iteration, source-line coverage, patch boundaries, and
strict errors with matching disabled. Document disableLineMatching as
an escape hatch in the API docs and shipped skill references.
@vercel

vercel Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
pierre-diffshub Ready Ready Preview Oct 28, 2026 5:56am UTC
pierre-docs-diffs Ready Ready Preview Oct 28, 2026 5:56am UTC
pierre-docs-trees Ready Ready Preview Oct 28, 2026 5:56am UTC
pierrejs-diff-demo Ready Ready Preview Oct 28, 2026 5:56am UTC

Request Review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-28T05:41:35.678968Z 72be4b2 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1ff333741c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/diffs/src/types.ts Resolved
Comment thread packages/diffs/src/types.ts Resolved
Use ParseDiffOptions for view options and internal recomputation helpers
so TypeScript callers can pass disableLineMatching through the existing
parseDiffOptions field. Cover forwarding and document the option on
vanilla, React, and CodeView APIs.
Hydrating unkeyed patches from the same keyed files can reuse cached
output from a different line-matching mode.

Pass parseDiffOptions through partial hydration and include the matching
mode when deriving a key from loaded files. Preserve existing keys for
default matching and for patches that already have their own key.
@amadeus

amadeus commented Oct 28, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 72be4b2af3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/diffs/src/types.ts Resolved
@amadeus
amadeus merged commit 854d538 into main Oct 30, 2026
8 checks passed
@amadeus
amadeus deleted the amadeus/disable-line-matching-option branch October 30, 2026 00:19
kclejeune pushed a commit to kclejeune/pierre that referenced this pull request Nov 19, 2026
…ecomputer#1240)

* refactor(diffs): use an options object for patch parsing

Move the cache-key prefix and error flag into an options object for
parsePatchFiles and processPatch. Update callers, tests, docs, and
skill references. Add parser option types for line-matching control.

* feat(diffs): allow patch parsing without line matching

Set disableLineMatching to preserve the patch's change blocks and line
order. Forward the option through raw patch parsers and skip similarity
realignment when enabled.

* feat(diffs): allow file-pair diffs without line matching

Honor disableLineMatching when parsing two files so callers can keep
jsdiff's change blocks and line order. Pass the flag to the parser
separately from jsdiff options.

* fix(diffs): separate cache keys for line-matching modes

Give diffs parsed with disableLineMatching their own cache-key scopes
so switching modes cannot reuse the other mode's rendered result.
Preserve default keys and explicit processFile keys.

* test(diffs): cover parsing without line matching

Cover windowed iteration, source-line coverage, patch boundaries, and
strict errors with matching disabled. Document disableLineMatching as
an escape hatch in the API docs and shipped skill references.

* fix(diffs): accept line matching options on diff views

Use ParseDiffOptions for view options and internal recomputation helpers
so TypeScript callers can pass disableLineMatching through the existing
parseDiffOptions field. Cover forwarding and document the option on
vanilla, React, and CodeView APIs.

* fix(diffs): include line matching in hydrated cache keys

Hydrating unkeyed patches from the same keyed files can reuse cached
output from a different line-matching mode.

Pass parseDiffOptions through partial hydration and include the matching
mode when deriving a key from loaded files. Preserve existing keys for
default matching and for patches that already have their own key.

* fix(tests): fix a flaky test

This branch was successfully deployed

4 active deployments
Preview – pierre-docs-diffs — 5633e289 Deployed Oct 28, 2026 by vercel[bot]
Preview – pierre-docs-trees — 5633e289 Deployed Oct 28, 2026 by vercel[bot]
Preview – pierre-diffshub — 5633e289 Deployed Oct 28, 2026 by vercel[bot]
Preview – pierrejs-diff-demo — 5633e289 Deployed Oct 28, 2026 by vercel[bot]
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.

Bug: unified view shows a change's deleted lines in the middle of its added lines (similarity realignment, since 1.3.0)

1 participant