Filters registry rows that are stale under `scope`, restricted to canonical roots under one of `prefixes` (an empty slice means no restriction). Shared by `tracedecay migrate registry-gc` and the post-update health pass so both agree on what counts as a GC candidate.
(
projects: &'a [CodeProjectRecord],
prefixes: &[PathBuf],
scope: StaleRootScope,
)
| 153 | /// restriction). Shared by `tracedecay migrate registry-gc` and the |
| 154 | /// post-update health pass so both agree on what counts as a GC candidate. |
| 155 | pub fn stale_code_projects<'a>( |
| 156 | projects: &'a [CodeProjectRecord], |
| 157 | prefixes: &[PathBuf], |
| 158 | scope: StaleRootScope, |
| 159 | ) -> Vec<&'a CodeProjectRecord> { |
| 160 | projects |
| 161 | .iter() |
| 162 | .filter(|project| { |
| 163 | let canonical_root = Path::new(&project.canonical_root); |
| 164 | prefixes.is_empty() |
| 165 | || prefixes |
| 166 | .iter() |
| 167 | .any(|prefix| canonical_root.starts_with(prefix)) |
| 168 | }) |
| 169 | .filter(|project| match scope { |
| 170 | StaleRootScope::CanonicalRootMissing => !Path::new(&project.canonical_root).exists(), |
| 171 | StaleRootScope::AllRootsMissing => !code_project_root_exists(project), |
| 172 | }) |
| 173 | .collect() |
| 174 | } |
| 175 | |
| 176 | pub fn scan_profile_store_manifests( |
| 177 | profile_root: &Path, |
no test coverage detected