Skip to content

fix(engine): read the working tree as Git would push it, and exclude test data by default - #53

Merged
capy-ai[bot] merged 2 commits into
mainfrom
fix/working-tree-ignored
Oct 26, 2026
Merged

capy-ai[bot] merged 2 commits into
mainfrom
fix/working-tree-ignored

Conversation

@sweepies

@sweepies sweepies commented Oct 26, 2026 •

Copy link
Copy Markdown
Owner

Local runs (no repository named) walked the whole checkout, git-ignored directories included, so a working tree could read manifests GitHub never sees. They also took every tracked test fixture and example as a real manifest. This change fixes both and makes the progress label say what it counts.

Working tree reads what a push would carry

read_tree, which lookup, run --dry-run, tui and apply all go through, now lists files with git ls-files -z --cached --others --exclude-standard. That is tracked files plus untracked ones Git doesn't ignore, so .gitignore, .git/info/exclude and the global excludes file apply. Tracked files inside an ignored directory are still read, as on GitHub. A directory outside Git, or a machine without Git, falls back to the old walk, which skips .git. Deleted tracked files, symlinks, submodules and tracked paths below a symlinked directory are skipped, so nothing outside the checkout is read or written.

Root cause, corrected: the default config already excluded **/node_modules/**, so a plain npm, pnpm, bun or Yarn-PnP project on defaults wasn't inflated. In my repro with defaults it read 2 manifests and made 4 lookups. The blow-up happens when a repo's patchula.pkl replaces exclude, or when other ignored directories hold manifests. Repro with exclude = new Listing { "dist/**" }, an npm project and node_modules/ present:

package files lookups
main 79 401
this branch 2 4

Built-in excludes cover install and test-data directories

exclude now defaults to node_modules, bower_components, vendor, .git, test, tests, __tests__, __fixtures__, fixtures and examples, at any depth. This applies to GitHub reads and working-tree reads alike. Amending exclude { … } adds to the defaults. An entry such as exclude { "!examples/app/**" } re-includes one directory, and assigning a new Listing replaces the list. The configuration guide and reference document this, and departures.md records how it differs from Renovate's ignorePaths default and config:recommended.

Running patchula lookup --default-config on this repository:

package files dependencies lookups
old defaults 62 2806 2544
new defaults 27 236 87

The 27 that remain are the workspace and crate Cargo.tomls, Cargo.lock, conformance/Cargo.toml, docs/package.json, mise.toml, the Dockerfile, action.yml and the workflows, so this repo doesn't need its own patchula.pkl. The corpus snapshot is unchanged, because both the snapshot test and corpus:check read paths relative to tests/corpus/. The public-batch cassette drops the 5 blob reads for jdx/usage's test/ and tests/fixtures/ manifests, which are no longer requested.

Progress label

The lookup stage counts unique lookups (one per package, plus one per action ref whose digest is read), so the spinner now says "running N lookups" instead of "looking up N dependencies".

Tests

crates/engine/tests/working_tree.rs covers five cases. An ignored node_modules/ (and an info/excluded build/) full of package.json files is not extracted, even with exclude = new Listing {}. A force-added file in an ignored directory is still read. A directory outside Git is walked with the default excludes applied. A ! entry re-includes a default-excluded directory. A tracked file whose directory became a symlink to somewhere outside is not read.

Open in Capy

…test data by default

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@deepsource-io

deepsource-io Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

DeepSource Code Review

We reviewed changes in 5dea16e...ec0aec9 on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.

See full review on DeepSource ↗

PR Report Card

Overall Grade   Security  

Reliability  

Complexity  

Hygiene  

Code Review Summary

Analyzer Status Updated (UTC) Details
Rust Oct 26, 2026 5:32p.m. Review ↗
JavaScript Oct 26, 2026 5:32p.m. Review ↗
Shell Oct 26, 2026 5:32p.m. Review ↗
Secrets Oct 26, 2026 5:32p.m. Review ↗

Important

AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
count-patchula 24ac3d8 Commit Preview URL

Branch Preview URL
Oct 26 2026, 05:22 PM

@greptile-apps

greptile-apps Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

RetriggerView in Greptile

[Medium impact] The PR appears safe to merge; both earlier findings are addressed.

Reviews (2) · Last reviewed commit: "fix(engine): skip files below symlinked ..." · Reviewed by Greptile

Comment thread crates/engine/src/lib.rs Resolved
Comment thread crates/cli/src/progress.rs Resolved
… in the spinner

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@capy-ai
capy-ai Bot merged commit bfc2927 into main Oct 26, 2026
12 checks passed
@capy-ai
capy-ai Bot deleted the fix/working-tree-ignored branch October 26, 2026 17:41
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.

1 participant