Problem. commands/watch.rs::detect_changes walks the project and returns every source file that passes the extension/git-only/glob filters on each debounce tick, rather than files that actually changed. After a trigger the whole project is incrementally indexed, so --filter only decides whether a cycle fires; it does not restrict which files get indexed.
Repro (verified on develop @ 1dd7ac4). Project with src/a.rs and src/b.rs; run cora watch --filter 'a.rs'; append a line to src/b.rs only. Output: Reindexed: 1 files, and the stored fingerprint for b.rs changes even though it does not match the filter.
Why it matters now. Before #577 a basename filter like a.rs never matched (anchored glob), so nothing triggered. Since #577 basename patterns match, so every 500 ms cycle triggers a full incremental index run. It is cheap per cycle (unchanged files are skipped by fingerprint) but is a poll over the whole tree. index --watch also uses this path since #576.
Direction. detect_changes should compare against the last-seen mtime/size (or use fs events) and return only changed files; --filter should limit which files are indexed, not just which cycles fire. Add tests that a change to a non-matching file produces no reindex.
Found while smoke-testing #577. Related: #576.
Problem.
commands/watch.rs::detect_changeswalks the project and returns every source file that passes the extension/git-only/glob filters on each debounce tick, rather than files that actually changed. After a trigger the whole project is incrementally indexed, so--filteronly decides whether a cycle fires; it does not restrict which files get indexed.Repro (verified on develop @ 1dd7ac4). Project with
src/a.rsandsrc/b.rs; runcora watch --filter 'a.rs'; append a line tosrc/b.rsonly. Output:Reindexed: 1 files, and the stored fingerprint forb.rschanges even though it does not match the filter.Why it matters now. Before #577 a basename filter like
a.rsnever matched (anchored glob), so nothing triggered. Since #577 basename patterns match, so every 500 ms cycle triggers a full incremental index run. It is cheap per cycle (unchanged files are skipped by fingerprint) but is a poll over the whole tree.index --watchalso uses this path since #576.Direction.
detect_changesshould compare against the last-seen mtime/size (or use fs events) and return only changed files;--filtershould limit which files are indexed, not just which cycles fire. Add tests that a change to a non-matching file produces no reindex.Found while smoke-testing #577. Related: #576.