Skip to content

feat(ctx): bind mailbox by label - #27

Merged
lutz-grex merged 4 commits into
mainfrom
lucius/ctx-ports-fn
Nov 30, 2026
Merged

lutz-grex merged 4 commits into
mainfrom
lucius/ctx-ports-fn

Conversation

@lutz-grex

Copy link
Copy Markdown
Contributor

Summary

The context is a set of ports whose adapters differ for local, cloud and tests. A Mailbox is now chosen by its declaration instead of by run data, the proxy comes from the device, and scripts can run against fake adapters offline.

Changes

  • binding(label="...") on a Mailbox resolves the mailbox you own with exactly that label through the SDK (paginated list), locally with your API key and in the cloud with the run key. Without a label the only mailbox is used; no match or several matches fail before main with a NotAvailableError that names the label.
  • inspect output is unchanged: requires.mailbox stays a boolean and the label is not emitted.
  • Proxy reads the proxy of the run's device; it no longer connects a proxy or needs run data.
  • Removed ProxyKind, ProxyRef, RunInfo.mailbox_id/proxy and the CLI flags --mailbox-id, --proxy-kind, --proxy-id.
  • New mobilerun_functions.testing (FakeDevice, FakeMailbox, FakeProxy, run_script) and Context(run, **ports) to inject explicit adapters; documented in the README.

Testing

  • Unit tests on the SDK mock transport for label match, label on a later page, single mailbox, none and ambiguous mailboxes, and local versus cloud resolution.
  • The example script runs end to end on fakes with sockets blocked.
  • mypy, ruff and pytest (495 tests) pass.

Runtime

UNVERIFIED — needs a run against a cloud device and mailbox after the next functions release.

Rollout

Breaking for scripts that pass --mailbox-id or --proxy-* (the flags are gone). Scripts with a bare mailbox: Mailbox keep working when the account has exactly one mailbox. Needs a functions release before the executor image picks it up; sandbox run-start fields are removed separately.

🤖 Generated with Claude Code

lutz-grex and others added 3 commits November 27, 2026 13:49
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@lutz-grex
lutz-grex requested a review from RasulOs November 30, 2026 08:23
RasulOs
RasulOs previously approved these changes Nov 30, 2026
@lutz-grex
lutz-grex changed the base branch from lucius/fn-device-forward to main November 30, 2026 09:25
@lutz-grex
lutz-grex dismissed RasulOs’s stale review November 30, 2026 09:25

The base branch was changed.

@lutz-grex
lutz-grex merged commit b833ebf into main Nov 30, 2026
3 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.

2 participants