MCPcopy Create free account
hub / github.com/ScriptedAlchemy/tracedecay / stale_code_projects

Function stale_code_projects

src/migrate/registry.rs:155–174  ·  view source on GitHub ↗

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,
)

Source from the content-addressed store, hash-verified

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.
155pub 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
176pub fn scan_profile_store_manifests(
177 profile_root: &Path,

Callers 2

handle_migrate_actionFunction · 0.85

Calls 4

code_project_root_existsFunction · 0.85
collectMethod · 0.80
existsMethod · 0.80
is_emptyMethod · 0.45

Tested by

no test coverage detected