fix: scope pre-walked paths to $path roots and apply syncback filters

Bugbot flagged two issues with the pre-walked orphan paths:
1. cache.is_file.keys() included shallow project-folder entries (README.md,
   rokit.toml, etc.) that would be incorrectly flagged as orphans.
   Fixed by filtering to only paths under walked $path roots.
2. syncbackRules.ignorePaths was not applied to pre-walked paths.
   Fixed by running is_valid_path() on the pre-walked set before use.
This commit is contained in:
Joe 2026-03-07 16:35:47 -06:00
parent 53c0567153
commit 3666c2a5e1
2 changed files with 46 additions and 40 deletions

View file

@ -290,11 +290,17 @@ pub fn syncback_loop_with_stats(
let phase_timer = std::time::Instant::now();
let existing_paths: HashSet<PathBuf> = if !incremental {
if let Some(pre_walked) = pre_walked_paths.filter(|p| p.len() > 100) {
let before = pre_walked.len();
let filtered: HashSet<PathBuf> = pre_walked
.into_iter()
.filter(|p| is_valid_path(&ignore_patterns, project_path, p))
.collect();
log::info!(
"[PERF] orphan scan: reusing {} pre-walked paths",
pre_walked.len()
"[PERF] orphan scan: reusing pre-walked paths ({} -> {} after syncback filters)",
before,
filtered.len()
);
pre_walked
filtered
} else {
let mut paths = HashSet::new();