Skip to content

Watch only the directories the gitignore-honoring scan enters - #1775

Merged
thekevinscott merged 4 commits into
mainfrom
bot/1768-gitignored-watch-1118
Nov 19, 2026
Merged

thekevinscott merged 4 commits into
mainfrom
bot/1768-gitignored-watch-1118

Conversation

@thekevinbot

@thekevinbot thekevinbot commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #1768

The watch walk skips the same directories as the startup scan. It applies the same .gitignore rules, and it keeps the exemption for paths a glob spells out, including directories created later. When a .gitignore is written, created or deleted while watching, its directory is re-walked. Directories it newly un-ignores get watches, and on Linux their existing files are indexed. Watches already on directories that become ignored stay in place, because the live filter drops their events. The live filter's missing exemption is #1774 and is out of scope here.

Platform note: macOS and Windows use one recursive watch, and BSD's notify backend only adds watches. On those platforms the files already in an un-ignored directory are not indexed until the next build. Files written there afterwards are indexed, as they are today.

Red

Red commit 15d04a6d, CI job 135285717989 (Integration tests):
scan_dirs_leaves_out_a_gitignored_directory_a_glob_reaches panicked: left [root, root/build, root/build/sub, root/docs], right [root, root/docs].

Manual exercise

dirsql server -c .dirsql.toml on a repo with .gitignore = build/, 200 directories under build/, and a table with glob **/*.json. Watch counts come from /proc/<pid>/fdinfo, unique watches:

main branch
inotify watches at start 205 4
after emptying .gitignore 205 205
row in build/d1 after the un-ignore not indexed indexed
file written into build/d2 afterwards indexed indexed

E2E Verification

  • Ran e2e suites locally for every affected SDK
  • Python SDK e2e: pass, 11 tests (subset: watch_fault, fanout, fresh_declared_repros, glob_speed_gitignore, watch_speed)
  • TypeScript SDK e2e: pass (full suite, 29 tests)
  • Rust core e2e: cargo test --workspace --features cli passes, except non_utf8_names and non_utf8_names_e2e. The local filesystem rejects non-UTF-8 file names (EILSEQ), the same on main.
  • packages/python/e2e-attestations/<branch>.json receipt written
  • packages/ts/e2e-attestations/<branch>.json receipt written
  • Command(s) run: testing-conventions e2e attest 'uv run python -m pytest tests/e2e/watch_fault_test.py tests/e2e/fanout_test.py tests/e2e/fresh_declared_repros_test.py tests/e2e/glob_speed_gitignore_test.py tests/e2e/watch_speed_test.py -x -q' (after maturin develop --release and a release CLI build); just e2e-attest-ts
  • Result summary: all passed

Changelog / Migrations

  • Changelog fragment added under packages/rust/changelog.d/
  • Migration fragment with the same slug added under packages/rust/migrations.d/

…nore change

The watch walk now applies the startup scan's gitignore rules, including the exemption for paths a glob spells out. A .gitignore written, created or deleted while watching re-walks its directory, watches the directories it un-ignores and indexes their files.
@thekevinbot
thekevinbot marked this pull request as ready for review November 19, 2026 02:35
@thekevinscott
thekevinscott merged commit a618b68 into main Nov 19, 2026
89 checks passed
@thekevinscott
thekevinscott deleted the bot/1768-gitignored-watch-1118 branch November 19, 2026 02:53
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.

The watcher watches gitignored directories a glob can reach

2 participants