Skip to content

The agent that grows with you

test(config): tie LEGACY_KEY_STEPS to the migration ladder

kshitijk4poor19bd20fcb6b5
diff --git a/hermes_cli/config_migrations.py b/hermes_cli/config_migrations.py
index 41766a71d8f..94e94b80426 100644
--- a/hermes_cli/config_migrations.py
+++ b/hermes_cli/config_migrations.py
@@ -636,7 +636,8 @@ def _migrate_to_46(results: Dict[str, Any], quiet: bool) -> None:
#: earlier steps' writes via read_raw_config() (filesystem state). v12 is the support floor:
#: configs already AT v12 still get every step below; only configs BELOW 12 are refused by the
#: floor gate in run_migrations()'s caller. Versions absent here (15, 18-20, 22, 24, 26-28, 30)
-#: only added a schema default that runtime merging supplies without a write.
+#: only added a schema default that runtime merging supplies without a write. When adding a step,
+#: decide whether it belongs in LEGACY_KEY_STEPS below (the only steps an unversioned file gets).
MIGRATIONS: Tuple[Tuple[int, Callable[[Dict[str, Any], bool], None]], ...] = (
(12, _migrate_to_12),
(13, _migrate_to_13),
diff --git a/tests/hermes_cli/test_config.py b/tests/hermes_cli/test_config.py
index 601bb58296b..6df65637463 100644
--- a/tests/hermes_cli/test_config.py
+++ b/tests/hermes_cli/test_config.py
@@ -858,6 +858,7 @@ class TestConfigSupportFloor:
def test_registry_has_no_targets_below_floor(self):
from hermes_cli.config_migrations import (
+ LEGACY_KEY_STEPS,
MIGRATIONS,
SUPPORT_FLOOR_VERSION,
)
@@ -867,6 +868,9 @@ class TestConfigSupportFloor:
# v12's own step is retained: a config AT v11 is refused, but a
# config AT v12 must still receive every remaining migration.
assert MIGRATIONS[0][0] == 12
+ # The unversioned allowlist is a parallel registry of ints: every entry must name a
+ # step that exists on the ladder, or an unversioned config silently drifts.
+ assert LEGACY_KEY_STEPS <= {target for target, _ in MIGRATIONS}
# ── Parity fixtures ──────────────────────────────────────────────
# Expected outputs captured by running migrate_config from origin/main