From 0269eca7e110f4a05cf47c29c0f79029b20b31d7 Mon Sep 17 00:00:00 2001 From: Teknium <127238744+teknium1@users.noreply.github.com> Date: Mon, 1 Jun 2026 23:35:23 -0700 Subject: [PATCH] test(minimax): assert M3 stale-cache guard contract, not a brittle 1M literal (#37220) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit test_stale_m3_cache_dropped_and_reresolves_to_1m hardcoded assert ctx == 1_000_000. The test re-resolves M3 through the live models.dev registry (the seeded stale entry is dropped, so nothing short-circuits the lookup), and models.dev now reports MiniMax-M3 at 512,000 — a change-detector failure unrelated to any code change. The guard's actual contract is: a stale <=204,800 catch-all value for an M3 slug must be DROPPED and re-resolved to M3's real (large) context. Both sources satisfy that (hardcoded catalog 1,000,000; models.dev 512,000), so assert the invariant (ctx > 204,800, stale value gone) instead of a literal that external data can move. Renamed accordingly. 47/47 in test_minimax_provider.py pass. --- tests/agent/test_minimax_provider.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/agent/test_minimax_provider.py b/tests/agent/test_minimax_provider.py index f9444c471..73e8034dd 100644 --- a/tests/agent/test_minimax_provider.py +++ b/tests/agent/test_minimax_provider.py @@ -46,7 +46,7 @@ class TestMinimaxM3StaleCacheGuard: assert not _model_name_suggests_minimax_m3("MiniMax-M2.7") assert not _model_name_suggests_minimax_m3("MiniMax-M2.5") - def test_stale_m3_cache_dropped_and_reresolves_to_1m(self, tmp_path, monkeypatch): + def test_stale_m3_cache_dropped_and_reresolves(self, tmp_path, monkeypatch): monkeypatch.setenv("HERMES_HOME", str(tmp_path)) import importlib import agent.model_metadata as mm @@ -56,7 +56,13 @@ class TestMinimaxM3StaleCacheGuard: ctx = mm.get_model_context_length( "MiniMax-M3", base_url=base, api_key="", provider="minimax-cn" ) - assert ctx == 1_000_000 + # Invariant: the stale 204,800 catch-all value must be DROPPED and + # re-resolved to M3's real, larger context. The exact value depends on + # the resolution source (hardcoded catalog = 1,000,000; the models.dev + # registry currently reports 512,000) — both are large-context values + # well above the generic "minimax" catch-all. Assert the contract + # ("> 204,800, stale value gone"), not a brittle literal. + assert ctx > 204_800, f"stale M3 cache not dropped/re-resolved, got {ctx}" def test_correct_m3_cache_preserved(self, tmp_path, monkeypatch): monkeypatch.setenv("HERMES_HOME", str(tmp_path))