Skip to content

Issue #1845: one opt-out for the tests that start the device-sync service - #1846

Merged
emmertex merged 1 commit into
emmertex:stagingfrom
clydecbrown:classic/fix/lan-tests-opt-out
Dec 2, 2026
Merged

emmertex merged 1 commit into
emmertex:stagingfrom
clydecbrown:classic/fix/lan-tests-opt-out

Conversation

@clydecbrown

Copy link
Copy Markdown
Collaborator

Fixes #1845

Problem

The tests that start the device-sync service (lcc_peer::Service::start binds a TCP listener on 0.0.0.0 and joins the mDNS group) make macOS ask "accept incoming network connections?" for every test binary, and a rebuild changes the binary's hash, so allowing it once never lasts and the run waits for an answer. About twenty tests do it: 15 in lcc-peer (service::tests::) and 2 in lcc-engine. The only existing skip was macOS && CI set, for the CI runner's multicast timeouts; it covered two of them and did nothing on a developer's Mac. docs/ci.md said five tests skip there.

Change

lcc_testkit::lan_tests(discovery: bool) (next to probe) returns false and records a System skip when CHROMAFORGE_SKIP_LAN_TESTS is set to a non-empty value other than 0; the skip names the variable. With discovery true it also skips on the macOS CI runner, which is the old check moved in. The 15 lcc-peer and 2 lcc-engine tests that start the service (directly, through start()/paired(), or through sync.find) call it first. A source-scan test in each crate fails for a test that starts the service without it.

  • AC-1: with the variable set, every lcc-peer and lcc-engine test that starts the service skips naming the variable and returns before starting it, so no socket opens on a non-loopback address — cargo test -p lcc-peer --lib (51 pass) and -p lcc-engine --lib device_sync (14 pass) in 2–3 s with it set; lsof on a process showed sync.find {on:true} binds *:<udp> and *:<tcp>, and sync.find {on:false} binds nothing; no firewall prompt on a Mac.
  • AC-2: with the variable unset nothing changes — lan_skip_reason returns None and the guards return at once; the same tests ran unset on this Mac and only the two already known to fail here (multicast doesn't loop back) failed.
  • AC-3: the macOS CI-runner skip moved into the same function, one reason text — the inline checks in crates/peer and crates/engine are gone. It takes discovery so the skip stays on the two tests that had it (applying it to all 17 would skip 15 more on that runner).
  • AC-4: a test that starts the service without the check fails a source-scan test — every_test_that_starts_the_service_checks_the_lan_opt_out in crates/peer/src/service/tests.rs and crates/engine/src/device_sync/tests.rs; each seen failing with one guard removed, and for a throwaway test with a doc comment after #[test].
  • AC-5: docs/ci.md names the variable and the firewall prompt next to the macOS note and lists the two tests that skip there.
  • AC-6: the skip goes through record like skip!, so it is reported as a System skip in target/ci/report.json; CI doesn't set the variable and ci/skip-allowlist.toml is unchanged.

Not in this PR: a guard for a test that starts the service through some other helper than the ones the scans name (start(, paired(, session(, sync.find, …): the scan is a token scan. lcc-ui-egui's Sync-page tests (tests_settings_search.rs) open no socket without a settings folder and were left alone.

Manual: none, no user-visible change.

How it was checked

  • cargo xtask ci --quick and cargo test -p for the touched crates pass on this branch, up to date with staging (merged in, not rebased); sil isn't affected (no pipeline or develop change)
    The gate passed on this branch; it is behind staging by commits that touch other files and merges cleanly, so it hasn't been merged in.
  • A test that fails without this change: each new test seen failing under a mutation (the new API doesn't exist before this change, so they can't be run against staging): lan_skip_reason tests with v != "0" flipped; the peer and engine scans with one guard removed (a_shared_device_name_is_reported, cancel_pairing_without_a_pairing_is_harmless), and with an unguarded throwaway test using #[ignore] and a doc comment, and one using only sync.rename.

Merging

  • Overlap: none found (searched open and recently closed issues and PRs for tests, opt-out, bind, interfaces).
  • Existing edits and libraries: unchanged.
  • Shared numbers taken: none.
  • Where it came from: original work.
  • New dependencies, unsafe, build scripts, network access, spawned processes, deleted files, CI or xtask gate changes: none.
  • Runs on CI: nothing beyond the touched crates' own tests; no workflow, build-script, packaging or dependency changes. CI doesn't set CHROMAFORGE_SKIP_LAN_TESTS, so the tests run as before there.

Checklist

  • No new panic path in non-test code: the only non-test change is lcc_testkit::lan_tests, a dev-dependency that reads an environment variable and records a skip
  • New code has a caller: lan_tests is called by the 17 tests
  • Ready to merge

🤖 Generated with Claude Code

…ervice

lcc_testkit::lan_tests(discovery) skips, with a System skip that names
CHROMAFORGE_SKIP_LAN_TESTS, every lcc-peer and lcc-engine test that binds
sockets on all interfaces, so a developer's Mac isn't asked about incoming
connections for each rebuilt test binary. The macOS CI-runner skip moves into
the same function and still applies only to the two tests that need
discovery. A source-scan test in each crate fails for a test that starts the
service without the check.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@emmertex

emmertex commented Dec 2, 2026

Copy link
Copy Markdown
Owner

Looks good — merging. Two small nits for a follow-up, not blocking: in crates/testkit/src/lib.rs the new tests sit above use super::*; in mod tests (move the use back to the top), and docs/ci.md's Last updated date stayed at 2026-11-29 although a new Change entry was added.

@emmertex
emmertex merged commit 49831ca into emmertex:staging Dec 2, 2026
3 checks passed
@clydecbrown
clydecbrown deleted the classic/fix/lan-tests-opt-out branch December 2, 2026 18:29
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.

Tests: one opt-out for the LAN tests that bind all interfaces

2 participants