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
| 6 | 6 | ||
| 7 | 7 | Uses the HTTP sidecar when WATERMARKS_SYNTHID_SCORER_URL is set, | |
| 8 | 8 | 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". | |
| 11 | 12 | """ | |
| 12 | 13 | scorer_url = os.environ.get("WATERMARKS_SYNTHID_SCORER_URL", "").strip() | |
| 13 | 14 | if scorer_url: | |
| ⋯ | |||
| 24 | 25 | ||
| 25 | 26 | script = SCRIPTS_DIR / "score_synthid.py" | |
| 26 | 27 | cmd = [ | |
| 27 | - | sys.executable, | |
| 28 | + | _synthid_python(Path(upstream_dir)), | |
| 28 | 29 | str(script), | |
| 29 | 30 | str(path), | |
| 30 | 31 | "--upstream-dir", | |
| ⋯ | |||
| 44 | 45 | return {"available": False, "error": str(e)} | |
| 45 | 46 | ||
| 46 | 47 | 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 | + | } | |
| 48 | 52 | if r.returncode != 0: | |
| 49 | 53 | return {"available": False, "error": (r.stderr or "").strip()[:2000]} | |
| 50 | 54 | try: | |
The check that tells the two apart
fail→pass·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
- 2026-08-17fix: validate clean option types (#111)
- 2026-08-15fix: macOS portability — pure --json stdout for the SynthID scorer, BSD realpath probe (#70)
- 2026-08-14fix: preserve mixed-case CMS generator meta tags (#42)
- 2026-08-13safe_write_bytes
- 2026-08-12fix: c2patool "No claim found" reported as a C2PA manifest (#3)