Skip to content

fix(fd): exclude lock files from workspace file indexing#2923

Merged
tusharmath merged 1 commit intomainfrom
unsupported-file-detection
Apr 10, 2026
Merged

fix(fd): exclude lock files from workspace file indexing#2923
tusharmath merged 1 commit intomainfrom
unsupported-file-detection

Conversation

@tusharmath
Copy link
Copy Markdown
Collaborator

@tusharmath tusharmath commented Apr 10, 2026

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 like package-lock.json, npm-shrinkwrap.json, Cargo.lock, and Package.resolved were being pulled into the indexing pipeline unnecessarily, wasting compute and polluting search results with auto-generated dependency manifests.

Changes

  • Added is_ignored_by_name function in crates/forge_services/src/fd.rs that matches lock file patterns by full filename, independent of extension
  • Wired the check into filter_and_resolve so it runs before the extension allowlist filter
  • Patterns covered:
    • *.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 extension
    • Package.resolved — Swift Package Manager

Key Implementation Details

The name check is case-insensitive via name_lower (a lowercased copy of the filename), with the exception of Package.resolved which 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

@github-actions github-actions bot added the type: feature Brand new functionality, features, pages, workflows, endpoints, etc. label Apr 10, 2026
@tusharmath tusharmath changed the title feat(fd): exclude lock files from file indexing by name fix(fd): exclude lock files from workspace file indexing Apr 10, 2026
|| name_lower.ends_with("-lock.yml")
|| name_lower.ends_with(".lock.json")
|| name_lower.ends_with(".lockfile")
|| name == "Package.resolved"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

@tusharmath tusharmath merged commit 445d1ce into main Apr 10, 2026
19 of 20 checks passed
@tusharmath tusharmath deleted the unsupported-file-detection branch April 10, 2026 04:46
@github-actions github-actions bot added the type: fix Iterations on existing features or infrastructure. label Apr 10, 2026
@tusharmath tusharmath removed the type: feature Brand new functionality, features, pages, workflows, endpoints, etc. label Apr 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: fix Iterations on existing features or infrastructure.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant