Summary
Running bash scripts/check-rust-module-size.sh (the module-size gate, limit 500 non-comment lines) against the whole repo currently fails with exit 1 on 11 files that are neither under the limit nor listed in scripts/rust-module-size.allow:
542 src/app/services/ai.rs
573 src/compose/compose/mutation.rs
721 src/compose/mutation.rs
1375 src/db/analytics.rs
614 src/db/heartbeat.rs
665 src/heartbeat.rs
621 src/mcp/rmcp_server.rs
537 src/otlp.rs
508 src/receiver/writer.rs
605 src/scanner/checkpoint.rs
540 src/setup/firstrun.rs
Confirmed pre-existing (verified via git stash before landing an unrelated refactor commit) — not caused by any recent work, just drift that accumulated without anyone updating the allowlist or splitting the files.
Not currently blocking anything: the module_size lefthook (lefthook.yml) only runs check-rust-module-size.sh against {staged_files} on commit, not a whole-repo scan, so these files silently sit over the limit until someone next touches them in a commit — at which point that unrelated commit will unexpectedly fail the gate.
Task
For each file, either:
(a) Extract genuinely separable pieces into sibling modules following the repo's established pattern (see src/db/graph_inventory.rs + src/db/graph_inventory_tests.rs as the canonical example: a .rs file is the module entry, its own sidecar _tests.rs file, #[cfg(test)] #[path = "..._tests.rs"] mod tests; hook, mod_module_files = "deny" convention — never foo/mod.rs), or
(b) If a file is not cleanly separable, add it to scripts/rust-module-size.allow with a comment/PR justification.
src/db/analytics.rs at 1375 lines is the worst offender and probably has the clearest internal seams (it groups several distinct query domains).
Run cargo test --lib, cargo clippy --all-targets, and cargo fmt --check after any extraction to confirm zero behavior change, then bash scripts/check-rust-module-size.sh should exit 0.
Filed from a review sweep of PR #133 (canonical entity resolution) — out of scope for that PR, tracked separately.
Summary
Running
bash scripts/check-rust-module-size.sh(the module-size gate, limit 500 non-comment lines) against the whole repo currently fails with exit 1 on 11 files that are neither under the limit nor listed inscripts/rust-module-size.allow:Confirmed pre-existing (verified via
git stashbefore landing an unrelated refactor commit) — not caused by any recent work, just drift that accumulated without anyone updating the allowlist or splitting the files.Not currently blocking anything: the
module_sizelefthook (lefthook.yml) only runscheck-rust-module-size.shagainst{staged_files}on commit, not a whole-repo scan, so these files silently sit over the limit until someone next touches them in a commit — at which point that unrelated commit will unexpectedly fail the gate.Task
For each file, either:
(a) Extract genuinely separable pieces into sibling modules following the repo's established pattern (see
src/db/graph_inventory.rs+src/db/graph_inventory_tests.rsas the canonical example: a.rsfile is the module entry, its own sidecar_tests.rsfile,#[cfg(test)] #[path = "..._tests.rs"] mod tests;hook,mod_module_files = "deny"convention — neverfoo/mod.rs), or(b) If a file is not cleanly separable, add it to
scripts/rust-module-size.allowwith a comment/PR justification.src/db/analytics.rsat 1375 lines is the worst offender and probably has the clearest internal seams (it groups several distinct query domains).Run
cargo test --lib,cargo clippy --all-targets, andcargo fmt --checkafter any extraction to confirm zero behavior change, thenbash scripts/check-rust-module-size.shshould exit 0.Filed from a review sweep of PR #133 (canonical entity resolution) — out of scope for that PR, tracked separately.