One function

run_synthid_score in guillaumemeyer/watermarks-remover

The author described this change as fix: prefer checkout venv for SynthID scorer subprocess (#115) (#123). It counts as a record because the check below fails on the code as it stood at 00596a727 and passes on a43082782, with nothing else changed between the two runs.

Fix saved2026-08-17
Sharing licenceMIT · LICENSE
Change size+8 4

What the code was meant to do, written into the code itself as a docstring

Run the optional reverse-SynthID scorer. Uses the HTTP sidecar when WATERMARKS_SYNTHID_SCORER_URL is set, otherwise a subprocess against a local checkout. Returns None when the scorer is not configured or unavailable (exit 3), so callers can keep the default "no SynthID score" behavior.

The change

66
77 Uses the HTTP sidecar when WATERMARKS_SYNTHID_SCORER_URL is set,
88 otherwise a subprocess against a local checkout. Returns None when the
9- scorer is not configured or unavailable (exit 3), so callers can keep
10- the default "no SynthID score" behavior.
9+ scorer is not configured; a dict with "available": False and an "error"
10+ when it is configured but unavailable (e.g. exit 3), so callers can
11+ distinguish "not scored" from "scored and clean".
1112 """
1213 scorer_url = os.environ.get("WATERMARKS_SYNTHID_SCORER_URL", "").strip()
1314 if scorer_url:
2425
2526 script = SCRIPTS_DIR / "score_synthid.py"
2627 cmd = [
27- sys.executable,
28+ _synthid_python(Path(upstream_dir)),
2829 str(script),
2930 str(path),
3031 "--upstream-dir",
4445 return {"available": False, "error": str(e)}
4546
4647 if r.returncode == 3:
47- return None
48+ return {
49+ "available": False,
50+ "error": (r.stderr or "SynthID scorer unavailable (exit 3)").strip()[:2000],
51+ }
4852 if r.returncode != 0:
4953 return {"available": False, "error": (r.stderr or "").strip()[:2000]}
5054 try:

The check that tells the two apart

failpass·tests/test_synthid_score.py::test_run_synthid_score_unavailable_returns_error

Check file tests/test_synthid_score.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.

Origin and history

The code before it00596a7270cc12740fd7639787c9d9ee051f5a2f
Broken version dated2026-08-17
Moduleservice.scripts.image_meta
Units changedrun_synthid_score
Fingerprint8bbd644d1877b435
Checked2026-08-17 by goldset/0.1

Every field above is generated by our program. None of it is written by hand.

Other bugs found in guillaumemeyer/watermarks-remover