fix(fd): exclude lock files from workspace file indexing#2923
Merged
tusharmath merged 1 commit intomainfrom Apr 10, 2026
Merged
fix(fd): exclude lock files from workspace file indexing#2923tusharmath merged 1 commit intomainfrom
tusharmath merged 1 commit intomainfrom
Conversation
| || name_lower.ends_with("-lock.yml") | ||
| || name_lower.ends_with(".lock.json") | ||
| || name_lower.ends_with(".lockfile") | ||
| || name == "Package.resolved" |
Contributor
There was a problem hiding this comment.
Inconsistent case-sensitivity check. Line 50 uses name (case-sensitive) while all other checks use name_lower (case-insensitive). This will fail to filter out variations like "package.resolved" or "PACKAGE.RESOLVED".
Fix by using the lowercase version:
|| name_lower == "package.resolved"
Suggested change
| || name == "Package.resolved" | |
| || name_lower == "package.resolved" |
Spotted by Graphite
Is this helpful? React 👍 or 👎 to let us know.
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.
Summary
Fix a bug where lock files (e.g.
package-lock.json,Cargo.lock,yarn.lock) were being indexed for workspace sync despite containing no useful content for code intelligence.Context
The file discovery pipeline filtered files by allowed extension, but lock files often carry extensions that appear on the allowlist (e.g.
.json,.yaml,.yml). This meant files likepackage-lock.json,npm-shrinkwrap.json,Cargo.lock, andPackage.resolvedwere being pulled into the indexing pipeline unnecessarily, wasting compute and polluting search results with auto-generated dependency manifests.Changes
is_ignored_by_namefunction incrates/forge_services/src/fd.rsthat matches lock file patterns by full filename, independent of extensionfilter_and_resolveso it runs before the extension allowlist filter*.lock— Cargo.lock, yarn.lock, Gemfile.lock, composer.lock, etc.*.lockb— Bun lock files*-lock.json— package-lock.json, npm-shrinkwrap.json*-lock.yaml/*-lock.yml— various toolchain lock formats*.lock.json— alternative lock file conventions*.lockfile— generic lockfile extensionPackage.resolved— Swift Package ManagerKey Implementation Details
The name check is case-insensitive via
name_lower(a lowercased copy of the filename), with the exception ofPackage.resolvedwhich is matched case-sensitively as the Swift ecosystem uses that exact casing.The filter is applied before
has_allowed_extension, so lock files with otherwise-allowed extensions (.json,.yaml) are rejected early without needing changes to the extension allowlist.Testing
cargo insta test --accept -p forge_services cargo check -p forge_services