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.

Skip Unsloth's generated compile cache in the exec-literal lint (#12014)

Daniel Hanfc1e9041bdd7
diff --git a/scripts/lint_exec_literals.py b/scripts/lint_exec_literals.py
index b080e71c392..f284bb7a99c 100644
--- a/scripts/lint_exec_literals.py
+++ b/scripts/lint_exec_literals.py
@@ -61,6 +61,10 @@ EXCLUDED_PARTS = frozenset(
"__pycache__",
".ipynb_checkpoints",
".eggs",
+ # Unsloth writes its generated modules here in whatever directory it runs from, and the
+ # repo ignores it. A backend test run leaves one under studio/backend, and the gate then
+ # failed locally on code no commit contains.
+ "unsloth_compiled_cache",
}
)
diff --git a/tests/security/test_lint_exec_literals.py b/tests/security/test_lint_exec_literals.py
index 6907c02eafa..146b5c5d973 100644
--- a/tests/security/test_lint_exec_literals.py
+++ b/tests/security/test_lint_exec_literals.py
@@ -131,6 +131,20 @@ def test_a_magic_line_does_not_shift_the_reported_line_number(tmp_path):
assert [f["line"] for f in found] == [4], found
+def test_a_generated_compile_cache_is_not_scanned(tmp_path, monkeypatch):
+ # Unsloth regenerates unsloth_compiled_cache/ wherever it runs; it is gitignored, so a call in
+ # it is not in any commit and must not fail the gate on a machine that has run Unsloth.
+ module = _module()
+ monkeypatch.setattr(module, "REPO_ROOT", tmp_path)
+ source = "def f(s):\n exec(s)\n"
+ (tmp_path / "pkg" / "unsloth_compiled_cache").mkdir(parents = True)
+ (tmp_path / "pkg" / "unsloth_compiled_cache" / "moe_utils.py").write_text(
+ source, encoding = "utf-8"
+ )
+ (tmp_path / "pkg" / "real.py").write_text(source, encoding = "utf-8")
+ assert [f["file"] for f in module.collect(["pkg"])] == ["pkg/real.py"]
+
+
def test_the_baseline_matches_the_tree_it_was_recorded_against():
"""A stale entry silently re-permits whatever lands on that digest next."""
proc = subprocess.run(