You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
src/simlin-engine/src/db.rs is currently 5999 lines. The repo-wide lint scripts/lint-project.sh enforces a hard MAX_LINES=6000 threshold on Rust source files (rule 2 at scripts/lint-project.sh:38-52), and that lint runs in the pre-commit hook and CI. The file is effectively one line away from breaking pnpm lint: any future addition to db.rs of more than ~1 line will trip the threshold and force whoever is working there to do a tangential refactor before they can commit unrelated changes.
This is the same class of problem as #471 (vdf.rs at 6001 lines), but caught proactively — db.rs is right at the edge rather than already over it.
How it got here
The file crept up to 5999 during the LTM cross-element-aggregate-scoring work on branch ltm-503-cross-element-agg. Several commits on that branch had to actively manage headroom — de-duplicating helpers and moving LTM wiring into sibling modules (db_ltm.rs, ltm_agg.rs) — specifically to stay under the cap. There is no slack left.
The hard threshold exists to force modularization of super-sized files; bumping it ad hoc would undermine the policy.
db.rs is the salsa-incremental-compilation hub and a high-traffic file (it's where most new compilation/analysis wiring lands), so the squeeze will recur often.
Component
src/simlin-engine/src/db.rs
Lint rule in scripts/lint-project.sh
What's in db.rs
The salsa machinery: SimlinDb; the SourceProject / SourceModel / SourceVariable salsa inputs; compile_project_incremental; the dependency graph; assemble_module (including a substantial block of LTM wiring in its pass 3); compute_layout; the diagnostic accumulator. It already uses the #[path = "..."] mod ...; pattern to host related code in db_analysis.rs, db_ltm.rs, and ltm_agg.rs.
Possible approaches
Following the existing #[path] submodule precedent (and the #471 fix pattern):
Move the assemble_module / compute_layout layout-and-assembly section — or specifically the LTM-wiring portion of assemble_module's pass 3 — into a new sibling submodule (e.g. db_assemble.rs or db_layout.rs) declared via #[path] mod ...; with pub(super) visibility, alongside db_analysis.rs / db_ltm.rs / ltm_agg.rs.
Or extract the dependency-graph construction into its own submodule.
The fix is mechanical: find a cohesive 200-500-line cluster and relocate it to a db_<name>.rs submodule. Doing it now (with headroom to spare) is lower-risk than doing it under duress when a feature commit is blocked.
Context
Identified during the LTM cross-element-aggregate-scoring work (docs/design-plans/2026-05-09-ltm-503-cross-element-agg.md / branch ltm-503-cross-element-agg), where keeping db.rs under the cap required repeated headroom management.
Related, lower priority
src/simlin-engine/tests/simulate_ltm.rs is 6652 lines — over the 6000-line threshold — but scripts/lint-project.sh excludes */tests/*, so it does not fail the lint. It is nonetheless a very large test file that would benefit from being split by topic (A2A loops, cross-element loops, polarity analysis, etc.).
Problem
src/simlin-engine/src/db.rsis currently 5999 lines. The repo-wide lintscripts/lint-project.shenforces a hardMAX_LINES=6000threshold on Rust source files (rule 2 atscripts/lint-project.sh:38-52), and that lint runs in the pre-commit hook and CI. The file is effectively one line away from breakingpnpm lint: any future addition todb.rsof more than ~1 line will trip the threshold and force whoever is working there to do a tangential refactor before they can commit unrelated changes.This is the same class of problem as #471 (
vdf.rsat 6001 lines), but caught proactively —db.rsis right at the edge rather than already over it.How it got here
The file crept up to 5999 during the LTM cross-element-aggregate-scoring work on branch
ltm-503-cross-element-agg. Several commits on that branch had to actively manage headroom — de-duplicating helpers and moving LTM wiring into sibling modules (db_ltm.rs,ltm_agg.rs) — specifically to stay under the cap. There is no slack left.Why it matters
db.rswill failpnpm lint/ pre-commit / CI on an unrelated diff, the same way engine: vdf.rs exceeds MAX_LINES=6000 lint threshold (6001 lines), breaking pnpm lint #471 brokepnpm lintonmain.db.rsis the salsa-incremental-compilation hub and a high-traffic file (it's where most new compilation/analysis wiring lands), so the squeeze will recur often.Component
src/simlin-engine/src/db.rsscripts/lint-project.shWhat's in db.rs
The salsa machinery:
SimlinDb; theSourceProject/SourceModel/SourceVariablesalsa inputs;compile_project_incremental; the dependency graph;assemble_module(including a substantial block of LTM wiring in its pass 3);compute_layout; the diagnostic accumulator. It already uses the#[path = "..."] mod ...;pattern to host related code indb_analysis.rs,db_ltm.rs, andltm_agg.rs.Possible approaches
Following the existing
#[path]submodule precedent (and the #471 fix pattern):assemble_module/compute_layoutlayout-and-assembly section — or specifically the LTM-wiring portion ofassemble_module's pass 3 — into a new sibling submodule (e.g.db_assemble.rsordb_layout.rs) declared via#[path] mod ...;withpub(super)visibility, alongsidedb_analysis.rs/db_ltm.rs/ltm_agg.rs.The fix is mechanical: find a cohesive 200-500-line cluster and relocate it to a
db_<name>.rssubmodule. Doing it now (with headroom to spare) is lower-risk than doing it under duress when a feature commit is blocked.Context
Identified during the LTM cross-element-aggregate-scoring work (
docs/design-plans/2026-05-09-ltm-503-cross-element-agg.md/ branchltm-503-cross-element-agg), where keepingdb.rsunder the cap required repeated headroom management.Related, lower priority
src/simlin-engine/tests/simulate_ltm.rsis 6652 lines — over the 6000-line threshold — butscripts/lint-project.shexcludes*/tests/*, so it does not fail the lint. It is nonetheless a very large test file that would benefit from being split by topic (A2A loops, cross-element loops, polarity analysis, etc.).