Skip to content

refactor(task): move TaskService's reads into five mixins - #1268

Merged
rennf93 merged 1 commit into
slavefrom
chore/claude/split-task-queries
Nov 1, 2026
Merged

rennf93 merged 1 commit into
slavefrom
chore/claude/split-task-queries

Conversation

@rennf93

@rennf93 rennf93 commented Oct 31, 2026 •

Copy link
Copy Markdown
Owner

Follow-up to trail #51 (change 119): wave 3 of the god-class plan starts on TaskService, the largest class left (379 methods). This first part moves its read side into five mixins, every method body byte-identical.

Why

The conventions check flags 39 classes over its 15-method limit. Trail #51's plan splits them by responsibility, one family per PR, then makes god_class blocking. Wave 3 is the core services, TaskService first, in several parts. This part takes the reads, which nothing else depends on in order.

What changed

  • Five mixins in roboco/services/task.py, above TaskService:

    Mixin Methods Holds
    TaskListQueries 14 listings by project, team, assignee and status; search; recency; archive candidates; FIFO order
    TaskQueueQueries 11 the review and escalation queues, and the Board's strategic list
    TaskStatistics 6 counts, 30-day delivery statistics, project and task spend
    TaskAgentQueries 8 one agent's tasks, and the held task blocking its next claim
    TaskRoleLookup 11 the agent holding a role, by team or slug; resolve_agent_id
  • Why in task.py: tests patch module-level names there (get_event_bus, extract_original_developer, main_pm_cannot_own_code, and others). Moved bodies keep resolving those names in the same module, so every patch still reaches them. ContentActions and BaseChoreographer were split the same way in wave 2.

  • TaskService keeps 329 methods. Its bases are BaseService first, then the mixins alphabetically. BaseService comes first so mypy finds its session and log before the declarations of them in TaskServiceSelf. It defines only service_name and __init__, which TaskService overrides, so nothing resolves differently at runtime.

  • New roboco/services/_task_service_types.py: TaskServiceSelf, each mixin's TYPE_CHECKING-only base.

    • It declares the members the mixins reach across classes through self: two of TaskListQueries's and six of TaskService's.
    • It also declares BaseService's and TaskService's instance attributes.
    • Each stub copies the real method's decorators, parameters and return type, with defaults written as ....
  • New tests/unit/services/test_task_service_mixins.py:

    • fails if two mixins define the same member;
    • fails if TaskService redefines a mixin's member;
    • fails if a surface declares a member its class doesn't define. I checked it fails on a stray stub.
  • Map: the slice gets the new file, a row per mixin and a dated note. Seventy-six line citations follow the move. Ten prose citations of a line inside a method keep their offset in it. One of them pointed into _bump_coordination_ceo_reject while naming ceo_reject; it still points at the same statement.

Verification

  • A pure move: every one of TaskService's 379 methods at slave appears exactly once across TaskService and the five mixins, with an identical source segment, and nothing else was added. I checked this with an AST comparison of the class at b22282de against this branch.
  • Static checks: clean: ruff format and check, mypy roboco/ tests/ (1,797 files), vulture, xenon, import-linter. The codebase map is 0 errors and 0 warnings, with the concat in sync and reflow clean. Conventions has one finding in the touched files, TaskService's own god_class, which the later parts close.
  • Tests: run serially as CI runs them: full suite 19,496 passed, 560 skipped, 0 warnings, coverage 91.22%; e2e smoke 76 passed, 6 skipped, 0 warnings.

🤖 Generated with Claude Code

Wave 3 of the god-class plan (trail #51) starts on TaskService, 379
methods. Its read side moves, every method body byte-identical, into
five mixins in task.py, above the class:

- TaskListQueries (14): listings by project, team, assignee and
  status, search, recency, archive candidates, FIFO order;
- TaskQueueQueries (11): the review and escalation queues and the
  Board's strategic list;
- TaskStatistics (6): counts, delivery statistics, spend;
- TaskAgentQueries (8): one agent's tasks and the held task blocking
  its next claim;
- TaskRoleLookup (11): the agent holding a role, by team or slug.

They stay in task.py so the module-level names tests patch there keep
reaching the code that uses them. TaskService keeps 329 methods; its
bases are BaseService first, so mypy finds `session` and `log` before
TaskServiceSelf's declarations of them, then the mixins alphabetically.

roboco/services/_task_service_types.py holds TaskServiceSelf, each
mixin's TYPE_CHECKING-only base: one surface per class whose members
the mixins reach through `self`, with each method's own signature, plus
the instance attributes. tests/unit/services/test_task_service_mixins.py
fails on a member defined twice and on a stub its class doesn't define.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot added documentation Docs, README, CHANGELOG, governance files area: services Touches roboco/services/ (business logic, side effects) tests Test suite changes labels Oct 31, 2026
@rennf93 rennf93 changed the title chore/claude/split-task-queries refactor(task): move TaskService's reads into five mixins Oct 31, 2026
@rennf93
rennf93 marked this pull request as ready for review October 31, 2026 20:48
@github-actions

Copy link
Copy Markdown

Thanks for opening your first pull request on RoboCo!

Quick checklist before review (most of these are enforced by CI, but worth a glance):

  • make quality — ruff format check, ruff check, mypy, pytest (≥80% coverage), and the rest of the gate
  • Panel changes pass pnpm lint and pnpm exec tsc --noEmit (run from panel/)
  • No # noqa / # type: ignore shortcuts; pre-existing violations in touched files are fixed
  • Added an entry under ## [Unreleased] in CHANGELOG.md
  • Signed the CLA (the bot will prompt you on this PR)
  • Signed your commits — master requires verified signatures (SSH signing setup)
  • Updated any affected docs under docs/

See CONTRIBUTING.md for the full workflow and the Code of Conduct for the community standards we follow.

Welcome aboard — a maintainer will review shortly.

This was referenced Oct 31, 2026
@rennf93
rennf93 merged commit 6da8f44 into slave Nov 1, 2026
16 of 19 checks passed
@github-project-automation github-project-automation Bot moved this from Backlog to Done in RoboCo Kanban Nov 1, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 1, 2026
@rennf93
rennf93 deleted the chore/claude/split-task-queries branch November 1, 2026 01:51
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area: services Touches roboco/services/ (business logic, side effects) documentation Docs, README, CHANGELOG, governance files tests Test suite changes

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant