fix: add test

This commit is contained in:
Rajat Ahuja 2026-05-06 15:27:15 -04:00
parent 5cde2236e1
commit 232e0dcec9
1 changed files with 31 additions and 0 deletions

View File

@ -515,3 +515,34 @@ def test_dialectic_level_transport_override_drops_default_thinking_params(
assert minimal_mc["model"] == "gpt-4.1-mini"
assert "thinking_budget_tokens" not in minimal_mc
assert "thinking_effort" not in minimal_mc
def test_dialectic_settings_backfills_missing_levels() -> None:
"""Operators only need to override the levels they care about.
Env-var overrides replace the LEVELS dict wholesale (bypassing the
default_factory), so without a backfill the unmentioned levels would be
dropped and _validate_all_levels_present would fail.
"""
from src.config import DialecticSettings
settings = DialecticSettings(
LEVELS={ # pyright: ignore[reportArgumentType]
"low": {
"MODEL_CONFIG": {
"transport": "anthropic",
"model": "claude-haiku-4-5-20251001",
"thinking_budget_tokens": 1024,
},
"MAX_OUTPUT_TOKENS": 2500,
}
}
)
assert set(settings.LEVELS.keys()) == {"minimal", "low", "medium", "high", "max"}
assert settings.LEVELS["low"].MODEL_CONFIG.transport == "anthropic"
assert settings.LEVELS["low"].MODEL_CONFIG.model == "claude-haiku-4-5-20251001"
assert settings.LEVELS["low"].MAX_OUTPUT_TOKENS == 2500
# Backfilled levels come from _default_dialectic_levels()
assert settings.LEVELS["minimal"].MAX_TOOL_ITERATIONS == 1
assert settings.LEVELS["max"].MAX_TOOL_ITERATIONS == 10