Repository navigation
[diffs] Add an option to disable diff line similarity matching - #1240
Conversation
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.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 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".
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.
|
@codex review |
There was a problem hiding this comment.
💡 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".
…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
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