Skip to content

test(net-proxy): serialize fenced_child on net_test_lock() (#207)#218

Merged
hartsock merged 2 commits into
mainfrom
issue-207/net-test-lock-fenced-child
Jul 15, 2026
Merged

test(net-proxy): serialize fenced_child on net_test_lock() (#207)#218
hartsock merged 2 commits into
mainfrom
issue-207/net-test-lock-fenced-child

Conversation

@hartsock

@hartsock hartsock commented Jul 13, 2026

Copy link
Copy Markdown
Member

Summary

net_proxy::tests::fenced_child_reaches_allowed_via_proxy_denied_refused_direct_kernel_blocked
was the only remaining real-socket test in the net_proxy module without a
serialization guard against sibling loopback tests; the PR #195 macOS CI flake
(Empty reply from server on the allow-leg) motivated #207.

The first commit applied #207's one-line fix as written, but that issue predates
#216: the in-memory migration (17e7d7b) had already removed net_test_lock()
along with most real-socket tests, so the line failed macOS CI with E0425 — the
call is macos+seatbelt-gated and never compiled on the Linux dev host.

The second commit restores net_test_lock() (the poison-immune static-Mutex
idiom from #155) and takes it in all three remaining real-socket tests
(proxy_env…, fenced_child…, dropping_the_handle…), so the
serialization domain is complete and the helper is used — not dead code under
-D warnings — on every CI platform. The doc comment records the caveat that
the lock is process-local: sufficient because cargo test runs test binaries
sequentially; a per-test-process runner (nextest) would not be covered.

Test plan (verified on an M4 mac, macOS + seatbelt)

  • CI-parity clippy: RUSTFLAGS="-D warnings" cargo clippy --workspace --exclude agent-bridle-py --all-targets --all-features -- -D warnings — green.
  • BRIDLE_REQUIRE_SEATBELT=1 cargo test --workspace --exclude agent-bridle-py --all-features — green; the fenced_child… kernel proof genuinely ran (no self-skip; all three legs asserted).
  • Tool-shell suite 5/5 consecutive runs green (118 tests each); --no-default-features workspace tests green.

Fixes #207

fenced_child_reaches_allowed_via_proxy_denied_refused_direct_kernel_blocked
was the only loopback-exercising test in the net_proxy module that did not
take the module's net_test_lock() serialization guard. It is also the
heaviest net test — it spawns a loopback origin, a proxy, and a real curl
child — so running it concurrently with a sibling proxy test raced on
loopback and flaked CI (observed as "Empty reply from server" on the
allow-leg in PR #195's macOS CI).

Acquire net_test_lock() as the test's first statement, matching every
sibling loopback test (same lock, same RAII scope held through the whole
test), so it can no longer race siblings on loopback.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@hartsock hartsock added the risk:low Low-risk change label Jul 13, 2026
…fix could not compile

The one-line fix from #207 called net_test_lock(), but the #216 in-memory
migration (17e7d7b) had removed that helper together with most real-socket
tests. The call sits behind cfg(target_os = "macos", feature =
"macos-seatbelt"), so the Linux dev host never compiled it and macOS CI
failed with E0425 (cannot find function net_test_lock).

Restore the helper — the same poison-immune static-Mutex idiom #155
introduced — and take it in all three remaining real-socket tests
(proxy_env…, fenced_child…, dropping_the_handle…), so the serialization
domain is complete and the helper is used (not dead code under
-D warnings) on every CI platform.

Verified on an M4 mac: CI-parity clippy green; full workspace suite green
under BRIDLE_REQUIRE_SEATBELT=1 with the fenced_child kernel proof
genuinely running (no self-skip); tool-shell suite 5/5 repeat runs green;
--no-default-features workspace tests green.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@hartsock
hartsock merged commit 96d4db8 into main Jul 15, 2026
10 checks passed
@hartsock
hartsock deleted the issue-207/net-test-lock-fenced-child branch July 15, 2026 23:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk:low Low-risk change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test(net-proxy): fenced_child… keystone omits net_test_lock() — races siblings on loopback (PR #195 CI flake)

1 participant