UAT: 20+ additional Python files exceed 500-line limit — widespread CONTRIBUTING.md violation across application and CLI layers #4137

Closed
opened 2026-04-06 10:34:55 +00:00 by freemo · 1 comment
Owner

Metadata

  • Branch: fix/backlog-500-line-violations-widespread
  • Commit Message: fix(refactor): split 35 oversized Python modules exceeding 500-line CONTRIBUTING.md limit
  • Milestone: (none — backlog, see note below)
  • Parent Epic: #2810

Bug Report

Feature Area: Code Organization and Module Structure
Tested by: UAT tester instance uat-tester-code-org-001
Severity: Medium (CONTRIBUTING.md compliance violation — widespread)

What Was Tested

Checked all Python files in src/cleveragents/ for compliance with the 500-line file size limit specified in CONTRIBUTING.md line 399: "Keep files under 500 lines. Break large files into focused, cohesive modules."

Expected Behavior (from CONTRIBUTING.md)

All Python source files should be under 500 lines.

Actual Behavior

In addition to the most egregious violations already reported separately (repositories.py at 6,035 lines, plan_lifecycle_service.py at 2,649 lines, cli/commands/plan.py at 3,896 lines, models.py at 3,594 lines), 20+ additional files exceed the 500-line limit:

File Lines Excess
application/services/config_service.py 1,728 3.5×
application/services/plan_service.py 1,434 2.9×
domain/models/core/plan.py 1,278 2.6×
application/services/correction_service.py 1,255 2.5×
config/settings.py 1,104 2.2×
application/container.py 968 1.9×
application/services/context_service.py 970 1.9×
application/services/decision_service.py 999 2.0×
application/services/acms_service.py 893 1.8×
application/services/checkpoint_service.py 907 1.8×
application/services/plan_executor.py 860 1.7×
cli/commands/repl.py 843 1.7×
cli/commands/actor.py 840 1.7×
cli/commands/project.py 980 2.0×
cli/commands/context.py 830 1.7×
cli/commands/session.py 753 1.5×
cli/main.py 827 1.7×
cli/commands/resource.py 1,513 3.0×
cli/output/materializers.py 679 1.4×
application/services/acms_pipeline.py 737 1.5×
application/services/semantic_validation_rules.py 721 1.4×
application/services/memory_service.py 743 1.5×
application/services/component_resolver.py 743 1.5×
application/services/plan_apply_service.py 810 1.6×
domain/models/core/session.py 637 1.3×
domain/models/core/project.py 553 1.1×
application/services/autonomy_guardrail_service.py 647 1.3×
application/services/subplan_execution_service.py 665 1.3×
application/services/depth_breadth_projection.py 669 1.3×
application/services/context_tiers.py 595 1.2×
application/services/validation_pipeline.py 612 1.2×
application/services/audit_service.py 517 1.0×
application/services/repo_indexing_service.py 504 1.0×
cli/commands/system.py 630 1.3×
cli/commands/config.py 557 1.1×

Steps to Reproduce

find src/cleveragents -name "*.py" -type f | xargs wc -l | sort -rn | awk '$1 > 500 {print $1, $2}'

Impact

Files this large are difficult to review, test, and maintain. They typically indicate that a single module is handling too many responsibilities (Single Responsibility Principle violation).

Suggested Fix

Each file should be split into focused, cohesive modules with clear single responsibilities. For service files, consider splitting by:

  • Distinct business operations (create, read, update, delete)
  • Distinct domain concepts handled
  • Distinct phases of a workflow

For CLI command files, consider splitting by subcommand group.

Code Location

Widespread — see table above for all affected files.

Subtasks

  • Audit each of the 35 files listed above and identify logical split boundaries
  • Split application/services/config_service.py (1,728 lines) into focused sub-modules
  • Split application/services/plan_service.py (1,434 lines) into focused sub-modules
  • Split domain/models/core/plan.py (1,278 lines) into focused sub-modules
  • Split application/services/correction_service.py (1,255 lines) into focused sub-modules
  • Split config/settings.py (1,104 lines) into focused sub-modules
  • Split application/container.py (968 lines) into focused sub-modules
  • Split application/services/context_service.py (970 lines) into focused sub-modules
  • Split application/services/decision_service.py (999 lines) into focused sub-modules
  • Split remaining application/services files (acms_service, checkpoint_service, plan_executor, acms_pipeline, semantic_validation_rules, memory_service, component_resolver, plan_apply_service, autonomy_guardrail_service, subplan_execution_service, depth_breadth_projection, context_tiers, validation_pipeline, audit_service, repo_indexing_service)
  • Split CLI command files (repl.py, actor.py, project.py, context.py, session.py, main.py, resource.py, system.py, config.py) and cli/output/materializers.py
  • Split domain model files (session.py, project.py)
  • Update all import paths across the codebase after each split
  • Verify all tests pass after each split (nox)
  • Verify coverage >= 97% via nox -s coverage_report
  • Run nox (all default sessions), fix any errors

Definition of Done

This issue is complete when:

  • All subtasks above are completed and checked off.
  • All 35 listed Python files are under 500 lines each.
  • No new files introduced by the splits exceed 500 lines.
  • Each new module has a clear, single responsibility.
  • All import paths updated and no broken imports remain.
  • A Git commit is created where the first line of the commit message matches the Commit Message in Metadata exactly, followed by a blank line, then additional lines providing relevant details about the implementation.
  • The commit is pushed to the remote on the branch matching the Branch in Metadata exactly.
  • The commit is submitted as a pull request to master, reviewed, and merged before this issue is marked done.
  • All nox stages pass
  • Coverage >= 97%

Backlog note: This issue was discovered during autonomous operation
on milestone v3.7.0. It does not block milestone completion and has been
placed in the backlog for human review and future milestone assignment.


Automated by CleverAgents Bot
Supervisor: UAT Testing | Agent: ca-new-issue-creator

## Metadata - **Branch**: `fix/backlog-500-line-violations-widespread` - **Commit Message**: `fix(refactor): split 35 oversized Python modules exceeding 500-line CONTRIBUTING.md limit` - **Milestone**: *(none — backlog, see note below)* - **Parent Epic**: #2810 ## Bug Report **Feature Area:** Code Organization and Module Structure **Tested by:** UAT tester instance uat-tester-code-org-001 **Severity:** Medium (CONTRIBUTING.md compliance violation — widespread) ### What Was Tested Checked all Python files in `src/cleveragents/` for compliance with the 500-line file size limit specified in CONTRIBUTING.md line 399: *"Keep files under 500 lines. Break large files into focused, cohesive modules."* ### Expected Behavior (from CONTRIBUTING.md) All Python source files should be under 500 lines. ### Actual Behavior In addition to the most egregious violations already reported separately (repositories.py at 6,035 lines, plan_lifecycle_service.py at 2,649 lines, cli/commands/plan.py at 3,896 lines, models.py at 3,594 lines), **20+ additional files** exceed the 500-line limit: | File | Lines | Excess | |------|-------|--------| | `application/services/config_service.py` | 1,728 | 3.5× | | `application/services/plan_service.py` | 1,434 | 2.9× | | `domain/models/core/plan.py` | 1,278 | 2.6× | | `application/services/correction_service.py` | 1,255 | 2.5× | | `config/settings.py` | 1,104 | 2.2× | | `application/container.py` | 968 | 1.9× | | `application/services/context_service.py` | 970 | 1.9× | | `application/services/decision_service.py` | 999 | 2.0× | | `application/services/acms_service.py` | 893 | 1.8× | | `application/services/checkpoint_service.py` | 907 | 1.8× | | `application/services/plan_executor.py` | 860 | 1.7× | | `cli/commands/repl.py` | 843 | 1.7× | | `cli/commands/actor.py` | 840 | 1.7× | | `cli/commands/project.py` | 980 | 2.0× | | `cli/commands/context.py` | 830 | 1.7× | | `cli/commands/session.py` | 753 | 1.5× | | `cli/main.py` | 827 | 1.7× | | `cli/commands/resource.py` | 1,513 | 3.0× | | `cli/output/materializers.py` | 679 | 1.4× | | `application/services/acms_pipeline.py` | 737 | 1.5× | | `application/services/semantic_validation_rules.py` | 721 | 1.4× | | `application/services/memory_service.py` | 743 | 1.5× | | `application/services/component_resolver.py` | 743 | 1.5× | | `application/services/plan_apply_service.py` | 810 | 1.6× | | `domain/models/core/session.py` | 637 | 1.3× | | `domain/models/core/project.py` | 553 | 1.1× | | `application/services/autonomy_guardrail_service.py` | 647 | 1.3× | | `application/services/subplan_execution_service.py` | 665 | 1.3× | | `application/services/depth_breadth_projection.py` | 669 | 1.3× | | `application/services/context_tiers.py` | 595 | 1.2× | | `application/services/validation_pipeline.py` | 612 | 1.2× | | `application/services/audit_service.py` | 517 | 1.0× | | `application/services/repo_indexing_service.py` | 504 | 1.0× | | `cli/commands/system.py` | 630 | 1.3× | | `cli/commands/config.py` | 557 | 1.1× | ### Steps to Reproduce ```bash find src/cleveragents -name "*.py" -type f | xargs wc -l | sort -rn | awk '$1 > 500 {print $1, $2}' ``` ### Impact Files this large are difficult to review, test, and maintain. They typically indicate that a single module is handling too many responsibilities (Single Responsibility Principle violation). ### Suggested Fix Each file should be split into focused, cohesive modules with clear single responsibilities. For service files, consider splitting by: - Distinct business operations (create, read, update, delete) - Distinct domain concepts handled - Distinct phases of a workflow For CLI command files, consider splitting by subcommand group. ### Code Location Widespread — see table above for all affected files. ## Subtasks - [ ] Audit each of the 35 files listed above and identify logical split boundaries - [ ] Split `application/services/config_service.py` (1,728 lines) into focused sub-modules - [ ] Split `application/services/plan_service.py` (1,434 lines) into focused sub-modules - [ ] Split `domain/models/core/plan.py` (1,278 lines) into focused sub-modules - [ ] Split `application/services/correction_service.py` (1,255 lines) into focused sub-modules - [ ] Split `config/settings.py` (1,104 lines) into focused sub-modules - [ ] Split `application/container.py` (968 lines) into focused sub-modules - [ ] Split `application/services/context_service.py` (970 lines) into focused sub-modules - [ ] Split `application/services/decision_service.py` (999 lines) into focused sub-modules - [ ] Split remaining application/services files (acms_service, checkpoint_service, plan_executor, acms_pipeline, semantic_validation_rules, memory_service, component_resolver, plan_apply_service, autonomy_guardrail_service, subplan_execution_service, depth_breadth_projection, context_tiers, validation_pipeline, audit_service, repo_indexing_service) - [ ] Split CLI command files (repl.py, actor.py, project.py, context.py, session.py, main.py, resource.py, system.py, config.py) and `cli/output/materializers.py` - [ ] Split domain model files (session.py, project.py) - [ ] Update all import paths across the codebase after each split - [ ] Verify all tests pass after each split (`nox`) - [ ] Verify coverage >= 97% via `nox -s coverage_report` - [ ] Run `nox` (all default sessions), fix any errors ## Definition of Done This issue is complete when: - All subtasks above are completed and checked off. - All 35 listed Python files are under 500 lines each. - No new files introduced by the splits exceed 500 lines. - Each new module has a clear, single responsibility. - All import paths updated and no broken imports remain. - A Git commit is created where the **first line** of the commit message matches the Commit Message in Metadata exactly, followed by a blank line, then additional lines providing relevant details about the implementation. - The commit is pushed to the remote on the branch matching the **Branch** in Metadata exactly. - The commit is submitted as a **pull request** to `master`, reviewed, and **merged** before this issue is marked done. - All nox stages pass - Coverage >= 97% > **Backlog note:** This issue was discovered during autonomous operation > on milestone v3.7.0. It does not block milestone completion and has been > placed in the backlog for human review and future milestone assignment. --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: ca-new-issue-creator
Author
Owner

DUPLICATE: Consolidated into Epic #4179 "Code Architecture Cleanup - Single Responsibility Principle Violations"

This UAT finding about 20+ Python files exceeding 500-line limit is part of the broader architectural cleanup effort. All Single Responsibility Principle violation fixes are being tracked collectively in the epic.

Action: Closing as duplicate in favor of Epic #4179

**DUPLICATE**: Consolidated into Epic #4179 "Code Architecture Cleanup - Single Responsibility Principle Violations" This UAT finding about 20+ Python files exceeding 500-line limit is part of the broader architectural cleanup effort. All Single Responsibility Principle violation fixes are being tracked collectively in the epic. **Action**: Closing as duplicate in favor of Epic #4179
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
cleveragents/cleveragents-core#4137
No description provided.