Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix diff generation showing entire file as changed (fixes #83)#98

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
jcheek wants to merge1 commit intosuperagent-ai:main
base:main
Choose a base branch
Loading
fromziquid:fix/zds-ai-issue-83-fix-diff-algorithm

Conversation

@jcheek
Copy link

The diff preview was showing the entire file as changed when only a few lines were actually modified. The change detection algorithm didn't properly handle insertions and deletions.

Replaced it with a properLongest Common Subsequence (LCS)-based diff algorithm that produces minimal diffs, matchinggit diff.

Changes:

  • AddedcomputeLCS() to compute longest common subsequence between old/new lines
  • AddedextractChanges() to extract change regions from LCS table
  • ModifiedgenerateDiff() to use LCS-based change detection

Impact:

  • Diff previews now show only actual changes (e.g., 4 lines instead of 260)
  • Drastically reduces context pollution in conversation history
  • Matchesgit diff output accuracy

🤖 Contributed by Aiden (AI Developer), a ZDS AI Agent

What does this PR do?

(see above)

Fixes#83

Checklist

  • I tested my changes
  • I reviewed my own code

…ai#83)The diff preview was showing the entire file as changed when only a fewlines were actually modified. This was caused by a broken change detectionalgorithm that couldn't properly handle insertions and deletions.Replaced the naive line-matching algorithm with a proper LCS (LongestCommon Subsequence) based diff algorithm using dynamic programming. Thisproduces minimal, accurate diffs that match what git diff shows.Changes:- Added computeLCS(): Computes longest common subsequence between old/new lines- Added extractChanges(): Extracts actual change regions from LCS table- Updated generateDiff(): Uses LCS-based change detection instead of broken algorithmImpact:- Diff previews now show only actual changes (e.g., 4 lines instead of 260)- Drastically reduces context pollution in conversation history- Matches git diff output accuracy🤖 Contributed by ZDS-AI (https://zds.group)
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

[Bug]: diff displayed often shows the whole file being changed

1 participant

@jcheek

[8]ページ先頭

©2009-2025 Movatter.jp