fix(probes): isolate global-subscriber tests — kill #203 pollution flake#1549
fix(probes): isolate global-subscriber tests — kill #203 pollution flake#1549joelteply wants to merge 1 commit into
Conversation
APPROVE (adversarial reviewer) — fix is sound, minimal, and empirically verifiedPer Walked the 7 dimensions:
Merge-order note (not blocking): If PR #1547 lands first, it adds a Per |
…lake
`install_probe_tracing` calls `tracing_subscriber::registry().try_init()`,
which permanently attaches the substrate's UriCaptureLayer +
ProbeRouterLayer + fmt layer to the GLOBAL tracing default for the
rest of the process. That's correct for production (one process, one
boot, one install) but in cargo's lib-test binary it leaked across
tests:
routing::tracing_init::tests::install_is_idempotent_with_no_disk_capture
→ installs the global subscriber
routing::uri_layer::tests::no_subscriber_returns_empty_chain
→ asserts an empty chain "no installed Layer means no captured frames"
→ PANICS when the install ran first in the same binary
Task #203 captured the symptom. Today's PR #1547 hit it deterministically
when running `cargo test -p continuum-core --lib routing::`.
Fix: move both `install_*` tests out of the lib-test binary and into
their own integration-test file (`tests/tracing_install_global.rs`).
Each `tests/*.rs` file becomes a separate binary in cargo's runner —
process isolation contains the global install per binary.
`from_env_reads_documented_env_vars` stays in the lib-test module
because it only touches env vars (already serial within itself) and
never calls `install_probe_tracing`.
Verification: `cargo test -p continuum-core --lib routing::` now
passes 252/252 (was 252/253 with the flake), and the new integration
binary passes 2/2.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
f7d853d to
fc671fd
Compare
Summary
Close task #203: move
install_probe_tracingtests out of the lib-test binary into their own integration-test binary so the global tracing-subscriber install they trigger can't pollute other lib-tests.Why
install_probe_tracingcallstracing_subscriber::registry().try_init(), which permanently attaches the substrate'sUriCaptureLayer + ProbeRouterLayer + fmtlayer stack to the global tracing default for the rest of the process. Correct for production (one process, one boot, one install) — wrong for cargo's shared lib-test binary, where the install leaked across tests:routing::tracing_init::tests::install_is_idempotent_with_no_disk_capture→ installs the global subscriber.routing::uri_layer::tests::no_subscriber_returns_empty_chain→ asserts an empty chain because "no installed Layer means no captured frames" — panics when the install ran first in the same binary.Task #203 captured the symptom. PR #1547 hit it deterministically today when running
cargo test -p continuum-core --lib routing::.What changed
continuum-core/tests/tracing_install_global.rs(new integration-test file = its own cargo test binary = its own process).install_is_idempotent_with_no_disk_captureandinstall_surfaces_open_failed_for_unwritable_paththere verbatim.tracing_init.rs::testsexplaining where they live + why.from_env_reads_documented_env_varsstays in the lib-test module — it only mutates env vars (already serial within itself), never callsinstall_probe_tracing.Test plan
cargo test --features metal,accelerate -p continuum-core --lib routing::→ 252/252 passed (was 252/253 with the flake —no_subscriber_returns_empty_chainis now consistently green).cargo test --features metal,accelerate -p continuum-core --test tracing_install_global→ 2/2 passed in the isolated binary.Closes #203.