49 lines
1.5 KiB
Python
49 lines
1.5 KiB
Python
# SPDX-FileCopyrightText: 2026 Art Sea LLC
|
|
#
|
|
# SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
"""Construct trace-supported candidates before FileBlame judges ownership."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from abc import ABC, abstractmethod
|
|
from enum import Enum
|
|
|
|
from band_aider.context.class_meta import ClassMeta, ContentType
|
|
from band_aider.context.failing_test import FailingTest
|
|
from band_aider.judgement.file_manager import FileManager
|
|
|
|
|
|
class FailureCandidateScope(Enum):
|
|
"""Choose managed roles; ``BOTH`` preserves source and test evidence for routing."""
|
|
|
|
SOURCE = frozenset((ContentType.Source,))
|
|
TEST = frozenset((ContentType.Test,))
|
|
BOTH = frozenset((ContentType.Source, ContentType.Test))
|
|
|
|
|
|
class FailureSourceCandidateSelection(Enum):
|
|
"""Choose how failure evidence constructs the FileBlame candidate set.
|
|
|
|
Example: ``FailureSourceCandidateSelection.MECHANICAL`` requests exact trace matching
|
|
without exposing the registered handler to its caller.
|
|
"""
|
|
|
|
MECHANICAL = "mechanical"
|
|
PREDICTIVE = "predictive"
|
|
|
|
|
|
class FailureSourceCandidateSelectionStrategy(ABC):
|
|
"""Construct trace-supported managed candidates within the caller's explicit scope."""
|
|
|
|
@abstractmethod
|
|
def candidates_for_failure(
|
|
self,
|
|
*,
|
|
file_manager: FileManager,
|
|
failure: FailingTest,
|
|
scope: FailureCandidateScope,
|
|
) -> list[ClassMeta]:
|
|
"""Return current candidates in the requested source and/or test scope."""
|
|
|
|
...
|