UAT: cli/commands/plan.py exceeds 500-line limit at 3,896 lines — must be split into focused command modules #4110

Open
opened 2026-04-06 10:23:26 +00:00 by freemo · 0 comments
Owner

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)

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. Large files must be broken into focused, cohesive modules.

Actual Behavior

src/cleveragents/cli/commands/plan.py contains 3,896 lines7.8× the allowed limit.

Evidence

$ wc -l src/cleveragents/cli/commands/plan.py
3896 src/cleveragents/cli/commands/plan.py

The file contains many CLI subcommands that could each live in their own module. Additionally, the file contains 6 separate function-level imports of plan_lifecycle_service (at lines 168, 859, 1630, 1898, 2106, 2778) which violates the CONTRIBUTING.md rule against imports inside indented code blocks.

Steps to Reproduce

wc -l src/cleveragents/cli/commands/plan.py
grep -n "from cleveragents.application.services.plan_lifecycle_service" src/cleveragents/cli/commands/plan.py

Suggested Fix

Split into subcommand modules under src/cleveragents/cli/commands/plan/:

  • plan_create.py
  • plan_execute.py
  • plan_status.py
  • plan_list.py
  • etc.

Move the plan_lifecycle_service imports to the top of each module.

Code Location

src/cleveragents/cli/commands/plan.py


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.


Metadata

  • Branch: refactor/decompose-cli-commands-plan
  • Commit Message: refactor(cli): decompose plan.py into focused subcommand modules under cli/commands/plan/
  • Milestone: (Backlog — no milestone assigned)
  • Parent Epic: #2810 (CI Quality Gates Restoration — closest available code-quality Epic)

Subtasks

  • Audit src/cleveragents/cli/commands/plan.py and identify all CLI subcommand groups
  • Create src/cleveragents/cli/commands/plan/ package directory with __init__.py
  • Extract each subcommand group into its own focused module (e.g., plan_create.py, plan_execute.py, plan_status.py, plan_list.py, etc.)
  • Move all 6 function-level plan_lifecycle_service imports to module-level in each new file
  • Update src/cleveragents/cli/commands/plan/__init__.py to re-export the top-level plan Click group
  • Update any imports in other modules that reference cli.commands.plan directly
  • Tests (Behave): verify all plan CLI subcommand scenarios still pass
  • Tests (Robot): verify integration tests for plan commands pass end-to-end
  • Verify each new module is under 500 lines
  • 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.
  • 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 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 new modules are under 500 lines.
  • No function-level imports remain in the plan command modules.
  • All nox stages pass.
  • Coverage ≥ 97%.

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

## 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) ### 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. Large files must be broken into focused, cohesive modules. ### Actual Behavior `src/cleveragents/cli/commands/plan.py` contains **3,896 lines** — **7.8× the allowed limit**. ### Evidence ``` $ wc -l src/cleveragents/cli/commands/plan.py 3896 src/cleveragents/cli/commands/plan.py ``` The file contains many CLI subcommands that could each live in their own module. Additionally, the file contains 6 separate function-level imports of `plan_lifecycle_service` (at lines 168, 859, 1630, 1898, 2106, 2778) which violates the CONTRIBUTING.md rule against imports inside indented code blocks. ### Steps to Reproduce ```bash wc -l src/cleveragents/cli/commands/plan.py grep -n "from cleveragents.application.services.plan_lifecycle_service" src/cleveragents/cli/commands/plan.py ``` ### Suggested Fix Split into subcommand modules under `src/cleveragents/cli/commands/plan/`: - `plan_create.py` - `plan_execute.py` - `plan_status.py` - `plan_list.py` - etc. Move the `plan_lifecycle_service` imports to the top of each module. ### Code Location `src/cleveragents/cli/commands/plan.py` --- > **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. --- ## Metadata - **Branch**: `refactor/decompose-cli-commands-plan` - **Commit Message**: `refactor(cli): decompose plan.py into focused subcommand modules under cli/commands/plan/` - **Milestone**: *(Backlog — no milestone assigned)* - **Parent Epic**: #2810 (CI Quality Gates Restoration — closest available code-quality Epic) ## Subtasks - [ ] Audit `src/cleveragents/cli/commands/plan.py` and identify all CLI subcommand groups - [ ] Create `src/cleveragents/cli/commands/plan/` package directory with `__init__.py` - [ ] Extract each subcommand group into its own focused module (e.g., `plan_create.py`, `plan_execute.py`, `plan_status.py`, `plan_list.py`, etc.) - [ ] Move all 6 function-level `plan_lifecycle_service` imports to module-level in each new file - [ ] Update `src/cleveragents/cli/commands/plan/__init__.py` to re-export the top-level `plan` Click group - [ ] Update any imports in other modules that reference `cli.commands.plan` directly - [ ] Tests (Behave): verify all plan CLI subcommand scenarios still pass - [ ] Tests (Robot): verify integration tests for plan commands pass end-to-end - [ ] Verify each new module is under 500 lines - [ ] 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. - 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 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 new modules are under 500 lines. - No function-level imports remain in the plan command modules. - All nox stages pass. - Coverage ≥ 97%. --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: ca-new-issue-creator
freemo added this to the v3.5.0 milestone 2026-04-06 17:49:10 +00:00
freemo modified the milestone from v3.5.0 to v3.6.0 2026-04-06 18:36:54 +00:00
freemo removed this from the v3.6.0 milestone 2026-04-06 21:07:04 +00:00
HAL9000 added this to the v3.5.0 milestone 2026-04-09 03:11:00 +00:00
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#4110
No description provided.