fix(python): fingerprint_preset=False no longer turns presets on

launch_options checked `fingerprint_preset is not None`, so passing False
drew a random bundled preset, the opposite of what was asked. It now uses a
truthiness check, and a test proves that None and False never draw a preset.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Jake Writer
2026-09-25 15:22:28 -06:00
co-authored by Claude Opus 5.5
parent b26381c15e
commit 99e2b0c363
2 changed files with 9 additions and 1 deletions
+1 -1
View File
@@ -1038,7 +1038,7 @@ def launch_options(
# User passed a custom fingerprint
if not i_know_what_im_doing:
check_custom_fingerprint(fingerprint)
elif fingerprint_preset is not None:
elif fingerprint_preset:
# User opted into real fingerprint presets
if isinstance(fingerprint_preset, dict):
preset = fingerprint_preset
+8
View File
@@ -162,3 +162,11 @@ class TestPrefsEnvIsAscii:
joined = "".join(env[f"CAMOU_PREFS_{i}"] for i in range(1, len(env) + 1))
assert joined.isascii()
assert orjson.loads(joined) == prefs
@pytest.mark.parametrize("off", [None, False])
def test_fingerprint_preset_off_never_draws_a_preset(off):
"""`fingerprint_preset=False` means off, the same as None. It used to be
checked with `is not None`, so False drew a random bundled preset."""
with mock.patch.object(utils, "get_random_preset", side_effect=AssertionError("preset drawn")):
launch(fingerprint_preset=off)