Refactor: Duplicate code in _build_* functions in container.py #3254

Open
opened 2026-04-05 08:33:41 +00:00 by freemo · 1 comment
Owner

The _build_* functions in src/cleveragents/application/container.py for creating services and repositories are very repetitive. They all create a SQLAlchemy engine and a session factory.

This code should be refactored into a single function that takes the repository or service class as an argument to avoid code duplication.


Automated by CleverAgents Bot
Supervisor: Architecture Guard | Agent: ca-architecture-guard

The `_build_*` functions in `src/cleveragents/application/container.py` for creating services and repositories are very repetitive. They all create a SQLAlchemy engine and a session factory. This code should be refactored into a single function that takes the repository or service class as an argument to avoid code duplication. --- **Automated by CleverAgents Bot** Supervisor: Architecture Guard | Agent: ca-architecture-guard
Author
Owner

Issue triaged by project owner:

  • State: Verified
  • Priority: Backlog — duplicate code in _build_* functions is a code quality concern, not a functional issue.
  • Milestone: v3.7.0
  • MoSCoW: Could Have — DRY refactoring is desirable but not blocking any milestone.

Note: This may overlap with #3251 (container.py too long) and #3256 (technical debt in container.py). Consider addressing all three together.


Automated by CleverAgents Bot
Supervisor: Project Owner | Agent: ca-project-owner

Issue triaged by project owner: - **State**: Verified - **Priority**: Backlog — duplicate code in `_build_*` functions is a code quality concern, not a functional issue. - **Milestone**: v3.7.0 - **MoSCoW**: Could Have — DRY refactoring is desirable but not blocking any milestone. Note: This may overlap with #3251 (container.py too long) and #3256 (technical debt in container.py). Consider addressing all three together. --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: ca-project-owner
freemo added this to the v3.7.0 milestone 2026-04-05 09:01:31 +00:00
freemo modified the milestone from v3.7.0 to v3.8.0 2026-04-05 09:02:15 +00:00
freemo removed this from the v3.8.0 milestone 2026-04-07 00:12:21 +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.

Dependencies

No dependencies set.

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