Skip to content

Proxy meter: stop counting chrome:// and other local loads in Selenium and Puppeteer - #26

Merged
jehrr merged 1 commit into
mainfrom
fix/proxy-meter-local-urls-2026-10-21
Oct 21, 2026
Merged

jehrr merged 1 commit into
mainfrom
fix/proxy-meter-local-urls-2026-10-21

Conversation

@jehrr

@jehrr jehrr commented Oct 21, 2026

Copy link
Copy Markdown
Collaborator

Problem

The proxy meter added in the previous PR counted Chrome's own chrome:// loads in Selenium and Puppeteer. The new-tab page's scripts come with responseReceived and loadingFinished events, and none of them crosses a proxy. Measured on farfetch-scraper's Selenium CLI through a stub proxy: the meter counted 2,779,683 bytes while the stub saw about 6 KB. That spends a large share of the default 10 MB --proxy-budget-mb on traffic that never happened.

Resulting behaviour

  • Only http:// / https:// requests and responses are counted (proxy_meter.feed_cdp).
  • data:, blob:, chrome:// and other local schemes count nothing.
  • The block sent once the budget is spent goes to the page's own event loop through call_soon_threadsafe. Where this repo already had that, nothing changes.
  • The shared proxy_meter.py and tests/test_proxy_meter.py are now identical across the repos that carry the meter.

Evidence

  • New test case: a chrome://new-tab-page/x.js request, response and finish count 0 bytes. Against the previous proxy_meter.py it fails, and with this one it passes.
  • In the repos where the thread-safe block is new, test_pyppeteer_block_from_a_worker_thread also fails against the previous proxy_meter.py.
  • The smoke suite passes in a core venv. tests/test_proxy_meter.py passes in the Selenium and pyppeteer venvs, with the real-browser tests run, not skipped.
  • No proxy was used, no paid call was made and no canary was dispatched.

Not changed

Engines, sidecar fields, exit codes and the canary are unchanged. There is no release.

🤖 Generated with Claude Code

https://claude.ai/code/session_01CKsd7q25N19WzUZjrAdzx8

…m and Puppeteer

Chrome's new-tab page loads chrome:// scripts (about 2.8 MB) that CDP
reports as finished loads; they never cross a proxy but were added to
proxy_bytes. Only http(s) requests and responses are counted now, and the
budget block is handed to the page's own event loop.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CKsd7q25N19WzUZjrAdzx8
@jehrr
jehrr merged commit 366b3df into main Oct 21, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant