Skip to content

Add per-CDP control for Network.setCacheDisabled#2990

Merged
krichprollsch merged 1 commit into
lightpanda-io:mainfrom
staylor:scott/http-cache-interception
Jul 21, 2026
Merged

Add per-CDP control for Network.setCacheDisabled#2990
krichprollsch merged 1 commit into
lightpanda-io:mainfrom
staylor:scott/http-cache-interception

Conversation

@staylor

@staylor staylor commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add LP.configureCDP with a disableSetCacheDisabled option
  • scope the option to the current CDP connection and keep existing behavior by default
  • allow browser-target CDP sessions to be created before a browser context exists
  • acknowledge but ignore Network.setCacheDisabled while the option is enabled

Usage

const client = await browser.newBrowserCDPSession();
await client.send("LP.configureCDP", {
  disableSetCacheDisabled: true,
});

Sending the option as false restores the standard handling of subsequent Network.setCacheDisabled commands.

Motivation

Automation libraries can send Network.setCacheDisabled(true) as a side effect of enabling request interception. That makes a configured HTTP cache ineffective even when the caller wants interception and caching to coexist.

The custom command provides an explicit, per-connection override without adding a library-specific CLI flag or changing the default cache policy.

Validation

  • zig fmt --check ./*.zig ./**/*.zig
  • added unit coverage for configuration toggling and both cache-disable paths
  • added coverage for creating a browser-target session before a browser context
  • make test reached the final local link step, which is blocked on this machine by a Nix/macOS framework search-path mismatch; CI provides the authoritative full run

@staylor
staylor force-pushed the scott/http-cache-interception branch from f5d027d to b773efa Compare July 18, 2026 06:17
@krichprollsch

Copy link
Copy Markdown
Member

@staylor thanks for the PR and the issue. I didn't know playwright disable cache when request interception are set.
I'm not sure with this new flag which is very specific to this playwright's behavior...

What if we add instead a custom LP.configureCDP with something like disableSetCacheDisabled: true you could call with:

const client = await browser.newBrowserCDPSession();
await client.send('LP.configureCDP', {
  disableSetCacheDisabled: true,
});

@staylor

staylor commented Jul 20, 2026

Copy link
Copy Markdown
Contributor Author

What if we add instead a custom LP.configureCDP

@krichprollsch I'll take a pass at it

Assisted-By: devx/2fa2960e-76f4-4b6e-b6e6-1419f108f12b
@staylor
staylor force-pushed the scott/http-cache-interception branch from b773efa to c7850a4 Compare July 20, 2026 18:03
@staylor staylor changed the title Keep HTTP cache enabled during Fetch interception Add per-CDP control for Network.setCacheDisabled Jul 20, 2026
@staylor

staylor commented Jul 20, 2026

Copy link
Copy Markdown
Contributor Author

@krichprollsch Implemented—thanks for the suggestion. The PR now adds the per-connection command:

const client = await browser.newBrowserCDPSession();
await client.send("LP.configureCDP", {
  disableSetCacheDisabled: true,
});

The default Network.setCacheDisabled behavior is unchanged, and sending false restores normal handling for subsequent commands. I also updated browser-target sessions so this configuration can be applied before creating a browser context, and removed the interception-specific CLI flag.

@krichprollsch
krichprollsch merged commit ea20083 into lightpanda-io:main Jul 21, 2026
25 checks passed
@krichprollsch

Copy link
Copy Markdown
Member

thanks!

@github-actions github-actions Bot locked and limited conversation to collaborators Jul 21, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants