UAT: infrastructure/database/repositories.py exceeds 500-line limit at 6,035 lines — must be split into focused modules #4114

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

Metadata

  • Branch: refactor/split-database-repositories-module
  • Commit Message: refactor(infrastructure): split repositories.py into per-aggregate repository modules
  • Milestone: (none — backlog, see note below)
  • Parent Epic: #946

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/infrastructure/database/repositories.py contains 6,035 lines12× the allowed limit.

Evidence

$ wc -l src/cleveragents/infrastructure/database/repositories.py
6035 src/cleveragents/infrastructure/database/repositories.py

The file contains multiple repository classes that could each live in their own module:

  • Plan repositories
  • Project repositories
  • Session repositories
  • Resource repositories
  • Skill repositories
  • Decision repositories
  • Correction repositories
  • Automation profile repositories
  • And more

Steps to Reproduce

wc -l src/cleveragents/infrastructure/database/repositories.py

Suggested Fix

Split repositories.py into per-aggregate repository modules under src/cleveragents/infrastructure/database/:

  • plan_repository.py
  • project_repository.py
  • session_repository.py
  • resource_repository.py
  • skill_repository.py
  • decision_repository.py
  • correction_repository.py
  • etc.

Re-export from a thin repositories.py or __init__.py for backward compatibility.

Code Location

src/cleveragents/infrastructure/database/repositories.py

Subtasks

  • Audit repositories.py and catalogue all repository classes by aggregate domain
  • Create per-aggregate module files under src/cleveragents/infrastructure/database/ (e.g., plan_repository.py, project_repository.py, session_repository.py, resource_repository.py, skill_repository.py, decision_repository.py, correction_repository.py, etc.)
  • Move each repository class into its corresponding module, preserving all imports and dependencies
  • Update repositories.py (or __init__.py) to re-export all classes for backward compatibility
  • Update all import sites across the codebase to reference the new module paths (or confirm re-exports cover them)
  • Tests (Behave): Verify all existing BDD scenarios still pass after the split
  • Tests (Robot): Verify all integration tests still pass after the split
  • Confirm each new file 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.
  • src/cleveragents/infrastructure/database/repositories.py no longer exceeds 500 lines (or is replaced by a thin re-export shim under 500 lines).
  • All new per-aggregate repository modules are each under 500 lines.
  • 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.2.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**: `refactor/split-database-repositories-module` - **Commit Message**: `refactor(infrastructure): split repositories.py into per-aggregate repository modules` - **Milestone**: *(none — backlog, see note below)* - **Parent Epic**: #946 ## 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/infrastructure/database/repositories.py` contains **6,035 lines** — **12× the allowed limit**. ### Evidence ``` $ wc -l src/cleveragents/infrastructure/database/repositories.py 6035 src/cleveragents/infrastructure/database/repositories.py ``` The file contains multiple repository classes that could each live in their own module: - Plan repositories - Project repositories - Session repositories - Resource repositories - Skill repositories - Decision repositories - Correction repositories - Automation profile repositories - And more ### Steps to Reproduce ```bash wc -l src/cleveragents/infrastructure/database/repositories.py ``` ### Suggested Fix Split `repositories.py` into per-aggregate repository modules under `src/cleveragents/infrastructure/database/`: - `plan_repository.py` - `project_repository.py` - `session_repository.py` - `resource_repository.py` - `skill_repository.py` - `decision_repository.py` - `correction_repository.py` - etc. Re-export from a thin `repositories.py` or `__init__.py` for backward compatibility. ### Code Location `src/cleveragents/infrastructure/database/repositories.py` ## Subtasks - [ ] Audit `repositories.py` and catalogue all repository classes by aggregate domain - [ ] Create per-aggregate module files under `src/cleveragents/infrastructure/database/` (e.g., `plan_repository.py`, `project_repository.py`, `session_repository.py`, `resource_repository.py`, `skill_repository.py`, `decision_repository.py`, `correction_repository.py`, etc.) - [ ] Move each repository class into its corresponding module, preserving all imports and dependencies - [ ] Update `repositories.py` (or `__init__.py`) to re-export all classes for backward compatibility - [ ] Update all import sites across the codebase to reference the new module paths (or confirm re-exports cover them) - [ ] Tests (Behave): Verify all existing BDD scenarios still pass after the split - [ ] Tests (Robot): Verify all integration tests still pass after the split - [ ] Confirm each new file 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. - `src/cleveragents/infrastructure/database/repositories.py` no longer exceeds 500 lines (or is replaced by a thin re-export shim under 500 lines). - All new per-aggregate repository modules are each under 500 lines. - 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.2.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
freemo added this to the v3.5.0 milestone 2026-04-06 17:49:09 +00:00
freemo modified the milestone from v3.5.0 to v3.6.0 2026-04-06 18:36:53 +00:00
freemo removed this from the v3.6.0 milestone 2026-04-06 21:07:03 +00:00
HAL9000 added this to the v3.5.0 milestone 2026-04-09 03:10:51 +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#4114
No description provided.