-
Notifications
You must be signed in to change notification settings - Fork 1.5k
fix(agent): stabilize review item fingerprints #732
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
lizhengfeng101
merged 2 commits into
alibaba:main
from
Linxiushen:fix/stable-review-fingerprints
Aug 14, 2026
+34
−1
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[bug · low]
Potential issue:
strings.TrimRightstrips all trailing characters in the cutset (\r,\n), not just one trailing newline sequence. If the diff legitimately contains trailing blank lines (e.g., a context line that is empty, or a "\ No newline at end of file" scenario where the final line content itself ends with\ror\n), those would also be stripped — collapsing distinct diffs into the same fingerprint.Consider using a more precise trim that only removes a single trailing line ending, e.g.
strings.TrimSuffixapplied once for\r\nthen\n, to match what the comment describes ("removes only that position-dependent delimiter").Suggestion:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keeping TrimRight here intentionally. In a unified diff, every payload line carries a marker: context lines start with a space, additions/deletions with +/- and the no-newline marker with a backslash. A real empty trailing context line is therefore represented as a space-bearing line, never as bare CR/LF bytes. Any run of bare line endings after the final marked line is splitter delimiter noise, and trimming only one would reintroduce the cross-file-position instability this change fixes. The regression test covers both sides: multiple bare trailing newlines normalize to the same fingerprint, while a real empty context line (newline + space) changes it.