Repository navigation
fix(review): account for tracked vendor preview exclusions - #1201
Closed
Qiyuanqiii wants to merge 5 commits into
Closed
Qiyuanqiii wants to merge 5 commits into
Qiyuanqiii wants to merge 5 commits into
Conversation
Contributor
|
✅ OpenCodeReview: Review complete: 0 finding(s) across 3 selected item(s). |
Qiyuanqiii
force-pushed
the
codex/issue-1197-vendor-preview
branch
from
September 9, 2026 15:20
9928662 to
b939188
Compare
Qiyuanqiii
marked this pull request as ready for review
September 9, 2026 15:49
1 task
6 of 15 tasks
Contributor
Author
|
The merged #1223 and #1242 have resolved the issue where tracked vendor files were not counted in the preview. The only remaining unique requirement is to have an explicit include add vendor back into the review scope; this can be discussed separately later. This PR currently no longer has any reason to exist. |
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
Summary
vendor/before the preview and delegate selection layers can account for them.review --previewanddelegate previewas explicitdefault_pathexclusions when they are not opted in."include": ["vendor/**"]or"include": ["**/*"]opt tracked vendored changes back into review.Root Cause and Fix
Tracked range diffs were being filtered inside the Git diff provider by
providerDirIgnoreDirs. That removed files such asvendor/lib.rsbefore the agent preview logic saw them. As a result, preview totals and exclusion accounting could not reconcile with the real Git range: affected files disappeared fromfiles,total_fileswas too low, andexcluded_countstayed at zero.The fix moves this decision to the agent preview filter for tracked diffs:
GetDiffnow returns every parsed tracked diff instead of applying provider-level directory filtering.diff.IsDefaultExcludedDirPathexposes the built-in noisy-directory predicate in one place.whyExcludedclassifies tracked noisy-directory files asdefault_pathafter user include patterns are evaluated, so explicit includes can intentionally review tracked vendored files.isPathExcludedbefore creating synthetic untracked diffs, so untrackedvendor/,node_modules/,target/, and similar trees remain skipped unless they are first staged or committed.A minimal two-file reproduction now behaves like this:
src/app.rs+ trackedvendor/lib.rs, default previewsrc/app.rs;total_files=1,excluded_count=0vendor/lib.rsis counted withexclude_reason="default_path";total_files=2,reviewable_count=1,excluded_count=1"include": ["**/*"]src/app.rs; vendored diff was invisibletotal_files=2,reviewable_count=2,excluded_count=0delegate previewon the same rangeCompatibility
default_pathrather than adding a schema-level breaking change.Documentation
Updated localized documentation in:
pages/src/content/docs/en/{architecture,faq,review-rules}.mdpages/src/content/docs/zh/{architecture,faq,review-rules}.mdpages/src/content/docs/ja/{architecture,faq,review-rules}.mdpages/src/content/docs/ko/{architecture,faq,review-rules}.mdpages/src/content/docs/ru/{architecture,faq,review-rules}.mdThe docs now explain the difference between tracked diff accounting, explicit include overrides, and untracked workspace-mode skips.
Type of Change
How Has This Been Tested?
Reproduction Environment
go1.26.5 windows/amd64open-code-review v1.11.6 (04284b5dc1) windows/amd64origin/mainat810aeb5b939188Red/Green Reproduction
A temporary Git repository was created with one ordinary tracked Rust source file and one tracked Rust file under
vendor/. The range was reviewed with both default preview settings and an explicit full-scope rule:{"include":["**/*"],"exclude":[],"rules":[{"path":"**/*","rule":"review all files"}]}Before the fix on v1.11.6,
review --preview --from HEAD~1 --to HEAD --format jsonreturned onlysrc/app.rs;vendor/lib.rswas absent,total_fileswas1, andexcluded_countwas0even though the Git range had two changed files.After the fix:
review --preview --format jsonreturns both files, marksvendor/lib.rsaswill_review=false, and reportsexclude_reason="default_path".review --preview --rule <rule> --format jsonreturns both files as reviewable.delegate preview --format jsonmatches the corrected accounting: default mode placesvendor/lib.rsinexcluded_fileswithdefault_path, while the explicit include rule places it inreviewable_files.Regression Coverage
Added or updated tests for the corrected boundary:
TestPreviewTrackedDefaultExcludedDirIsAccountedAndCanBeIncludedTestRangeDiffReturnsTrackedDefaultExcludedDirTestWorkspaceUntrackedDefaultExcludedDirStillSkippedTestIsDefaultExcludedDirPathTestWhyExcluded_IncludeBypassesDefaultPathFinal Validation
go test ./internal/diff ./internal/agent ./cmd/opencodereviewmake testequivalent for every non-extension package:go test -v -race -count=1 ...go test -count=1 -coverprofile=coverage.out ...plusgo tool cover -func=coverage.outgo vetacross every non-extension packagego mod tidygo run scripts/verify-english-only.goscripts/verify-license.shgit diff --checkGNU Make was unavailable on the Windows validation host, and the local WSL
bashshim could not execute shell scripts, so the corresponding Makefile and shell-script checks were run directly from PowerShell.Checklist
go fmt,go vet)Known Limitations
Related Issues
Closes #1197.