refactor(proxy): rename and unix-generalize the shared cooperative proxy machinery#654
Merged
Conversation
Rename the Bubblewrap cooperative network-proxy machinery from "linux"-prefixed names to "unix" so it can be reused for macOS later: - wxc_common module `linux_proxy_coordinator` -> `unix_proxy_coordinator` and struct `LinuxProxyCoordinator` -> `UnixProxyCoordinator` - crate/binary `linux_test_proxy` / `linux-test-proxy` -> `unix_test_proxy` / `unix-test-proxy` (directory, Cargo manifest, workspace member, Cargo.lock) - update call sites, docs, build.sh, CI (GitHub Actions + Azure Pipelines), and SDK integration-test helpers (`startUnixTestProxy` / `findUnixTestProxyBinary`) Genuine platform-specific behavior is preserved: `#[cfg(target_os = "linux")]` gates, the internal `linux_main` entry point, the "only supported on Linux" messaging, and the SDK's Linux-only proxy-support gate. No behavior change. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: c57605d1-6f24-4c9c-ac7c-7e9cb524dbcb Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR performs a repo-wide rename of the Bubblewrap cooperative network-proxy plumbing from linux-prefixed names to unix-prefixed names, so the same coordinator and bundled test proxy can be reused for future macOS/Seatbelt work while keeping current Linux-only gating intact.
Changes:
- Renamed
wxc_common::linux_proxy_coordinator::LinuxProxyCoordinatortowxc_common::unix_proxy_coordinator::UnixProxyCoordinatorand updated Bubblewrap call sites. - Renamed the test-proxy crate/binary from
linux_test_proxy/linux-test-proxytounix_test_proxy/unix-test-proxy, including log prefixes and CLI name. - Updated build scripts, CI pipelines, SDK integration tests/helpers, and docs to reference the new names.
Show a summary per file
| File | Description |
|---|---|
| src/testing/unix_test_proxy/src/proxy.rs | Updates proxy stderr log prefixes to unix-test-proxy. |
| src/testing/unix_test_proxy/src/main.rs | Updates crate docs, clap name, runtime messages, and log prefixes to unix-test-proxy. |
| src/testing/unix_test_proxy/Cargo.toml | Renames the crate and bin target names. |
| src/core/wxc_common/src/unix_proxy_coordinator.rs | Renames the coordinator type/module references and updates log/error strings accordingly. |
| src/core/wxc_common/src/lib.rs | Switches exported module from linux_proxy_coordinator to unix_proxy_coordinator (still Linux-gated). |
| src/Cargo.toml | Updates workspace member path from testing/linux_test_proxy to testing/unix_test_proxy. |
| src/Cargo.lock | Replaces the linux_test_proxy package entry with unix_test_proxy (same dependency set). |
| src/backends/bubblewrap/common/src/bwrap_runner.rs | Updates imports/usages to UnixProxyCoordinator. |
| sdk/node/tests/integration/test-helpers.ts | Renames helper APIs and expected binary from linux-test-proxy to unix-test-proxy. |
| sdk/node/tests/integration/linux-bubblewrap.test.ts | Updates integration test to use the renamed startUnixTestProxy helper. |
| README.md | Updates documented clippy command to reference unix_test_proxy. |
| docs/bwrap-support/bubblewrap-backend.md | Updates docs to reference unix-test-proxy. |
| build.sh | Updates package list and copy steps to build/copy unix-test-proxy. |
| .github/workflows/Package.NpmSdk.Job.yml | Restores execute bit for unix-test-proxy instead of linux-test-proxy. |
| .github/workflows/Build.Linux.Job.yml | Builds/uploads unix_test_proxy / unix-test-proxy instead of the Linux-prefixed names. |
| .github/copilot-instructions.md | Updates the testing/ directory example entry to unix_test_proxy/. |
| .azure-pipelines/templates/Rust.Build.Job.yml | Updates signing pattern and explicit build step to unix_test_proxy / unix-test-proxy. |
| .azure-pipelines/templates/Package.NpmSdk.Job.yml | Updates chmod step and display name to unix-test-proxy. |
Review details
- Files reviewed: 17/18 changed files
- Comments generated: 0
- Review effort level: Low
7 tasks
…euse The rename to `unix_*` prepared the coordinator and test proxy for reuse by the macOS Seatbelt backend, but the code was still gated to Linux. Generalize the shared machinery so it actually builds and runs on all Unix targets: - wxc_common: gate `unix_proxy_coordinator` on `cfg(unix)` (was `target_os = "linux"`); the private-temp-dir chmod is now unconditional under the unix module. - unix_test_proxy: rename `linux_main` -> `unix_main` (`cfg(unix)`) and replace the Linux-only `PR_SET_PDEATHSIG` parent-death mechanism with a portable stdin-EOF parent-lifetime watcher; drop the now-unused `libc` dependency. Fold port-stripping into `HostFilter::permits` so the CONNECT path passes the full authority. - bwrap_runner: sort the `unix_proxy_coordinator` import, fixing a latent `cargo fmt` failure introduced by the mechanical rename. The Bubblewrap backend gate stays `cfg(target_os = "linux")`; only the shared machinery it depends on becomes Unix-wide. The test proxy's parent-death mechanism becomes portable but is functionally equivalent on Linux. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: d3191c12-2deb-452b-8379-3abbcd5eeb68 Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
The unix-test-proxy now uses a cross-platform stdin-EOF watcher for parent-death detection (replacing the Linux-only PR_SET_PDEATHSIG). The external-launch helper startUnixTestProxy still spawned it with 'stdio: ignore', which gives the child a /dev/null stdin that is at EOF immediately: the proxy bound its port, wrote its ready-file, then shut down right away. The Linux Bubblewrap integration test then failed with 'curl: (7) Couldn't connect to server' because the proxy was already dead. Spawn the proxy with stdin as an open pipe held by the test process (stdio: ['pipe','ignore','ignore']), mirroring how the Rust coordinator holds Stdio::piped() for the builtinTestServer proxy. EOF (and shutdown) now only fires when the test process exits. run-tests.js already passes --test-force-exit and the test's after() hook SIGTERMs the proxy, so the held pipe cannot hang the runner. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: d3191c12-2deb-452b-8379-3abbcd5eeb68 Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
SohamDas2021
approved these changes
Jul 16, 2026
MGudgin
reviewed
Jul 16, 2026
Address review feedback on the stdin-EOF parent-lifetime watcher that replaced Linux's PR_SET_PDEATHSIG: - Add a regression test that spawns unix-test-proxy, closes its stdin, and asserts it exits promptly. The parent_disconnected select! arm was previously uncovered (integration tests tear down via SIGTERM). - Restore a portable pre-bind/pre-publish guard (a non-blocking parent_already_disconnected check), the analog of the old getppid()==1 guard, so an already-dead parent can no longer leak a bound socket. - Document the fd-inheritance and startup-race caveats versus PR_SET_PDEATHSIG on parent_disconnect_signal. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 13fe9b88-1cac-4df3-99da-c92b7bda7d6a Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
Behavior-preserving cleanup of the guard code added in 9ba6d7b: - Consolidate the two duplicated startup guards and the parent_already_disconnected predicate into a single exit_if_parent_disconnected(receiver, stage) helper. - Replace the hand-rolled read-until-EOF loop with std::io::copy into io::sink (identical Interrupted-retry / EOF / hard-error behavior) and drop the now-unused std::io::Read import. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 13fe9b88-1cac-4df3-99da-c92b7bda7d6a Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
MGudgin
approved these changes
Jul 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
📚 Base of a stack. #629 (
feat(seatbelt): add cooperative network proxy support) builds on this PR and should merge after it. This PR renames and unix-generalizes the shared proxy machinery; the Seatbelt backend itself lands in #629.📖 Description
Prepares the Bubblewrap cooperative network-proxy machinery for reuse by the
macOS/Seatbelt backend, in two commits:
1. Rename
linux_*→unix_*(pure rename, no behavior change):wxc_common): modulelinux_proxy_coordinator→unix_proxy_coordinator; structLinuxProxyCoordinator→UnixProxyCoordinator.linux_test_proxy/linux-test-proxy→unix_test_proxy/unix-test-proxy(directory,Cargo.toml, workspace member,Cargo.lock, clap name, log prefixes).bwrap_runner.rs,build.sh, GitHub Actions + AzurePipelines templates, SDK integration-test helpers (
startUnixTestProxy/findUnixTestProxyBinary), and docs.2. Make the shared machinery genuinely
cfg(unix)so it builds and runs onall Unix targets (not just Linux):
unix_proxy_coordinatoroncfg(unix)(wastarget_os = "linux"); theprivate-temp-dir chmod is now unconditional under the unix module.
unix_test_proxy:linux_main→unix_main(cfg(unix)), and the Linux-onlyPR_SET_PDEATHSIGparent-death mechanism is replaced with a portablestdin-EOF parent-lifetime watcher — functionally equivalent, no
libc.Port-stripping is folded into
HostFilter::permits.bwrap_runner.rs: sort the coordinator import (fixes a latentcargo fmtfailure the mechanical rename introduced).
The Bubblewrap backend gate stays
cfg(target_os = "linux")— only the sharedmachinery it depends on becomes Unix-wide. Enabling proxy on the macOS SDK surface
and adding the Seatbelt backend is deferred to #629.
🔗 References
None — preparatory refactor for macOS/Seatbelt proxy reuse (#629).
🔍 Validation
Native macOS + Linux cross-target (from macOS;
cargo check/clippyneed nocross-linker), toolchain 1.93:
cargo fmt --all --check— clean (this PR fixes a pre-existing formattingfailure on
bwrap_runner.rs/unix_test_proxy/proxy.rs).cargo test -p wxc_common -p unix_test_proxy— 328 + 12 passed (11 unit + anew
parent_disconnectintegration test). Thecfg(unix)change means thecoordinator and test-proxy tests now also run on macOS (previously Linux-only
/ stubbed).
test (
unix_test_proxy/tests/parent_disconnect.rs, exercising theparent_disconnectedshutdown arm) plus a portable pre-bind/pre-publish guard— the analog of the old
getppid() == 1check — so an already-dead parentcan't leak a bound socket; the fd-inheritance and startup-race caveats versus
PR_SET_PDEATHSIGare documented onparent_disconnect_signal.cargo clippy -p wxc_common -p unix_test_proxy --all-targets -- -D warnings(macOS, now checks the
unix_mainpath) and the same cross-compiled tox86_64-unknown-linux-gnuforbwrap_common— no warnings.linux_proxy_coordinator/LinuxProxyCoordinator/linux_test_proxy/linux-test-proxyreferences.Cargo.lockchanges are the crate-rename, removal of thelibcedge fromunix_test_proxy, and atempfiledev-dependency edge for the new test (allalready-vendored crates; no new external crates), so
dependency-feed-checkisunaffected.
✅ Checklist
Cargo.lock, thedependency-feed-checkcheck passes (see docs/pull-requests.md)📋 Issue Type
Microsoft Reviewers: Open in CodeFlow