Make all fail loudly when the gpu extra is missing

Step 2 (invisible/SynthID) was skipped with a quiet inline warning and the
run still exited 0, so a missing [gpu] extra was mistaken for a clean result
(recurring #14/#47). Add a prominent end-of-run banner and a non-zero exit.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Victor Kuznetsov
2026-06-11 09:58:49 -07:00
co-authored by Claude Fable 5
parent ad7e4ee08b
commit a8e218acf6
4 changed files with 45 additions and 2 deletions
+13
View File
@@ -389,6 +389,19 @@ class TestAllCommand:
assert result.exit_code == 0, result.output
mock_best.assert_called() # the registry auto-detector drove the visible pass
def test_all_loud_warning_and_nonzero_exit_when_gpu_missing(self, runner, sample_png, tmp_path):
"""Regression (#14/#47): when the GPU extra is absent the invisible step is
skipped, but the output still looks processed -- the run must fail loudly
(prominent banner + non-zero exit) so a skipped SynthID pass is not mistaken
for a clean result. The output file is still written (visible + metadata)."""
output = tmp_path / "clean.png"
with patch("remove_ai_watermarks.invisible_engine.is_available", return_value=False):
result = runner.invoke(main, ["all", str(sample_png), "-o", str(output)])
assert result.exit_code != 0, result.output
assert "NOT removed" in result.output
assert "remove-ai-watermarks[gpu]" in result.output
assert output.exists() # visible + metadata still produced a file
def test_all_preserves_rgba_across_invisible_step(self, runner, tmp_path):
"""Regression: ``all`` must keep transparency even when the invisible
step writes a 3-channel result (as the real diffusion engine does).