From 5eeb43a1f739cbe34efa00ad346aa46a4b3c6d4d Mon Sep 17 00:00:00 2001 From: nesquena-hermes Date: Sat, 20 Jun 2026 19:33:57 +0000 Subject: [PATCH] test: update disk-cache round-trip assertions for reconstructed aliases Two existing tests asserted _load_models_cache_from_disk()/get_available_models() return EXACTLY the saved payload; the loaders now also return aliases reconstructed from config (empty {} when no config aliases). Update both assertions to expect the aliases field. Caught by the full suite + Codex re-gate. --- tests/test_issue1699_model_cache_source_fingerprint.py | 4 +++- tests/test_model_cache_metadata.py | 7 +++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/test_issue1699_model_cache_source_fingerprint.py b/tests/test_issue1699_model_cache_source_fingerprint.py index 0a06d3b8..c5a84cdd 100644 --- a/tests/test_issue1699_model_cache_source_fingerprint.py +++ b/tests/test_issue1699_model_cache_source_fingerprint.py @@ -141,7 +141,9 @@ def test_disk_models_cache_still_loads_when_auth_and_config_sources_are_unchange result = config.get_available_models() - assert result == fresh_opencode + # The disk-cache hit reconstructs `aliases` from current config (the save + # path doesn't persist aliases); no config aliases here, so it's {}. + assert result == {**fresh_opencode, "aliases": {}} def test_memory_models_cache_invalidates_when_static_catalog_changes(tmp_path, monkeypatch): diff --git a/tests/test_model_cache_metadata.py b/tests/test_model_cache_metadata.py index 271cf9d4..8881d51c 100644 --- a/tests/test_model_cache_metadata.py +++ b/tests/test_model_cache_metadata.py @@ -46,9 +46,12 @@ def test_save_models_cache_to_disk_preserves_response_metadata(tmp_path, monkeyp if "api.updates" in sys.modules: assert on_disk.get("_webui_version") == sys.modules["api.updates"].WEBUI_VERSION - # Load returns ONLY the response-shape fields (stamps stripped). + # Load returns the response-shape fields (stamps stripped) plus `aliases`, + # which the loader reconstructs from current config because the save path + # does not persist aliases on disk (keeps /model resolution working + # on a disk-cache hit). No config aliases here, so it reconstructs to {}. loaded = config._load_models_cache_from_disk() - assert loaded == payload + assert loaded == {**payload, "aliases": {}} def test_load_models_cache_from_disk_rejects_legacy_groups_only_cache(tmp_path, monkeypatch):