Skip to content

[RSDK-13658] Expose force_relay/force_p2p/turn_uri DialOptions#1208

Merged
danielbotros merged 6 commits into
mainfrom
APP-coturn-dial-options
May 19, 2026
Merged

[RSDK-13658] Expose force_relay/force_p2p/turn_uri DialOptions#1208
danielbotros merged 6 commits into
mainfrom
APP-coturn-dial-options

Conversation

@danielbotros
Copy link
Copy Markdown
Member

@danielbotros danielbotros commented Apr 28, 2026

Summary

  • Adds force_relay, force_p2p, turn_uri kwargs to DialOptions so callers can drive ICE relay/P2P testing and TURN-server filtering. The user-facing API is unchanged from prior iterations of this branch — the FFI wiring underneath is what changed.
  • Switches _Runtime to the new opaque-opts FFI introduced in [RSDK-13658] Plumb force_relay/force_p2p/turn_uri through C FFI rust-utils#176: viam_dial_with_opts + viam_dial_opts_new / _free / 3 setters, instead of a 10-arg viam_dial, with explicit alloc/free memory management around the opts handle in LibraryHandle.dial.

Won't merge until

Test plan

  • Bundled the locally built rust-utils dylib from PR RSDK-812-817: Extra params for Services #176 and confirmed LibraryHandle() resolves every new symbol (viam_dial_opts_new/_free/_set_force_relay/_set_force_p2p/_set_turn_uri, viam_dial_with_opts)
  • FFI smoke test: alloc opts → setters with valid string / NULL / empty / non-UTF8 → free; NULL inputs to setters & free safely no-op
  • ruff check, ruff format, pyright all clean on src/viam/rpc/dial.py
  • (manual, paired with rust-utils dylib) force_relay pins ICE to relay candidates against coturn; force_p2p pins to host/srflx/prflx only; turn_uri filters the TURN list

Add the matching Python kwargs for the rust-utils FFI flags landed in
viamrobotics/rust-utils#176 so SDK callers can drive ICE relay/P2P
testing and TURN-server filtering without reaching into the C ABI.

Switches `_Runtime` to the `viam_*`-prefixed FFI symbols
(viam_init_rust_runtime / viam_dial / viam_free_string /
viam_free_rust_runtime). The previously called functions were already
`#[deprecated]` upstream; this just stops asking for the deprecation
warning and lets us pass the new args.

Mirrors rust-utils' two pre-flight conflict warnings (force_relay +
force_p2p, force_p2p + turn_uri) on the Python side so callers see them
before the FFI hop.

Compatibility: requires a rust-utils release that ships PR #176. Once
that release is out, `etc/postinstall.sh` will pull a dylib whose
viam_dial accepts the new 10-arg signature; older dylibs do not, and
calling this code against them is undefined behavior. **Do not merge
this PR until that rust-utils release is cut.**

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@danielbotros danielbotros requested a review from a team as a code owner April 28, 2026 17:46
@danielbotros danielbotros requested review from lia-viam and njooma April 28, 2026 17:46
@danielbotros danielbotros marked this pull request as draft April 28, 2026 17:47
@danielbotros danielbotros marked this pull request as ready for review May 4, 2026 19:49
Copy link
Copy Markdown
Member

@stuqdog stuqdog left a comment

Choose a reason for hiding this comment

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

lgtm! note though that this shouldn't be merged until the corresponding rust-utils feature is.

@viamrobotics-overwatch
Copy link
Copy Markdown

Hey @danielbotros — this PR has been approved and CI has been green for 3+ business days. Ready to merge?

Auto-comment from overwatch. Will not re-nudge for 7 days.

@danielbotros danielbotros requested a review from stuqdog May 12, 2026 20:56
@viamrobotics-overwatch
Copy link
Copy Markdown

Hey @danielbotros — this PR has been approved and CI has been green for 3+ business days. Ready to merge?

Auto-comment from overwatch. Will not re-nudge for 7 days.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@danielbotros danielbotros merged commit acbcf4f into main May 19, 2026
13 checks passed
@danielbotros danielbotros deleted the APP-coturn-dial-options branch May 19, 2026 17:30
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