fix: add dbt_packages and dbt_modules to file watcher ignore list#501
fix: add dbt_packages and dbt_modules to file watcher ignore list#501anandgupta42 wants to merge 1 commit intomainfrom
dbt_packages and dbt_modules to file watcher ignore list#501Conversation
…#500) The `@parcel/watcher` file watcher was watching all files inside `dbt_packages/` recursively, exhausting macOS file descriptor limits (EMFILE) in projects with many dbt dependencies. - Add `dbt_packages` and `dbt_modules` to the `FOLDERS` ignore set - Add unit tests for dbt directory matching in `FileIgnore.match` - Add e2e tests simulating realistic dbt project structures - Verify false-positive prevention for filenames containing `dbt_packages` Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.
Tip: disable this comment in your organization's Code Review settings.
📝 WalkthroughWalkthroughThese changes extend the file ignore system to exclude DBT dependency directories ( Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/opencode/test/file/watcher-ignore.test.ts (1)
192-245: Consider extracting shared dbt path fixtures to reduce drift.Several hardcoded dbt path lists are repeated across tests; centralizing them would improve maintainability as ignore semantics evolve.
♻️ Optional refactor sketch
+const DBT_SAMPLE_IGNORED_PATHS = [ + "dbt_packages/dbt_utils/macros/sql/generate_series.sql", + "dbt_packages/dbt_utils/macros/sql/get_column_values.sql", + "dbt_packages/dbt_expectations/macros/schema_tests/expect_column_values_to_be_unique.sql", + "dbt_packages/codegen/macros/generate_source.sql", + "dbt_modules/legacy_pkg/macros/old_macro.sql", +] + describe("watcher ignore: dbt directories", () => { test("FileIgnore.match ignores files inside dbt_packages at any depth", () => { - expect(FileIgnore.match("dbt_packages/dbt_utils/macros/sql/generate_series.sql")).toBe(true) - expect(FileIgnore.match("dbt_packages/dbt_utils/macros/sql/get_column_values.sql")).toBe(true) + for (const p of DBT_SAMPLE_IGNORED_PATHS) { + expect(FileIgnore.match(p)).toBe(true) + } }) })🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/opencode/test/file/watcher-ignore.test.ts` around lines 192 - 245, Extract the repeated dbt path lists into a shared test fixture and import it into watcher-ignore.test.ts: create a new test helper (e.g., export const dbtPackages and dbtRealWorldPaths) containing the arrays currently defined as packages, subdirs and realWorldPaths, then replace the in-file packages/subdirs and realWorldPaths references with imports and use them with FileIgnore.match in the tests; update any other tests that duplicate these lists to import the same fixture so the ignore-paths are centralized and easier to maintain (look for symbols packages, subdirs, realWorldPaths, and FileIgnore.match in this file to locate usages).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@packages/opencode/test/file/watcher-ignore.test.ts`:
- Around line 192-245: Extract the repeated dbt path lists into a shared test
fixture and import it into watcher-ignore.test.ts: create a new test helper
(e.g., export const dbtPackages and dbtRealWorldPaths) containing the arrays
currently defined as packages, subdirs and realWorldPaths, then replace the
in-file packages/subdirs and realWorldPaths references with imports and use them
with FileIgnore.match in the tests; update any other tests that duplicate these
lists to import the same fixture so the ignore-paths are centralized and easier
to maintain (look for symbols packages, subdirs, realWorldPaths, and
FileIgnore.match in this file to locate usages).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: c6e35513-a35a-4e40-885f-d0b3123a99fe
📒 Files selected for processing (3)
packages/opencode/src/file/ignore.tspackages/opencode/test/file/ignore.test.tspackages/opencode/test/file/watcher-ignore.test.ts
Summary
Fixes #500
dbt_packagesanddbt_modulesto theFOLDERSignore set in the file watcher, preventingEMFILE: too many open fileserrors on macOS when working in dbt projects with many dependencies@parcel/watcherwas recursively watching all files insidedbt_packages/(often 443+ macro files), exhausting file descriptor limits via fs-eventsnode_modules,vendor,__pycache__, etc.Test plan
dbt_packages/dbt_modulesmatched byFileIgnore.matchat any nesting depthFileIgnore.PATTERNSarray contains both directories (used by watcher)🤖 Generated with Claude Code
Summary by CodeRabbit
Release Notes
New Features
dbt_packagesanddbt_modules) are now automatically excluded from file watching and ignore operations.Tests