Module constants
Expand description
Single source of truth for Options default values + clap
default_value_t annotations. Without this module the same number
had to be edited in two places, and drift went unnoticed at compile
time — a hand-cross-reference of every default was the only catch.
Add new defaults here; reference from Options::default() AND from
the corresponding #[arg(default_value_t = …)] annotation in
codelore-cli. Tests that want the default value can use codelore_lib::constants::*; and reference the constant by name —
readers learn the semantics from the name instead of from a magic
number with a one-line comment.
Constants§
- DEFAULT_
CLONE_ SIMILARITY_ FLOOR - Minimum AST-node similarity (0.0 - 1.0) for two functions to be
considered structurally a clone. 0.70 matches the floor used by
CodeLore’s Type-2 detection in the original design. - DEFAULT_
CLONE_ SKIP_ SAME_ DIR - Skip clone pairs whose two members live in the same directory. ON by default because same-dir clones are usually intentional helpers (e.g., test-fixture duplicates), and they crowd out the cross-module signal. Users who want them can opt back in.
- DEFAULT_
DEPARTED_ THRESHOLD_ DAYS - An author is considered “departed” if their most recent commit
anywhere in the repo is older than this many days at the anchor
moment. 90 days is the default — chosen as the empirical
“person has stopped contributing in a meaningful way” threshold
based on industry retention/sabbatical patterns (most engineers who
leave permanently stop committing within 60 days; a 90-day window
avoids flagging contributors on extended leave / between projects).
Tunable via
--departed-threshold-days Nfor organisations with longer (academia / OSS maintainers) or shorter (fast-moving startup) project cadences. - DEFAULT_
DUCKDB_ MEMORY_ LIMIT - Default
DuckDBmemory_limitPRAGMA applied to every connection this binary opens (seefacts::mod::apply_memory_pragmas). Matches the v1 performance target of “peak memory under 4 GB (DuckDBspill enabled)” documented indocs/superpowers/specs/2026-06-06-codelore-design.md(§ Performance targets) and measured indocs/perf-evidence-v1.md. Once a query’s resident state would exceed this ceiling,DuckDBspills intermediate hash-join / sort / aggregation state totemp_directoryinstead of growing unbounded and inviting the OS OOM killer. - DEFAULT_
FISHER_ SIGNIFICANCE - Two-tailed Fisher exact p-value cutoff above which a coupling pair
is considered statistically insignificant and dropped. 0.05 is the
conventional alpha;
CodeLoreinherits it. - DEFAULT_
MAX_ AST_ FILE_ BYTES - Maximum source-file size in bytes that we’ll feed to tree-sitter for complexity / clones extraction at HEAD. Files larger than this are skipped with a tracing-debug log entry and excluded from AST-based metrics.
- DEFAULT_
MAX_ CHANGESET_ SIZE - Drop commits touching more than N files from coupling / SOC analyses.
Matches code-maat’s
-sdefault. Filters refactor sweeps that create spurious coupling noise (renames, mass formatter passes). - DEFAULT_
MAX_ COUPLING_ PCT - Upper coupling-degree ceiling (percent). Matches code-maat’s
-xdefault. Pairs at 100% (every commit modifies both files) are usually file splits or copy/rename artifacts; the upper bound exists to drop them when desired. - DEFAULT_
MIN_ CLONE_ NODE_ COUNT - Minimum AST-node count for a clone candidate. Functions smaller than this are usually trivial getters / setters / accessor wrappers that produce noisy false positives.
- DEFAULT_
MIN_ CLONE_ SHARED_ REVS - Minimum shared revisions for a clone pair to surface in
clone-coupling. Lower thanmin_shared_revsbecause clones are rarer; we want the signal even for occasional co-changes. - DEFAULT_
MIN_ COUPLING_ PCT - Lower coupling-degree threshold (percent). Matches code-maat’s
-idefault. Pairs below this floor don’t surface incouplingoutput. - DEFAULT_
MIN_ REVS - Minimum revisions per entity to surface in any per-file analysis.
Matches code-maat’s
-ndefault. Filters away long-tail noise (files changed once or twice) from hotspots and ownership reports. - DEFAULT_
MIN_ SHARED_ REVS - Minimum shared revisions for a coupling pair. Below this floor, the
(A, B)pair is dropped before the Fisher exact test even runs. Matches code-maat’s-mdefault. - DEFAULT_
RELEASE_ TAG_ GLOB - Default glob pattern for selecting release tags in
release-cadence. Only tags whose short name matches this pattern are counted as releases. Uses standard glob syntax (*= any sequence,?= single char,[...]= character class). Defaultv*captures conventional semver tags (v1.0.0,v2.3.1) while excluding nightly/prerelease tags that do not represent formal releases. - DEFAULT_
REWORK_ WINDOW_ DAYS - Default rework-detection window in days. Hunk pairs on the same path
where the second commit’s author-date is within this many days of the
first are considered rework candidates. 21 days aligns with Pluralsight
Flow’s convention (
GitClearuses 14; ours is configurable via--rework-window-days). Output is labelled “approximate” because line drift between commits is not tracked. - DEFAULT_
SUBSTANTIAL_ OWNER_ THRESHOLD - Threshold for “substantial author” — an author who isn’t the
main author but owns at least this fraction of file’s
LoC. Used to countn_substantial_othersper file inknowledge-islands. A file with 0 substantial other owners + departed main author is the most actionable knowledge-loss signal; 1+ substantial others means there’s still someone who genuinely knows the code. - DEFAULT_
WINDOW_ DAYS - Default trailing-window length (in days) for activity-scoped analyses. Anchored to the repo’s most recent commit date, not wall-clock time, so results are reproducible on archived repos. Used by any analysis that should focus on recent activity rather than full history. 90 days is the prevailing “active contributor” window in contributor-lifecycle research and long enough to smooth vacation/release-cycle gaps.