orchestrata_ultimate.verification.review.issue_triage

Reference › orchestrata_ultimate › verification › review › issue_triage

Orders and caps review issues so that a reader sees the serious ones first. prioritize_issues(issues, max_issues=5) sorts issue strings with _priority_key, which looks for a bracketed tag such as [SYNTAX]: critical tags (FILE_COMPLETE, SYNTAX, LINT, IMPORTS) sort first, untagged issues in the middle, and cosmetic tags (LINE_LENGTH, DOCSTRING, TODO) last. It then keeps the first max_issues. It has no internal imports and is re-exported by the review package; the issues it sorts are produced by the review engine.

At a glance

Source src/orchestrata_ultimate/verification/review/issue_triage.py
Lines of code 50
Classes 0
Functions 2
Imports (internal) none
Imported by orchestrata_ultimate.verification.review
Tests that import it tests/verification/review/test_issue_triage.py, tests/verification/test_issue_triage.py

Class diagram

No classes; see Functions.

Dependency diagram

Dependency diagram orchestrata_ultimate.verification.review.issue_triage

API

Functions

Function Signature Summary
_priority_key _priority_key(issue_str: str) -> int Compute sort priority for an issue string.
prioritize_issues prioritize_issues(issues: list[str], max_issues: int = 5) -> list[str] Sort issues by severity and cap to max_issues.

Source

Permalink: https://gitlab.com/MSamy/orchestrata-ultimate-architecture/-/blob/a4cbc2bdf/src/orchestrata_ultimate/verification/review/issue_triage.py

"""Issue triage: sort and cap review issues by severity.

Separates critical issues (syntax, imports, file completeness)
from cosmetic ones (line length, docstrings, TODOs) so fix cycles
address the most impactful problems first.

Spec: 007 - Verification Agent
"""

_CRITICAL_TAGS = ("FILE_COMPLETE", "SYNTAX", "LINT", "IMPORTS")
_COSMETIC_TAGS = ("LINE_LENGTH", "DOCSTRING", "TODO")


def _priority_key(issue_str: str) -> int:
    """Compute sort priority for an issue string.

    Args:
        issue_str: Issue string, may contain [TAG] prefix.

    Returns:
        Integer priority (lower = higher priority).
    """
    for i, tag in enumerate(_CRITICAL_TAGS):
        if f"[{tag}]" in issue_str:
            return i
    for i, tag in enumerate(_COSMETIC_TAGS):
        if f"[{tag}]" in issue_str:
            return len(_CRITICAL_TAGS) + i
    return len(_CRITICAL_TAGS)


def prioritize_issues(
    issues: list[str],
    max_issues: int = 5,
) -> list[str]:
    """Sort issues by severity and cap to max_issues.

    Critical issues (FILE_COMPLETE, SYNTAX, LINT, IMPORTS) sort
    first, cosmetic issues (LINE_LENGTH, DOCSTRING, TODO) sort
    last. Untagged issues get middle priority.

    Args:
        issues: Raw issue strings from QA review.
        max_issues: Maximum number of issues to return.

    Returns:
        Sorted and capped list of issue strings.
    """
    sorted_issues = sorted(issues, key=_priority_key)
    return sorted_issues[:max_issues]