Skip to main content

count_live_files

Function count_live_files 

pub fn count_live_files(db: &FactsDb) -> Result<u64>
Expand description

Count files present at HEAD — the live-tree prevalence denominator.

Mirrors the live_paths liveness rule (arg_max of the latest change_type per path, keeping non-deleted), but without the --min-revs gate run_knowledge_islands applies to its island rows. The Knowledge factor’s fallback tile divides departed islands (already --min-revs-filtered) by this full live-file count, so applying the gate here too would compare unlike populations and skew the ratio.

Returns 0 on an empty store (no changes rows).

§Errors

Returns CodeLoreError::Analysis on DuckDB prepare, query, or row-mapping failure.