chore: remove expired v0.3.1 compatibility shims (#5106)
This commit is contained in:
@@ -96,22 +96,17 @@ def test_onboard_does_not_crash_with_legacy_memory_window(tmp_path, monkeypatch)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("field_name", ["maxMessages", "max_messages"])
|
||||
def test_load_config_warns_and_ignores_legacy_max_messages(tmp_path, field_name) -> None:
|
||||
def test_load_config_ignores_legacy_max_messages(tmp_path, field_name) -> None:
|
||||
config_path = tmp_path / "config.json"
|
||||
config_path.write_text(
|
||||
json.dumps({"agents": {"defaults": {field_name: 25, "maxTokens": 1234}}}),
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
with patch("nanobot.config.loader.logger.warning") as warning:
|
||||
config = load_config(config_path)
|
||||
config = load_config(config_path)
|
||||
|
||||
assert config.agents.defaults.max_tokens == 1234
|
||||
assert not hasattr(config.agents.defaults, "max_messages")
|
||||
warning.assert_called_once()
|
||||
message = warning.call_args.args[0]
|
||||
assert "legacy and ignored" in message
|
||||
assert "next version" in message
|
||||
|
||||
|
||||
def test_save_config_drops_legacy_max_messages(tmp_path) -> None:
|
||||
@@ -121,8 +116,7 @@ def test_save_config_drops_legacy_max_messages(tmp_path) -> None:
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
with patch("nanobot.config.loader.logger.warning"):
|
||||
config = load_config(config_path)
|
||||
config = load_config(config_path)
|
||||
save_config(config, config_path)
|
||||
saved = json.loads(config_path.read_text(encoding="utf-8"))
|
||||
|
||||
|
||||
@@ -52,3 +52,22 @@ def test_dream_config_uses_model_override_name_and_accepts_legacy_model() -> Non
|
||||
assert cfg.model_override == "openrouter/sonnet"
|
||||
assert dumped["modelOverride"] == "openrouter/sonnet"
|
||||
assert "model" not in dumped
|
||||
|
||||
|
||||
def test_dream_config_ignores_retired_noop_fields() -> None:
|
||||
cfg = DreamConfig.model_validate(
|
||||
{
|
||||
"maxBatchSize": 99,
|
||||
"maxIterations": 99,
|
||||
"annotateLineAges": False,
|
||||
}
|
||||
)
|
||||
|
||||
dumped = cfg.model_dump(by_alias=True)
|
||||
|
||||
assert not hasattr(cfg, "max_batch_size")
|
||||
assert not hasattr(cfg, "max_iterations")
|
||||
assert not hasattr(cfg, "annotate_line_ages")
|
||||
assert "maxBatchSize" not in dumped
|
||||
assert "maxIterations" not in dumped
|
||||
assert "annotateLineAges" not in dumped
|
||||
|
||||
Reference in New Issue
Block a user