Coverage for lintro / ai / config_views.py: 100%
49 statements
« prev ^ index » next coverage.py v7.13.0, created at 2026-04-03 18:53 +0000
« prev ^ index » next coverage.py v7.13.0, created at 2026-04-03 18:53 +0000
1"""Read-only grouped views of AI configuration settings.
3These frozen dataclasses provide structured access to logically related
4subsets of :class:`~lintro.ai.config.AIConfig` fields. They are returned
5by the ``provider_config``, ``budget_config``, and ``output_config``
6properties on ``AIConfig``.
7"""
9from __future__ import annotations
11from dataclasses import dataclass
13from lintro.ai.enums import ConfidenceLevel, SanitizeMode
14from lintro.ai.registry import AIProvider
17@dataclass(frozen=True)
18class AIProviderConfig:
19 """Read-only view of provider-related AI settings."""
21 provider: AIProvider
22 model: str | None
23 api_key_env: str | None
24 api_base_url: str | None
25 api_region: str | None
26 fallback_models: tuple[str, ...]
27 max_tokens: int
28 max_retries: int
29 api_timeout: float
30 retry_base_delay: float
31 retry_max_delay: float
32 retry_backoff_factor: float
35@dataclass(frozen=True)
36class AIBudgetConfig:
37 """Read-only view of budget and limit settings."""
39 max_fix_attempts: int
40 max_parallel_calls: int
41 max_cost_usd: float | None
42 max_prompt_tokens: int
43 max_refinement_attempts: int
44 enable_cache: bool
45 cache_ttl: int
46 cache_max_entries: int
47 context_lines: int
48 fix_search_radius: int
51@dataclass(frozen=True)
52class AIOutputConfig:
53 """Read-only view of output and display settings."""
55 show_cost_estimate: bool
56 verbose: bool
57 stream: bool
58 dry_run: bool
59 github_pr_comments: bool
60 validate_after_group: bool
61 auto_apply: bool
62 auto_apply_safe_fixes: bool
63 default_fix: bool
64 fail_on_ai_error: bool
65 fail_on_unfixed: bool
66 min_confidence: ConfidenceLevel
67 sanitize_mode: SanitizeMode
68 include_paths: tuple[str, ...]
69 exclude_paths: tuple[str, ...]
70 include_rules: tuple[str, ...]
71 exclude_rules: tuple[str, ...]