mirror of
https://github.com/katanemo/plano.git
synced 2026-07-02 15:51:02 +02:00
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:
parent
4206522ad9
commit
7e99368c1d
2 changed files with 30 additions and 9 deletions
|
|
@ -70,10 +70,16 @@ def migrate_inline_routing_preferences(config_yaml):
|
|||
errored, so existing v0.3.0 configs keep compiling. Any top-level
|
||||
preference already defined by the user is preserved as-is.
|
||||
|
||||
Also bumps ``version`` to ``v0.4.0`` when migration produced any entry,
|
||||
so brightstaff's v0.4.0 gate for top-level ``routing_preferences``
|
||||
accepts the rendered config.
|
||||
Also bumps ``version`` to ``v0.4.0`` up front (when the config is
|
||||
``v0.3.0`` or older) so brightstaff's v0.4.0 gate for top-level
|
||||
``routing_preferences`` accepts the rendered config, including configs
|
||||
that already declare top-level ``routing_preferences`` on a v0.3.0
|
||||
version string.
|
||||
"""
|
||||
current_version = str(config_yaml.get("version", ""))
|
||||
if _version_tuple(current_version) < (0, 4, 0):
|
||||
config_yaml["version"] = "v0.4.0"
|
||||
|
||||
model_providers = config_yaml.get("model_providers") or []
|
||||
if not model_providers:
|
||||
return
|
||||
|
|
@ -129,10 +135,6 @@ def migrate_inline_routing_preferences(config_yaml):
|
|||
merged.append(entry)
|
||||
config_yaml["routing_preferences"] = merged
|
||||
|
||||
current_version = str(config_yaml.get("version", ""))
|
||||
if _version_tuple(current_version) < (0, 4, 0):
|
||||
config_yaml["version"] = "v0.4.0"
|
||||
|
||||
print(
|
||||
"WARNING: inline routing_preferences under model_providers is deprecated "
|
||||
"and has been auto-migrated to top-level routing_preferences. Update your "
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue