Skip to content

refactor: Split db/schedules.py — extract execution queries (1092 lines) #118

Closed as not planned

Description

@vybe

Problem

src/backend/db/schedules.py (1092 lines) mixes schedule CRUD with execution tracking and statistics queries. The ScheduleOperations class has 3 functions at CC >= 14:

Function CC
update_schedule 18
_row_to_schedule_execution 14
get_all_agents_execution_stats_dual 14

Proposed Solution

Split following the agent mixins pattern (#102):

  1. db/schedule_crud.py — Schedule CRUD (create, read, update, delete, list) ~300 lines
  2. db/schedule_executions.py — Execution record management (create, update status, get by ID) ~400 lines
  3. db/schedule_stats.py — Statistics and aggregation queries ~200 lines
  4. db/schedules.py — Facade class inheriting all mixins ~100 lines

Acceptance Criteria

  • Each mixin < 400 lines
  • ScheduleOperations API unchanged (facade inheritance)
  • All schedule/execution tests pass

Source

Refactor audit 2026-03-13

Activity

  1. added
    priority-p1
    type-refactor
    on Mar 14, 2026
  2. oleksandr-korin commented on May 29, 2026

    @oleksandr-korin
    Contributor

    Closing as superseded — file-split refactor tickets created en masse on 2026-03-14 from a one-shot complexity scan. The /code-health weekly automation now scores hotspots dynamically and creates better-targeted issues from current churn × complexity, so static "split N-line file" tickets are no longer the right unit of work. The underlying complexity signal will resurface organically if/when it matters. Reference: backlog lean review on 2026-05-28.

  3. added
    complexity-low
    theme-devex
    on Jun 3, 2026
  4. added a commit that references this issue on Jul 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    complexity-lowpriority-p1theme-devextype-refactor

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions