Skip to content

fix(review): account for tracked vendor preview exclusions - #1201

Closed
Qiyuanqiii wants to merge 5 commits into
alibaba:mainfrom
Qiyuanqiii:codex/issue-1197-vendor-preview
Closed

Qiyuanqiii wants to merge 5 commits into
alibaba:mainfrom
Qiyuanqiii:codex/issue-1197-vendor-preview

Conversation

@Qiyuanqiii

@Qiyuanqiii Qiyuanqiii commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Description

Summary

  • Stop dropping tracked diffs under default noisy directories such as vendor/ before the preview and delegate selection layers can account for them.
  • Surface tracked noisy-directory diffs in review --preview and delegate preview as explicit default_path exclusions when they are not opted in.
  • Let user include rules such as "include": ["vendor/**"] or "include": ["**/*"] opt tracked vendored changes back into review.
  • Keep workspace-mode protection for untracked files under noisy directories before synthetic full-file diffs are built.
  • Update the English, Chinese, Japanese, Korean, and Russian docs so the FAQ and review-rule guidance match the supported override behavior.

Root Cause and Fix

Tracked range diffs were being filtered inside the Git diff provider by providerDirIgnoreDirs. That removed files such as vendor/lib.rs before 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 from files, total_files was too low, and excluded_count stayed at zero.

The fix moves this decision to the agent preview filter for tracked diffs:

  • GetDiff now returns every parsed tracked diff instead of applying provider-level directory filtering.
  • diff.IsDefaultExcludedDirPath exposes the built-in noisy-directory predicate in one place.
  • whyExcluded classifies tracked noisy-directory files as default_path after user include patterns are evaluated, so explicit includes can intentionally review tracked vendored files.
  • The existing workspace scan guard still applies isPathExcluded before creating synthetic untracked diffs, so untracked vendor/, node_modules/, target/, and similar trees remain skipped unless they are first staged or committed.

A minimal two-file reproduction now behaves like this:

Scenario Before After
Tracked src/app.rs + tracked vendor/lib.rs, default preview Provider returned only src/app.rs; total_files=1, excluded_count=0 Preview returns both files; vendor/lib.rs is counted with exclude_reason="default_path"; total_files=2, reviewable_count=1, excluded_count=1
Same range with "include": ["**/*"] Provider still returned only src/app.rs; vendored diff was invisible Preview returns both files as reviewable; total_files=2, reviewable_count=2, excluded_count=0
delegate preview on the same range Had the same provider omission Mirrors the corrected review preview accounting and opt-in behavior

Compatibility

  • Default review selection remains conservative for noisy paths: tracked vendored changes are still excluded unless the user includes them explicitly.
  • Existing JSON fields and exclusion reason names are preserved; this reuses default_path rather than adding a schema-level breaking change.
  • Config files that already used broad include patterns now get the intended tracked-diff behavior for vendored code.
  • Untracked workspace files under built-in noisy directories are still intentionally skipped before preview synthesis; the docs now call out staging or committing those files first.

Documentation

Updated localized documentation in:

  • pages/src/content/docs/en/{architecture,faq,review-rules}.md
  • pages/src/content/docs/zh/{architecture,faq,review-rules}.md
  • pages/src/content/docs/ja/{architecture,faq,review-rules}.md
  • pages/src/content/docs/ko/{architecture,faq,review-rules}.md
  • pages/src/content/docs/ru/{architecture,faq,review-rules}.md

The docs now explain the difference between tracked diff accounting, explicit include overrides, and untracked workspace-mode skips.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Refactoring (no functional changes)
  • Documentation update
  • CI / Build / Tooling

How Has This Been Tested?

Reproduction Environment

  • OS: Windows NT 10.0.26200.0, amd64
  • Go: go1.26.5 windows/amd64
  • Baseline OCR used for reproduction and required self-review: open-code-review v1.11.6 (04284b5dc1) windows/amd64
  • Branch base after rebase: origin/main at 810aeb5
  • Final commit: b939188

Red/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 json returned only src/app.rs; vendor/lib.rs was absent, total_files was 1, and excluded_count was 0 even though the Git range had two changed files.

After the fix:

  • Default review --preview --format json returns both files, marks vendor/lib.rs as will_review=false, and reports exclude_reason="default_path".
  • Full-scope review --preview --rule <rule> --format json returns both files as reviewable.
  • delegate preview --format json matches the corrected accounting: default mode places vendor/lib.rs in excluded_files with default_path, while the explicit include rule places it in reviewable_files.

Regression Coverage

Added or updated tests for the corrected boundary:

  • TestPreviewTrackedDefaultExcludedDirIsAccountedAndCanBeIncluded
  • TestRangeDiffReturnsTrackedDefaultExcludedDir
  • TestWorkspaceUntrackedDefaultExcludedDirStillSkipped
  • TestIsDefaultExcludedDirPath
  • TestWhyExcluded_IncludeBypassesDefaultPath

Final Validation

  • go test ./internal/diff ./internal/agent ./cmd/opencodereview
  • Full make test equivalent for every non-extension package: go test -v -race -count=1 ...
  • Project coverage passed at 90.7%: go test -count=1 -coverprofile=coverage.out ... plus go tool cover -func=coverage.out
  • go vet across every non-extension package
  • go mod tidy
  • English-only scan: go run scripts/verify-english-only.go
  • License header scan equivalent to scripts/verify-license.sh
  • git diff --check
  • LF line-ending scan for every file in this commit
  • Required pre-commit OCR self-review completed with 0 findings

GNU Make was unavailable on the Windows validation host, and the local WSL bash shim could not execute shell scripts, so the corresponding Makefile and shell-script checks were run directly from PowerShell.

Checklist

  • My code follows the project's coding style (go fmt, go vet)
  • I have performed a self-review of my code
  • I have added tests that prove the fix is effective
  • New and existing unit tests pass locally with my changes
  • I have updated documentation where behavior or usage changed
  • I have verified LF line endings for the committed files

Known Limitations

  • This intentionally does not make untracked noisy-directory files appear in workspace previews. Those files are still skipped before synthetic full-file diffs are created; users who need that review path should stage or commit the files first.
  • The pre-commit OCR self-review used the installed v1.11.6 binary. It reported 0 findings on the selected source changes; the additional localized docs and regression tests were covered by the manual and automated validation above.

Related Issues

Closes #1197.

@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

✅ OpenCodeReview: Review complete: 0 finding(s) across 3 selected item(s).

@Qiyuanqiii
Qiyuanqiii force-pushed the codex/issue-1197-vendor-preview branch from 9928662 to b939188 Compare September 9, 2026 15:20
@Qiyuanqiii
Qiyuanqiii marked this pull request as ready for review September 9, 2026 15:49
@Qiyuanqiii

Copy link
Copy Markdown
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.

@Qiyuanqiii Qiyuanqiii closed this Nov 18, 2026
@Qiyuanqiii
Qiyuanqiii deleted the codex/issue-1197-vendor-preview branch November 18, 2026 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Preview omits diff-level vendor directory drops from file totals and exclusion reasons; no tracked-vendor override in v1.11.6

1 participant