refactor(ml): drop dead tagger/suggestion settings + columns (#1199)
CI / lint (push) Successful in 3s
CI / frontend-build (push) Successful in 18s
CI / backend-lint-and-test (push) Successful in 27s
CI / integration (push) Successful in 3m31s

Hygiene follow-up to the Camie retirement (#1189) — these were left inert to
bound that change; nothing reads them now. Migration 0068 drops:
- ml_settings: tagger_store_floor, tagger_model_version, suggestion_threshold_
  character/general (already dead pre-retirement — scoring uses per-head
  thresholds), video_min_tag_frames (only the deleted video-prediction
  aggregator used it).
- image_record: tagger_model_version (no writer), centroid_scores (dead JSON
  cache, no reader).

Also: ml_admin _EDITABLE/GET/_validate pruned (dropped the store-floor invariant
+ video_min_tag_frames check); MLThresholdSliders trimmed to a video-embedding
card (interval + max frames only); importer no longer resets the dropped cols;
download_models drops the Camie fetch; stale CASCADE comments in cleanup_service
no longer name the removed tables. Tests updated.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ttrj5P7upUTueSfoJcxEqa
This commit is contained in:
2026-06-30 13:41:25 -04:00
parent 3d97667f5b
commit bc6d43d3f2
11 changed files with 146 additions and 260 deletions
+11 -28
View File
@@ -1,6 +1,6 @@
"""download_models tests. No network in CI; we test the 'already present →
skip' short-circuit by faking the expected files, and that main() wires
both ensure_* calls.
skip' short-circuit by faking the expected files, and that main() wires the
SigLIP fetch. (Camie download retired with the tagger, #1199.)
"""
from unittest.mock import patch
@@ -8,29 +8,6 @@ from unittest.mock import patch
from backend.app.scripts import download_models as dm
def test_ensure_camie_skips_when_present(tmp_path, monkeypatch):
"""v2 layout (HF Camais03/camie-tagger-v2): the ONNX file is named
camie-tagger-v2.onnx (not model.onnx) and tags ship inside
camie-tagger-v2-metadata.json (not selected_tags.csv). Both at root.
Updated 2026-05-25 after the actual repo layout was confirmed via
WebFetch — the old assertion pinned the v1 filenames."""
monkeypatch.setattr(dm, "MODEL_ROOT", tmp_path)
camie = tmp_path / "camie"
camie.mkdir(parents=True)
(camie / "camie-tagger-v2.onnx").write_bytes(b"x")
(camie / "camie-tagger-v2-metadata.json").write_text("{}")
with patch.object(dm, "_snapshot") as snap:
dm.ensure_camie()
snap.assert_not_called()
def test_ensure_camie_downloads_when_missing(tmp_path, monkeypatch):
monkeypatch.setattr(dm, "MODEL_ROOT", tmp_path)
with patch.object(dm, "_snapshot") as snap:
dm.ensure_camie()
snap.assert_called_once()
def test_ensure_siglip_skips_when_present(tmp_path, monkeypatch):
monkeypatch.setattr(dm, "MODEL_ROOT", tmp_path)
sig = tmp_path / "siglip"
@@ -42,9 +19,15 @@ def test_ensure_siglip_skips_when_present(tmp_path, monkeypatch):
snap.assert_not_called()
def test_main_calls_both(monkeypatch):
def test_ensure_siglip_downloads_when_missing(tmp_path, monkeypatch):
monkeypatch.setattr(dm, "MODEL_ROOT", tmp_path)
with patch.object(dm, "_snapshot") as snap:
dm.ensure_siglip()
snap.assert_called_once()
def test_main_fetches_siglip(monkeypatch):
calls = []
monkeypatch.setattr(dm, "ensure_camie", lambda: calls.append("camie"))
monkeypatch.setattr(dm, "ensure_siglip", lambda: calls.append("siglip"))
assert dm.main() == 0
assert calls == ["camie", "siglip"]
assert calls == ["siglip"]