Skip to content

feat(cli): add Git churn, change coupling, and CODEOWNERS attribution - #202

Merged
avidianity merged 7 commits into
mainfrom
feat/171-churn-coupling-owners
Nov 23, 2026
Merged

avidianity merged 7 commits into
mainfrom
feat/171-churn-coupling-owners

Conversation

@avidianity

@avidianity avidianity commented Nov 23, 2026 •

Copy link
Copy Markdown
Owner

Summary

Adds native gix file commit churn (codeint churn), co-change coupling with bulk-commit noise filtering (codeint coupling), matching read-only churn and coupling MCP tools, and standard CODEOWNERS owner attribution plus --owner filtering across codeint check and codeint diff—strictly preserving ADR 0003 with no blended score.

Closes #171
Closes #182
Closes #183
Closes #184

Tier

Tier 3 from the tier check: crates/cli/tests/mcp.rs updates the tools/list assertion from 6 tools to 8 tools to include the two new churn and coupling MCP tools.

Task

Spec #171 and sub-issues #182, #183, #184:

Fail-first test

  • Test: crates/cli/tests/churn.rs (churn_ranks_eroded_and_duplicated_files_independently_by_commit_count_with_no_score), crates/cli/tests/coupling.rs (coupling_detects_co_changed_pairs_flags_direct_imports_and_omits_blended_scores), and crates/cli/tests/codeowners.rs (check_owner_flag_filters_findings)
  • Before the change: failed with exit code 2 (error: unrecognized subcommand 'churn', error: unrecognized subcommand 'coupling', error: unexpected argument '--owner' found)
  • After the change: passed (all workspace unit, integration, reference, and doc tests green)

Checks

Check Result
cargo test --workspace --locked passed
cargo clippy --workspace --all-targets -- -D warnings passed
cargo fmt --check passed
codeint diff fce5585 passed (0 regressions)
lefthook pre-commit and commit-msg passed
Merged-result check (cargo run --package xtask -- merged-result) passed

Safety proof

  • Safety fact: Repositories without a CODEOWNERS file experience zero behavior or output change in check and diff, shallow clones never fabricate file touches at the shallow boundary, and all Git history reads run natively via gix under #![forbid(unsafe_code)] with zero external git subprocess calls.
  • Proof: crates/cli/tests/codeowners.rs (check_is_silent_when_no_codeowners_file_exists), shallow-clone --depth 1/--depth 2 regression tests in crates/cli/tests/churn.rs and crates/cli/tests/coupling.rs, and Codeowners::load returning Ok(None) with #[serde(default, skip_serializing_if = "Vec::is_empty")] on finding owners.
  • interrogate: Round 1 found 7 verified edge cases (shallow-clone boundary tree diffing, CODEOWNERS escaped glob metacharacters, leading UTF-8 BOM, strict MCP arg type validation, unborn-repo remedy wording, Markdown truncation notice, exact unrounded --min-ratio comparison). All 7 were fixed with regression tests in 3a7d069; clean rerun in progress on 3a7d069.

Runtime evidence

End-to-end CLI and MCP integration tests executed the compiled codeint binary on revision 3a7d069 against synthetic multi-commit temporary Git repositories, --depth 1 and --depth 2 shallow clones, unborn/non-Git directories, and CODEOWNERS fixtures (churn, coupling, codeowners, mcp, reference test suites all passed, and codeint diff fce5585 exited 0 with zero regressions).

Gaps

  • Deferred coverage: none
  • Pre-existing failures: none
  • Environmental failures: none

Extend crates/git with native gix first-parent tree-diff churn analysis
over configurable --since (days or UTC date) and --commits windows, with
clean shallow-clone and non-Git diagnostics. Surface churn-prioritized
Erosion and Duplication Findings independently per Metric (preserving
ADR 0003 with no blended score) via codeint churn (text, TOON, JSON,
Markdown) and the read-only churn tool in codeint mcp.

Closes #182
…filtering

Parse standard CODEOWNERS files (.github/CODEOWNERS, CODEOWNERS, docs/CODEOWNERS)
with last-match-wins semantics, attach matched owners to report Findings when
present while remaining silent when absent, and support --owner filtering in
codeint check and codeint diff.

Closes #184
# Conflicts:
#	crates/cli/src/check.rs
#	crates/report/src/lib.rs
Extend crates/git with native gix co-change pair accumulation over the same history window as churn, excluding bulk commits above --max-commit-files (default 50) and filtering to measured Source-set paths before forming pairs. Annotate each coupled pair with co_change_count, coupling_ratio, and has_direct_import against resolved runtime imports, defaulting to Production with --include-tests and preserving ADR 0003 with no blended score. Expose co-change coupling via codeint coupling (text, TOON, JSON, Markdown) and the read-only coupling tool in codeint mcp.

Closes #183
…upling

# Conflicts:
#	crates/report/src/lib.rs
@github-actions github-actions Bot added the tier-3 Tier 3 from the tier check label Nov 23, 2026
Comment thread crates/cli/tests/churn.rs Fixed
Comment thread crates/cli/tests/churn.rs Fixed
Comment thread crates/cli/tests/churn.rs Fixed
Comment thread crates/cli/tests/churn.rs Fixed
Comment thread crates/cli/tests/churn.rs Fixed
Comment thread crates/cli/tests/churn.rs Fixed
Comment thread crates/cli/tests/churn.rs Fixed
Comment thread crates/cli/tests/churn.rs Fixed
Comment thread crates/cli/tests/churn.rs Fixed
Comment thread crates/cli/tests/churn.rs Fixed
@avidianity
avidianity merged commit e4528d1 into main Nov 23, 2026
13 of 14 checks passed
@avidianity
avidianity deleted the feat/171-churn-coupling-owners branch November 23, 2026 04:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tier-3 Tier 3 from the tier check

Projects

None yet

2 participants