Skip to content

patch the network updat#100

Merged
Dingway98 merged 1 commit into
mainfrom
patch-network-update
Jul 8, 2026
Merged

patch the network updat#100
Dingway98 merged 1 commit into
mainfrom
patch-network-update

Conversation

@Dingway98

@Dingway98 Dingway98 commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Summary

Changes

Validation

  • ruff check
  • pytest

Open in Devin Review

Note

Medium Risk
Changes sandbox firewall PUT payloads and could alter server-side merge behavior if the API treated omitted lists differently from empty arrays.

Overview
Fixes sandbox network update requests so partial policies do not always send allowOut / denyOut as empty arrays.

Sync and async SandboxManager.update_network now serialize SandboxNetworkPolicy with exclude_unset=True (along with exclude_none and aliases). A call that only sets allowInternetAccess sends just that field, so existing outbound rules are not cleared unintentionally. Explicit empty lists are still included when the caller sets them (e.g. clear_network).

Bumps the package version to 0.93.1 and adds serialization and wire-contract tests for both behaviors.

Reviewed by Cursor Bugbot for commit b201e83. Bugbot is set up for automated code reviews on this repo. Configure here.

@Dingway98 Dingway98 merged commit 3f85432 into main Jul 8, 2026
2 of 4 checks passed
@Dingway98 Dingway98 deleted the patch-network-update branch July 8, 2026 20:50

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 potential issue.

Open in Devin Review

Comment on lines +627 to +631
data=policy.model_dump(
exclude_none=True,
exclude_unset=True,
by_alias=True,
),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 Behavioral change to update_network wire format may affect server-side interpretation

This PR changes the wire format of update_network requests: previously, calling update_network(SandboxNetworkPolicy(allow_internet_access=True)) would send {"allowInternetAccess": true, "allowOut": [], "denyOut": []} (because allow_out and deny_out default to [] via default_factory=list at hyperbrowser/models/sandbox.py:118-119). Now it sends only {"allowInternetAccess": true}. This is a semantic change from "replace the entire network policy" to "partially update only the specified fields." The server must support partial/patch-like semantics on this PUT endpoint for this to work correctly. The new tests confirm this is intentional, but it's worth verifying the server-side contract.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

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.

2 participants