Repository navigation
refactor(diff): strip index headers from review prompts - #609
Merged
lizhengfeng101 merged 1 commit intoJul 30, 2026
Merged
Conversation
Contributor
|
✅ OpenCodeReview: No comments generated. Looks good to me. |
kall
pushed a commit
to kall/open-code-review
that referenced
this pull request
Aug 14, 2026
ocr core diff selected files with the default extension and path filters only, so a repo whose rule.json excluded a directory still saw those files in core output while ocr review skipped them. The gap was structural: core never accepted a FileFilter at all. Thread the filter through CoreDiffOptions and consult it in the same order the review path does -- an explicit user exclude wins over everything, an explicit user include short-circuits the default extension and path filters -- then apply the deleted check on whatever survives, which is how internal/agent's preview composes the same two steps. Because the matching itself lives in rules.FileFilter, gitignore-style negation, directory patterns, brace expansion, and case-insensitive matching come along for free rather than being reimplemented. The command gains --rule and --exclude to match review, scan, and delegate. Both go through rules.NewResolver and the shared CLI-exclude merge, neither of which touches provider config, so the core group still needs no API key. Parity is pinned by one table run twice: internal/diff checks it through coreWhyExcluded and internal/agent checks the same cases through whyExcluded, so a future ordering change fails one side instead of quietly shipping two different reviewable-file sets. A separate golden test pins that index headers stay stripped from the core JSON diff body (alibaba#609).
Githab-capibara
added a commit
to Githab-capibara/open-code-review
that referenced
this pull request
Sep 17, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Removes Git
index <old-hash>..<new-hash> <mode>headers from per-file diffs embedded in LLM review prompts.These headers contain Git object IDs and file modes that do not provide useful code-review context. The parser removes them only outside diff hunks, preserving all actual code content and existing diff metadata behavior.
Type of Change
How Has This Been Tested?
make testpasses locallyAdditional focused verification:
Added regression coverage verifying that:
indexheaders are removed for multiple files.+index ...source content inside a hunk remains intact.Checklist
go fmt,go vet)Related Issues
Closes #606