mekosotto Claude Opus 4.7 (1M context) commited on
Commit
1e071e5
·
1 Parent(s): 3060b75

test(deploy): scan ENV lines only in MLflow kill-switch guard (avoid comment false-positive)

Browse files
Files changed (1) hide show
  1. tests/deploy/test_dockerfile_hf.py +25 -10
tests/deploy/test_dockerfile_hf.py CHANGED
@@ -62,14 +62,29 @@ class TestDockerfileHF:
62
  )
63
 
64
  def test_dockerfile_does_not_disable_mlflow(self, dockerfile_text):
65
- """The kill-switch was removed in 2026-04-30 file-store mlruns/
66
- is built into the image and is safe to expose on the read-only
67
- demo. Re-introducing the kill-switch would silently kill the
68
- Experiments tab and the BBB provenance strip."""
69
- text = dockerfile_text.lower()
70
- assert "neurobridge_disable_mlflow=1" not in text, (
71
- "Dockerfile must NOT disable MLflow that empties the "
72
- "Experiments tab and blanks the BBB provenance strip. "
73
- "If you need to disable MLflow at runtime, set the env "
74
- "manually on the Space, do not bake it into the image."
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
75
  )
 
62
  )
63
 
64
  def test_dockerfile_does_not_disable_mlflow(self, dockerfile_text):
65
+ """The MLflow kill-switch must be absent from the Dockerfile
66
+ file-store mlruns/ is built into the image and is safe to expose
67
+ on the read-only demo. Re-introducing the kill-switch would
68
+ silently kill the Experiments tab and the BBB provenance strip.
69
+
70
+ Scan ENV lines only, not comment lines, so a future docstring or
71
+ comment that cites the env name does not false-positive.
72
+ """
73
+ import re
74
+
75
+ env_lines = [
76
+ line
77
+ for line in dockerfile_text.splitlines()
78
+ if re.match(
79
+ r"\s*(ENV\s+)?NEUROBRIDGE_DISABLE_MLFLOW\s*=\s*1",
80
+ line,
81
+ re.IGNORECASE,
82
+ )
83
+ ]
84
+ assert not env_lines, (
85
+ "Dockerfile must NOT set NEUROBRIDGE_DISABLE_MLFLOW=1 — that "
86
+ "empties the Experiments tab and blanks the BBB provenance "
87
+ "strip. If you need to disable MLflow at runtime, set the env "
88
+ "manually on the Space, do not bake it into the image. "
89
+ f"Offending lines: {env_lines}"
90
  )