Repository navigation
fix(config): exclude dependency and build-output directories by default - #1499
lizhengfeng101 merged 4 commits into
Conversation
The default list covered tests, snapshots and generated code but not the
directories a package manager writes. **/oh_modules/** was there and
**/node_modules/** was not.
.gitignore does not stand in for this. Once a directory has been committed
git diff stops consulting .gitignore for it, so reviewing that commit or any
range spanning it pulls in every file -- this repository committed
extensions/frontend/node_modules and one review picked up 389 files. The
extension allowlist does not either: the contents are .js, .ts, .json and
.css, all supported, so they reach the path gate unfiltered.
**/build/** and **/bin/** are deliberately absent. Projects keep hand-written
sources in both, including this repository's own bin/ocr.js, and a false
exclusion is silent.
One behaviour change worth naming: **/vendor/** supersedes the old
extension-scoped **/vendor/**/*.{jsonnet,libsonnet}, so vendored Go and PHP
sources are now excluded where they previously were not. Two test cases
asserted the old behaviour and now assert the new one.
Fixes alibaba#1494
|
✅ OpenCodeReview: Review complete: 0 finding(s) across 1 selected item(s). |
Qiyuanqiii
left a comment
There was a problem hiding this comment.
The implementation itself looks solid to me. The new patterns use the existing path-matching semantics cleanly, the nesting/lookalike coverage is good, and CI/CodeQL are green.
I do think the documentation needs to move with this change before merge, though.
The current Viewer/rule documentation does not merely omit these new patterns; it describes a different filtering model. In particular, the existing review-rules.md / architecture.md text says that default_path is primarily the built-in test-file exclusion gate, while noisy directories such as vendor/, node_modules/, and target/ are filtered earlier by the diff provider.
After this PR, that is no longer generally true. Nested dependency/build directories such as:
extensions/frontend/node_modules/...foo/vendor/...foo/target/...
can now reach the per-file filter and be excluded by default_path. That distinction is user-visible because a user include rule can override a default-path exclusion, whereas the provider-level root-directory blocklist cannot be overridden.
There is also a sequencing issue with #1491: that PR is currently synchronizing the five localized review-rules.md files to the pre-#1499 exclude list. If #1491 lands first and this PR lands unchanged afterwards, the documentation becomes stale again immediately.
Could we update the relevant documentation after rebasing on #1491 (or otherwise coordinate the two PRs), including the five localized review-rules.md files and the corresponding architecture.md explanation of the filtering layers?
I don't have a code-level blocker beyond that. The broader **/vendor/** behavior is a real coverage change, but #1494 explicitly asks for that pattern, so I consider that a maintainer policy decision rather than an implementation defect in this PR.
review-rules.md and architecture.md both said default_path matches built-in test-file patterns, and that noisy directories are filtered earlier at the diff level. After the new patterns the first is incomplete and the second is only true at the repository root: providerDirIgnoreDirs matches by path prefix, so vendor/pkg/x.go never reaches the per-file filter while api/vendor/pkg/x.go does and is excluded by default_path instead. That distinction is user-visible, because an include rule can override a default_path exclusion and cannot override the provider blocklist. Both documents now say which one reports which, and the pattern list covers the dependency and build-output group alongside the test group. Five locales each.
|
@Qiyuanqiii you were right that this was not an omission but a contradiction, and the docs are updated. Pushed. What was wrong. Both documents said if relPath == dirPart || strings.HasPrefix(relPath, prefix) {
The user-visible half is the part I would have under-documented without your review. The two outcomes are not interchangeable: Changed in five locales each: On sequencing with #1491. You are right that whichever of us lands second makes the other stale. I have not rebased onto it, and I would rather say why than do it silently: #1491 is @wu21-web's and is still open, so rebasing onto an unmerged branch would put their commits inside my PR and make this one unreviewable for the thing it is actually about. What I have done instead is make my change additive to the same sections, so the conflict is small and mechanical. My preference, if it helps you sequence them:
Either way I will follow whichever order you pick rather than race it. @wu21-web, since this touches the five files you are already syncing: if you would rather carry the pattern-list half in #1491 yourself and leave me only the root-only correction, say so and I will cut mine back. You have also just told me on #1490 that my translations need work, which I accept, so I would rather you had the option than have me push four more locales past you. On |
|
You are so thoughtful. Yes indeed, you have to pick up the new docs session after my PR gets merged. |
|
Agreed, #1491 first. Once it lands I will rebase onto your list and keep only the two additions this PR needs: the dependency and build-output group, and the correction that the diff-level blocklist matches at the repository root only. Ping me when it merges, or I will pick it up when I see it. |
|
@basil-k-aji-dev please rebase main |
|
ci failing |
…clude-deps # Conflicts: # pages/src/content/docs/en/review-rules.md # pages/src/content/docs/ja/review-rules.md # pages/src/content/docs/ko/review-rules.md # pages/src/content/docs/zh/review-rules.md
| - `**/node_modules/**` | ||
| - `**/bower_components/**` | ||
| - `**/vendor/**` | ||
| - `**/target/**` | ||
| - `**/dist/**` | ||
| - `**/__pycache__/**`, `**/.venv/**`, `**/site-packages/**` | ||
| - `**/Pods/**`, `**/Carthage/**` | ||
| - `**/.next/**`, `**/.nuxt/**`, `**/.gradle/**`, `**/.terraform/**`, … |
There was a problem hiding this comment.
I suggest adding these to the list already there instead of creating a new list per translation, because they are all in the same json file.
|
@NanaseInori review |
Co-authored-by: Kite <[email protected]>
NanaseInori
left a comment
There was a problem hiding this comment.
Re-reviewed the current head (4410d29).
The implementation and regression coverage still look good to me, and the earlier documentation issue about the provider-level versus default_path filtering semantics has been addressed correctly.
I agree with @wu21-web's documentation comment, and I think there is a concrete consistency issue behind it rather than only a formatting preference.
After the rebase, the localized review-rules.md files currently document both:
**/vendor/**/*.{jsonnet,libsonnet}
and:
**/vendor/**
However, default_exclude_patterns.json removes the former and replaces it with the latter. So the documentation now describes an exclusion pattern that no longer exists in the source of truth.
This appears to have been left behind while resolving the documentation conflicts with #1491: the existing synchronized list was retained, and the new dependency/build-output patterns were added as a separate list.
I suggest applying this PR's pattern changes directly to the existing list, as @wu21-web proposed, across the maintained locales. In particular, the old **/vendor/**/*.{jsonnet,libsonnet} entry should be removed when **/vendor/** is added, so the documented list continues to match default_exclude_patterns.json.
I don't see another implementation blocker at the current head. The filtering behavior, nested-path coverage, lookalike regressions, and provider/default-path distinction look coherent, and the current CI, CodeQL, Pages, translation-sync, and plugin-contract checks are green.
Requesting changes only for the documentation/source-of-truth mismatch above.
|
@NanaseInori @wu21-web your two comments landed a few minutes before this merged, so I have taken both in #1541. @NanaseInori, you were right: the localized @wu21-web, also right that one json file should not appear as two lists. Checking both turned up something neither of you had reason to look for. The page listed 74 of the 97 patterns in the file. That gap predates this PR; the list is hand-maintained and has fallen behind more than once. So #1541 generates the single list from the json, and adds a test that fails when the two disagree in either direction. I checked it against both before relying on it, and the stale-entry direction reproduces @NanaseInori's finding exactly: That test would have caught this before merge, which is the part worth having. @lizhengfeng101, your |
Resolve the five conflicts, the one parity gap and the one stale test
the merge exposed:
- internal/agent/{agent,preview}.go: take upstream's selectFiles
refactor (alibaba#782, now in selection.go), then re-apply the branch-side
switch to the shared model primitives (EffectivePath, Status,
ExtFromPath) across agent.go, preview.go and the new selection.go,
and drop the local effectivePath/diffStatus/extFromPath copies.
Taking upstream's agent.go also removes executePlanPhase, dead code
upstream deleted in alibaba#808 that the v1.11.2 merge had resurrected.
- internal/agent/{agent,preview}_test.go, internal/scan/coverage_test.go:
take upstream's new tests, drop the resurrected TestExtFromPath,
TestEffectivePath and TestDiffStatus (covered in internal/model).
- internal/diff/core_diff.go: silent parity break, no conflict. Upstream
added the built-in secret-path gate ahead of the user rules (alibaba#1240),
so `ocr core diff` still offered .env and friends for review. Mirror
agent.whyExcluded: check OldPath and NewPath, return secret_exclude.
Both parity tables gain the same six secret cases.
- Parity tables: the nested-directory case used vendor/, which alibaba#1499
now excludes by default. Move it to apps/ so it still tests user glob
depth. The agent-side table now calls selectFiles directly instead of
re-composing the deleted check.
- skills/open-code-review-local (0.2.1) and the usage doc: document
secret_exclude and the provider-directory drop.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Description
Adds the dependency and build-output patterns from #1494 to
default_exclude_patterns.json, and drops the now-redundant**/vendor/**/*.{jsonnet,libsonnet}line.I checked the two premises in the issue before writing anything, because both are what make this worth doing rather than a
.gitignoreproblem:.gitignoredoes not cover it. Once a directory has been committed,git diffstops consulting.gitignorefor it.c640c109committedextensions/frontend/node_modulesbecause the root.gitignorehad/node_modulesanchored to the root;27c43fa8removed it, but reviewing either commit, or any range spanning them, still pulls in all 389 files.supported_file_types.json:.map,.lock,.sum,.classand.jarare absent, so source maps,yarn.lock,Cargo.lock,go.sumand compiled artifacts are already stopped at the extension gate and need no pattern. But.json,.yaml,.js,.ts,.css,.cjs,.mjsand.hclare all present, sopackage-lock.json,pnpm-lock.yamland everything inside these directories reaches the path gate unfiltered.One behaviour change that needs a decision, not just a review
**/vendor/**is broader than what it replaces, and the narrow pattern was narrow on purpose.allowed_ext_test.gosaid so:The issue asks for
**/vendor/**and for that line to go, so those two cases now asserttrueand carry a comment saying #1494 reversed the earlier decision deliberately. Flagging it here rather than burying it: this is the one change in the PR that stops something being reviewed that used to be, and if the intent was only to widen it for jsonnet, this is the line to push back on.Additions beyond the issue's list
Six, each from a toolchain that writes the directory and no hand-written source:
**/.angular/****/.parcel-cache/****/.docusaurus/****/.stack-work/****/.pnp.cjs,**/.pnp.loader.mjs.cjs/.mjsare both in the allowlist**/.terraform.lock.hcl.terraform/so the directory pattern misses it —.hclis in the allowlist**/build/**and**/bin/**stay out, per the issue. This repository's ownbin/ocr.jsis the counter-example, and both are pinned as not excluded so a later well-meaning addition fails the test rather than silently dropping files.Type of Change
How Has This Been Tested?
make testpasses locallyAgainst the acceptance criteria:
extensions/frontend/node_modules/@babel/core/lib/index.jsis excluded, as arenode_modules/left-pad/index.jsanda/b/c/d/node_modules/pkg/dist/index.js— root, workspace and depth.src/distribution/index.js,src/objects/model.ts,app/targeting/rules.go,src/vendors/stripe.ts,ios/podsmith/Helper.swift,tools/venvironment/setup.py,app/coverages/report.ts,src/node_modules_helper.ts,src/minified.ts,src/package-lock-utils.ts.One existing test outside this package needed updating and I want it visible rather than folded into the diff:
TestWhyExcluded_UserIncludePatternusedvendor/baz.gopurely as "a path outside the include patterns that nothing else excludes", to demonstrate that include is additive.**/vendor/**invalidates the fixture, not the assertion, so the path is nowcmd/baz.gowith a comment saying why it changed.Local run caveat:
make testuses-race, and this machine's kernel has a 47-bit VMA where ThreadSanitizer needs 48, so every package aborts before running. I rango test -count=1 ./..., which is green, plusmake checkandmake english-check.Checklist
go fmt,go vet)allowed_ext.goare unchanged and still accurateAI/LLM disclosure: written with AI assistance — Claude Code, model Claude Opus 5. I reviewed every pattern individually, checked each one against
supported_file_types.jsonand the existing tests rather than assuming, and found thevendorreversal and theTestWhyExcluded_UserIncludePatternfixture by running the suite. The reasoning above and in any review thread is my own.Related Issues
Closes #1494