mirror of
https://github.com/daijro/camoufox.git
synced 2026-10-04 08:00:19 +00:00
chore(python)!: drop data the package never draws from
voices.json shipped in the wheel, but no code in the package reads it: the
voice draw uses voice-manifests.json and voice-uris.json. Its only readers
are the TypeScript port's golden-fixture generator and data-sync script
(typescript/scripts/golden/identity_golden.py,
typescript/scripts/sync-identity-data.py), which live on another branch and
will need a new source; the last copy is at
676fb3f:pythonlib/camoufox/voices.json. docs/per-context-patches.md
described it as runtime data and now describes the files that are.
webgl_data.db held two rows with zero weight on every OS ("Intel(R) HD
Graphics 400, or similar" from "Intel Inc." and "Radeon R9 200 Series, or
similar" from "ATI Technologies Inc."), left behind when their impossible
macOS weights were zeroed. No draw can reach them. They are deleted with
secure_delete so their blobs do not linger in free pages; the file is not
vacuumed, so the other pages are unchanged. A new test requires every row
to be drawable on at least one OS.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
4616aa58ca
commit
9a42b6a17f
@@ -36,7 +36,7 @@ class TestRules:
|
||||
assert config["navigator.hardwareConcurrency"] == 8
|
||||
|
||||
def test_a_mac_cannot_report_a_braswell_atom_igp(self):
|
||||
# webgl_data.db weights this at 7.4% of the macOS pool.
|
||||
# webgl_data.db once weighted this at 7.4% of the macOS pool.
|
||||
config = {"webGl:renderer": "Intel(R) HD Graphics 400, or similar"}
|
||||
assert [v.rule for v in coherence.validate(config, "mac")] == ["gpu-matches-os"]
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ class TestPinnedIdentityIsStable:
|
||||
# The test above draws ONE preset at random, so a preset that cannot
|
||||
# launch shows up as a 1-in-11 flake rather than a failure -- which is
|
||||
# how it reached CI. 39 of the 435 bundled presets name a GPU that is
|
||||
# not among the 33 in webgl_data.db, and sample_webgl raises for those.
|
||||
# not among the 31 in webgl_data.db, and sample_webgl raises for those.
|
||||
# Every preset has to produce launch options; see the fallback in
|
||||
# utils.launch_options.
|
||||
from camoufox.webgl import sample_webgl
|
||||
|
||||
@@ -74,3 +74,23 @@ def test_each_os_still_has_gpus_to_draw_from():
|
||||
assert count >= 2, f"{os_key} has {count} GPU(s) left"
|
||||
finally:
|
||||
connection.close()
|
||||
|
||||
|
||||
def test_every_gpu_row_can_be_drawn_on_some_os():
|
||||
"""A row no OS can draw is dead weight a reader would take as real data."""
|
||||
connection = sqlite3.connect(DB_PATH)
|
||||
try:
|
||||
rows = connection.execute(
|
||||
"SELECT vendor, renderer, win, mac, lin FROM webgl_fingerprints"
|
||||
).fetchall()
|
||||
finally:
|
||||
connection.close()
|
||||
undrawable = [
|
||||
(vendor, renderer)
|
||||
for vendor, renderer, *weights in rows
|
||||
if not any(
|
||||
weight > 0 and coherence.gpu_fits_os(renderer, os_key)
|
||||
for os_key, weight in zip(("win", "mac", "lin"), weights)
|
||||
)
|
||||
]
|
||||
assert undrawable == []
|
||||
|
||||
@@ -153,7 +153,7 @@ def test_voice_generation_failure_fails_closed(monkeypatch):
|
||||
import camoufox.utils as utils
|
||||
|
||||
def boom(*_args, **_kwargs):
|
||||
raise RuntimeError("voices.json unreadable")
|
||||
raise RuntimeError("voice-manifests.json unreadable")
|
||||
|
||||
monkeypatch.setattr(utils, "_generate_random_voice_subset", boom)
|
||||
cfg = _launch_config(os="macos")
|
||||
|
||||
Reference in New Issue
Block a user