Skip to content

refactor(roles): decompose reviewer's 606-line function #640

Description

@xsovad06

Objective

Break down _build_review_comments (606 lines) into independently testable subfunctions, making the reviewer module safer to modify.

Findings

[P2] 606-line function: _build_review_comments

  • Location: sova/roles/reviewer.py:417
  • Issue: Single function handling inline comment mapping, body-only fallback, diff line validation, and formatting. Hardest function to modify safely in the entire codebase.
  • Recommendation: Extract into _map_findings_to_diff_lines(), _partition_inline_vs_body(), _format_inline_comments(), _format_body_fallback(). Each independently testable.

[P2] reviewer.py is a 1022-line god file

  • Location: sova/roles/reviewer.py
  • Issue: Module handles review execution, comment building, posting, handoff, and memory extraction. Multiple responsibilities.
  • Recommendation: Extract _build_review_comments and helpers into sova/roles/_review_comments.py. Keep orchestration in reviewer.py.

Files to Modify

  • sova/roles/reviewer.py
  • sova/roles/_review_comments.py (new)

Estimated Effort

6 hours

Dependencies

None


Source: docs/HEALTH-AUDIT.md -- Health Audit 2026-08-12

Triage Assessment

Title: refactor(roles): decompose reviewer's 606-line function
Has description: yes
Suitability: ready
Confidence: 85%
Complexity: complex
Missing context: none
Labels: type: task, area: agent

Issue has structured sections indicating clear scope; ready for research.

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent:readyReady for autonomous developmentagent:triagedIssue triaged by SOVA agentarea: agentAgent core and rolestype: taskImplementation task

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions