glob lists a newly ignored file for about 120 s after grep drops it; status has no index freshness
Summary
An ignore file can start to exclude a file that is in the index. Then grep stops listing that file in about 0.5 s. glob continues to list it for about 120 s, until the data layer publishes its next build. During that time, status has no field that tells a caller which index state it serves.
Reproduction (v0.68.1 release binary, standalone protocol, hermetic HOME)
- Make a git repository with
keep/a.txtanddenied/b.txt. Put a unique token in each file and commit. Sendconfigurefor the root, and pollstatusuntil the search index is ready. - Control:
grepfor the token indenied/b.txtandglobfor**/*.txt. The two results listdenied/b.txt. - Append
denied/to the ignore file (atomic write). Pollgrep,globandstatusat 0.5 s intervals. - Use a new fixture for each ignore-file type and for the opposite change (remove the line).
| Change | grep |
glob |
status.search_index.files |
|---|---|---|---|
Add denied/ to .gitignore |
not listed at +0.506 s | listed until +121.001 s | 3 until +121.001 s, then 2 |
Add denied/ to .ignore |
not listed at +0.501 s | listed until +120.501 s | 3 until +120.501 s, then 2 |
Add denied/ to .aftignore |
not listed at +0.503 s | listed until +121.002 s | 3 until +121.002 s, then 2 |
| Remove the line (each type) | listed again at +0.50 to +0.52 s | listed again at +0.50 to +0.52 s |
A file that was not ignored stayed in the two results in all runs. glob reported no fallback walk. At +60 s, the grep reply had "ignored_entries": ["denied/"]. At the same time, glob listed denied/b.txt.
The module log showed data layer built ...: 2 files at about +120.3 s. This agrees with the quiet period in data_layer/runtime.rs:71-85. status.search_index.status stayed ready, and only the file count changed. For .gitignore and .aftignore, watcher.exclusion_planning.matcher_generation went from 1 to 2. For .ignore, it stayed 1.
Expected
globapplies an ignore change at the same time asgrep. For example, it can filter the published list with the current ignore matcher until the next build is published.statustells a caller which index generation it serves and when that generation was published. A map from generation to time is also sufficient. A caller can then compare its own file inventory with the ignore rules. It can then know if the served index contains a given ignore change. Todaystatusgives the state and counts. The snapshot generation that a caller can see has no time.
Thanks for the precise reproduction; the timing table made this quick to find.
You're right: grep applied the changed ignore file straight away, but glob read the last published index until the next build, about two minutes later. We've fixed glob to use the same live file set as grep, in both directions, with a test that drives the quiet period on a paused clock. It's queued for an upcoming release.
On status: search_index.files counts the files in the last published index, which is why it showed 3 until the build. With glob fixed, grep and glob agree, so we're not adding a freshness field for now.