From 15df91c0a0bb15e56e719440c618015f23044821 Mon Sep 17 00:00:00 2001 From: adlee-was-taken Date: Sun, 6 Sep 2026 19:25:48 -0400 Subject: [PATCH] fix(admin): hide deprecated/stale models on the Models page by default GET /admin/api/models returns every row regardless of availability, and models.html rendered all of them unconditionally -- so pruning OpenRouter's catalog to a 30-model allowlist (#45) still left ~395 deprecated rows cluttering the page. Add a "Show deprecated / stale" toggle, off by default, so the page reflects what's actually routable without losing the ability to review or reactivate a deprecated row. Also removed a leftover manual override forcing meta/muse-spark-1.1 (a non-chat OpenRouter model, same category as the lyria models #42 was written for) to active from an earlier debugging session -- exactly the admin-override-bypasses-the-allowlist edge case flagged as a known limitation during #45's review. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_01VRQXz5SYZYVWscxS1QqF6U --- admin/frontend/models.html | 17 ++++++++++++++++- tests/test_admin_frontend.py | 13 +++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/admin/frontend/models.html b/admin/frontend/models.html index b7df065..f6bebb1 100644 --- a/admin/frontend/models.html +++ b/admin/frontend/models.html @@ -193,6 +193,10 @@ header.navbar{padding-top:2px!important;padding-bottom:2px!important}

Model Availability

Change the override dropdown to mark a model active, deprecated, or stale
+
+ + +
@@ -302,13 +306,24 @@ function connectSSE() { MODEL AVAILABILITY TABLE ═══════════════════════════════════════ */ +let _modelsCache = []; + function renderModels(models) { + _modelsCache = models || []; const tbody = document.getElementById('model-tbody'); if (!models || !models.length) { tbody.innerHTML = ''; return; } - const html = models.filter(m => (m.access_level === 'public') || !m.access_level).map(m => { + const toggleEl = document.getElementById('show-deprecated-toggle'); + const showDeprecated = toggleEl ? toggleEl.checked : false; + const visible = models.filter(m => (m.access_level === 'public') || !m.access_level) + .filter(m => showDeprecated || (m.effective_availability !== 'deprecated' && m.effective_availability !== 'stale')); + if (!visible.length) { + tbody.innerHTML = ''; + return; + } + const html = visible.map(m => { const availClass = { active: 'var(--tblr-success)', deprecated: 'var(--tblr-danger)', stale: 'var(--tblr-warning)' }[m.effective_availability] || 'var(--tblr-secondary)'; const selectOpts = ['active','deprecated','stale'].map(a => `` diff --git a/tests/test_admin_frontend.py b/tests/test_admin_frontend.py index cce40c8..7e434af 100644 --- a/tests/test_admin_frontend.py +++ b/tests/test_admin_frontend.py @@ -142,6 +142,19 @@ def test_admin_models_returns_html_with_availability_marker(admin_client): assert "Model Availability" in resp.text +def test_admin_models_hides_deprecated_by_default_with_a_toggle_to_show_them(admin_client): + """The models page defaults to hiding deprecated/stale rows (e.g. after + the OpenRouter allowlist prunes 425 down to 30) behind a toggle, rather + than always rendering every row regardless of availability.""" + resp = admin_client.get("/admin/models") + text = resp.text + assert 'id="show-deprecated-toggle"' in text + # Default unchecked: renderModels must read the toggle's checked state + # and exclude deprecated/stale unless it's on. + assert "effective_availability !== 'deprecated'" in text + assert "effective_availability !== 'stale'" in text + + def test_admin_profiles_returns_html_with_profiles_marker(admin_client): """GET /admin/profiles returns 200, text/html, and contains the Chart.js tag and the Profiles page marker.""" -- 2.49.1
No models
No models match the current filter