Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

Pin usearch for the document upload harness, and guard its CI-only RAG imports (#16284)

Daniel Hanb1b286c9b7fe
diff --git a/tests/studio/rag_upload_requirements.txt b/tests/studio/rag_upload_requirements.txt
index 695c0d0cab0..9272876ce88 100644
--- a/tests/studio/rag_upload_requirements.txt
+++ b/tests/studio/rag_upload_requirements.txt
@@ -53,6 +53,7 @@ tqdm==4.70.0
typing-extensions==4.16.0
typing-inspection==0.4.4
urllib3==2.8.0
+usearch==2.26.6
hypothesis==6.167.1
playwright==1.62.0
selenium==4.48.0
diff --git a/tests/studio/test_rag_upload_requirements_cover_ci_imports.py b/tests/studio/test_rag_upload_requirements_cover_ci_imports.py
new file mode 100644
index 00000000000..852f7f63fd3
--- /dev/null
+++ b/tests/studio/test_rag_upload_requirements_cover_ci_imports.py
@@ -0,0 +1,62 @@
+# SPDX-License-Identifier: AGPL-3.0-only
+# Copyright 2026-present the Unsloth AI Inc. team. All rights reserved.
+
+"""rag_upload_ci.py runs every studio/backend/tests/test_rag_*.py in a venv built only from
+rag_upload_requirements.txt. A RAG test that imports a module unconditionally under CI (treating a
+missing wheel as a packaging failure) needs that module pinned there, at studio.txt's version."""
+
+import ast
+import re
+from pathlib import Path
+
+ROOT = Path(__file__).resolve().parents[2]
+UPLOAD_REQS = ROOT / "tests/studio/rag_upload_requirements.txt"
+STUDIO_REQS = ROOT / "studio/backend/requirements/studio.txt"
+
+
+def _pins(path):
+ pins = {}
+ for line in path.read_text(encoding = "utf-8").splitlines():
+ m = re.match(r"^([A-Za-z0-9_.\-]+)==([^\s;#]+)", line.strip())
+ if m:
+ pins[re.sub(r"[-_.]+", "-", m.group(1)).lower()] = m.group(2)
+ return pins
+
+
+def _is_ci_check(node):
+ return any(isinstance(n, ast.Constant) and n.value == "CI" for n in ast.walk(node))
+
+
+def _ci_imports(path):
+ found = set()
+ for node in ast.walk(ast.parse(path.read_text(encoding = "utf-8"))):
+ if isinstance(node, ast.If) and _is_ci_check(node.test):
+ for stmt in node.body:
+ if isinstance(stmt, ast.Import):
+ found.update(alias.name.split(".")[0] for alias in stmt.names)
+ return found
+
+
+def _ci_imports_by_test():
+ tests = sorted((ROOT / "studio/backend/tests").glob("test_rag_*.py"))
+ return {t.name: _ci_imports(t) for t in tests}
+
+
+def test_the_scan_finds_the_hnsw_tier_imports():
+ # Control: the reader sees the CI-only import the ANN tests make today.
+ found = _ci_imports_by_test()
+ assert "usearch" in found.get("test_rag_vec_ann.py", set())
+
+
+def test_every_ci_only_rag_import_is_pinned_for_the_upload_harness():
+ upload, studio = _pins(UPLOAD_REQS), _pins(STUDIO_REQS)
+ missing, drifted = [], []
+ for test, modules in _ci_imports_by_test().items():
+ for module in sorted(modules):
+ name = re.sub(r"[-_.]+", "-", module).lower()
+ if name not in upload:
+ missing.append(f"{test}: {module}")
+ elif name in studio and studio[name] != upload[name]:
+ drifted.append(f"{module}: upload {upload[name]} vs studio.txt {studio[name]}")
+ assert not missing, f"not in {UPLOAD_REQS.name}: {missing}"
+ assert not drifted, f"pin differs from studio.txt: {drifted}"