Skip to content

feat(browse): allow CPU and network throttling for performance measurement - #2602

Closed
henbima wants to merge 1 commit into
garrytan:mainfrom
henbima:feat/allow-perf-emulation
Closed

henbima wants to merge 1 commit into
garrytan:mainfrom
henbima:feat/allow-perf-emulation

Conversation

@henbima

@henbima henbima commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Adds Emulation.setCPUThrottlingRate and Network.emulateNetworkConditions to CDP_ALLOWLIST.

Motivation. Diagnosing a real "uploading a photo takes 1–2 minutes" report, the only machine available was a fast developer workstation. Client-side processing measured 1.4 s where the user experienced minutes, so the conclusion had to be reached arithmetically rather than observed. Throttling would have let the measurement reproduce the reporter's conditions directly — which is the difference between a diagnosis and an inference.

Both fit the existing posture rather than widening it:

  • Emulation already allows setDeviceMetricsOverride, clearDeviceMetricsOverride and setUserAgentOverride — equally mutating, equally tab-scoped.
  • Neither reads page content. setCPUThrottlingRate affects only timing; emulateNetworkConditions constrains traffic rather than inspecting it, so no request bodies, headers or cookies are exposed. Both are output: 'trusted' because they return no page-derived data.
  • scope: 'tab' for both, matching the surrounding Emulation entries.

Each entry carries all four required fields, so cdp-allowlist.test.ts should pass unchanged.

…ement

Adds Emulation.setCPUThrottlingRate and Network.emulateNetworkConditions to
CDP_ALLOWLIST.

Motivation: diagnosing a real "uploads take 1-2 minutes" report, the only
machine available was a fast developer workstation. Client-side processing
measured 1.4s where the user experienced minutes, so the conclusion had to be
reached arithmetically rather than observed. Throttling would have let the
measurement reproduce the reporter's conditions directly.

Both fit the existing posture rather than widening it:
  - Emulation already allows setDeviceMetricsOverride, clearDeviceMetricsOverride
    and setUserAgentOverride, which are equally mutating and scoped to the tab.
  - Neither method reads page content. setCPUThrottlingRate affects only timing;
    emulateNetworkConditions constrains traffic rather than inspecting it, so no
    request bodies, headers or cookies are exposed. Both are output: 'trusted'
    because they return no page-derived data.

scope 'tab' for both, matching the surrounding Emulation entries.
@trunk-io

trunk-io Bot commented Aug 16, 2026

Copy link
Copy Markdown

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

@capy-ai

capy-ai Bot commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

Thanks for this, @henbima. This is now covered on main: Emulation.setCPUThrottlingRate and Network.emulateNetworkConditions are in the CDP allowlist (browse/src/cdp-allowlist.ts) (shipped in v1.68.0.0, #2632). Closing as superseded; if you still see the problem on the latest gstack, please open an issue with ./setup --status output.

@capy-ai capy-ai Bot closed this Oct 3, 2026
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