Skip to content

fix: preserve restricted proxies after in-place operations - #1706

Open
Sakshamm-Goyal wants to merge 2 commits into
temporalio:mainfrom
Sakshamm-Goyal:agent/fix-restricted-proxy-iop-binding
Open

fix: preserve restricted proxies after in-place operations#1706
Sakshamm-Goyal wants to merge 2 commits into
temporalio:mainfrom
Sakshamm-Goyal:agent/fix-restricted-proxy-iop-binding

Conversation

@Sakshamm-Goyal

Copy link
Copy Markdown
Contributor

What changed

Fixes #772. In-place operations on a sandbox-restricted mutable object now keep the restriction proxy instead of replacing it with the raw object.

Why

_RestrictedProxyIOp built a wrapper that returned the proxy, but stored it under bind_f instead of the lookup descriptor's bind_func. The normal binding path therefore returned the underlying object after +=, bypassing the proxy for later accesses.

Validation

  • Added a regression covering list += [...] through _RestrictedProxy.
  • pytest tests/worker/workflow_sandbox/test_restrictions.py -q (4 passed)
  • ruff check and ruff format --check on changed files
  • pyright tests/worker/workflow_sandbox/test_restrictions.py

@Sakshamm-Goyal
Sakshamm-Goyal requested a review from a team as a code owner July 31, 2026 03:04
@Sakshamm-Goyal

Copy link
Copy Markdown
Contributor Author

Fixed the CI mypy regression in 763e26c. The functional change correctly assigns the in-place-operation binder to bind_func, but _RestrictedProxyLookup did not declare that instance attribute, so Mypy inferred an incompatible optional assignment in the subclass.

The fix declares the binder's callable shape on the lookup class; it does not change runtime dispatch. The focused type check (mypy --follow-imports=skip temporalio/worker/workflow_sandbox/_restrictions.py) now passes with no issues. The behavioral regression test is already included in the PR; this local worktree no longer has its compiled bridge extension after UV resynchronization, so I did not report a false local pytest result. Fresh CI will validate the complete pinned environment.

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.

[Bug] Investigate unused bind_f function

1 participant