Skip to content

Commit 6650b77

Browse files
fix: mark QueryFallbackChain public API methods with @code_is_used (#993)
The dead code detector flagged four methods as unused, but they are part of the intentional public API. These methods provide essential introspection capabilities for logging, debugging, and observability. - get_attempts(): Returns full attempt history for analysis - get_attempt_summary(): Provides human-readable summaries for logs - has_attempts(): Checks if chain has been executed - was_successful(): Checks if any strategy succeeded All four methods are extensively tested and documented in the class docstring. They were flagged only because runtime tracing doesn't exercise them in CLI paths, but they are used in tests and may be needed for future logging/debugging features. Co-authored-by: florath-ai-assistant[bot] <Andreas.Florath@telekom.de>
1 parent 3962cbd commit 6650b77

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/aletheia_probe/fallback_chain.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
from pydantic import BaseModel, Field
66

7+
from .utils.dead_code import code_is_used
8+
79

810
class FallbackStrategy(Enum):
911
"""Standard fallback strategies used across backends."""
@@ -91,10 +93,12 @@ def get_successful_strategy(self) -> FallbackStrategy | None:
9193
return attempt.strategy
9294
return None
9395

96+
@code_is_used # Part of public API, used in tests, needed for observability
9497
def get_attempts(self) -> list[FallbackAttempt]:
9598
"""Return all logged attempts."""
9699
return self.attempts.copy()
97100

101+
@code_is_used # Part of public API, used in tests, needed for logging/debugging
98102
def get_attempt_summary(self) -> str:
99103
"""Return human-readable summary of attempts.
100104
@@ -109,10 +113,12 @@ def get_attempt_summary(self) -> str:
109113
parts.append(f"{attempt.strategy.value}({status})")
110114
return " → ".join(parts) if parts else "no attempts"
111115

116+
@code_is_used # Part of public API, used in tests
112117
def has_attempts(self) -> bool:
113118
"""Check if any attempts were logged."""
114119
return len(self.attempts) > 0
115120

121+
@code_is_used # Part of public API, used in tests
116122
def was_successful(self) -> bool:
117123
"""Check if any attempt succeeded."""
118124
return self.get_successful_strategy() is not None

0 commit comments

Comments
 (0)