aft icon indicating copy to clipboard operation
aft copied to clipboard

glob lists a newly ignored file for about 120 s after grep drops it; status has no index freshness

Open iceteaSA opened this issue 5 days ago • 1 comments

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)

  1. Make a git repository with keep/a.txt and denied/b.txt. Put a unique token in each file and commit. Send configure for the root, and poll status until the search index is ready.
  2. Control: grep for the token in denied/b.txt and glob for **/*.txt. The two results list denied/b.txt.
  3. Append denied/ to the ignore file (atomic write). Poll grep, glob and status at 0.5 s intervals.
  4. 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

  1. glob applies an ignore change at the same time as grep. For example, it can filter the published list with the current ignore matcher until the next build is published.
  2. status tells 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. Today status gives the state and counts. The snapshot generation that a caller can see has no time.

iceteaSA avatar Nov 28 '26 22:11 iceteaSA

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.

aft-alfonso[bot] avatar Dec 02 '26 21:12 aft-alfonso[bot]