fix(config_generator): bump version to v0.4.0 up front in migration

Move the v0.3.0 -> v0.4.0 version bump to the top of
migrate_inline_routing_preferences so it runs unconditionally,
including for configs that already declare top-level
routing_preferences at v0.3.0. Previously the bump only fired
when inline migration produced entries, leaving top-level v0.3.0
configs rejected by brightstaff's v0.4.0 gate. Tests updated to
cover the new behavior and to confirm we never downgrade newer
versions.
This commit is contained in:
Spherrrical 2026-04-24 11:44:44 -07:00
parent 4206522ad9
commit 7e99368c1d
2 changed files with 30 additions and 9 deletions

View file

@ -672,7 +672,7 @@ model_providers:
assert "wildcard" in str(excinfo.value).lower()
def test_migration_noop_when_no_inline_preferences():
def test_migration_bumps_version_even_without_inline_preferences():
plano_config = """
version: v0.3.0
@ -689,4 +689,23 @@ model_providers:
migrate_inline_routing_preferences(config_yaml)
assert "routing_preferences" not in config_yaml
assert config_yaml["version"] == "v0.3.0"
assert config_yaml["version"] == "v0.4.0"
def test_migration_does_not_downgrade_newer_versions():
plano_config = """
version: v0.5.0
listeners:
- type: model
name: model_listener
port: 12000
model_providers:
- model: openai/gpt-4o
access_key: $OPENAI_API_KEY
"""
config_yaml = yaml.safe_load(plano_config)
migrate_inline_routing_preferences(config_yaml)
assert config_yaml["version"] == "v0.5.0"