From 431eee3727bdde3507943c7b0817fc3b3e18d452 Mon Sep 17 00:00:00 2001 From: "Aaron D. Lee" Date: Sun, 5 Jul 2026 16:33:43 +0000 Subject: [PATCH] fix(trunk): move T8 #[ignore] full-e2e stub to binary crate tests (#21) Co-authored-by: Aaron D. Lee Co-committed-by: Aaron D. Lee --- Cargo.lock | 265 +++++------------------- crates/rutster-trunk/tests/sim_integ.rs | 16 -- crates/rutster/tests/trunk_sim_e2e.rs | 35 ++++ 3 files changed, 87 insertions(+), 229 deletions(-) create mode 100644 crates/rutster/tests/trunk_sim_e2e.rs diff --git a/Cargo.lock b/Cargo.lock index aadfcc2..d4a8916 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -465,9 +465,12 @@ dependencies = [ [[package]] name = "deranged" -version = "0.5.8" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cd812cc2bc1d69d4764bd80df88b4317eaef9e773c75226407d9bc0876b211c" +checksum = "9c9e6a11ca8224451684bc0d7d5a7adbf8f2fd6887261a1cfc3c0432f9d4068e" +dependencies = [ + "powerfmt", +] [[package]] name = "digest" @@ -481,9 +484,9 @@ dependencies = [ [[package]] name = "dimpl" -version = "0.7.1" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb2b8390bf0021eae92cf96a0e3a54c531b6315c47edfe9220f5fc61bc9e1f63" +checksum = "0a11091ebc139b18d6b5878d8769ca43ad5ea8a7e2f5ed1e1f25e172951ef0ce" dependencies = [ "aes", "arrayvec", @@ -788,88 +791,6 @@ dependencies = [ "tracing", ] -[[package]] -name = "icu_collections" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2984d1cd16c883d7935b9e07e44071dca8d917fd52ecc02c04d5fa0b5a3f191c" -dependencies = [ - "displaydoc", - "potential_utf", - "utf8_iter", - "yoke", - "zerofrom", - "zerovec", -] - -[[package]] -name = "icu_locale_core" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92219b62b3e2b4d88ac5119f8904c10f8f61bf7e95b640d25ba3075e6cac2c29" -dependencies = [ - "displaydoc", - "litemap", - "tinystr", - "writeable", - "zerovec", -] - -[[package]] -name = "icu_normalizer" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c56e5ee99d6e3d33bd91c5d85458b6005a22140021cc324cea84dd0e72cff3b4" -dependencies = [ - "icu_collections", - "icu_normalizer_data", - "icu_properties", - "icu_provider", - "smallvec", - "zerovec", -] - -[[package]] -name = "icu_normalizer_data" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da3be0ae77ea334f4da67c12f149704f19f81d1adf7c51cf482943e84a2bad38" - -[[package]] -name = "icu_properties" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bee3b67d0ea5c2cca5003417989af8996f8604e34fb9ddf96208a033901e70de" -dependencies = [ - "icu_collections", - "icu_locale_core", - "icu_properties_data", - "icu_provider", - "zerotrie", - "zerovec", -] - -[[package]] -name = "icu_properties_data" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e2bbb201e0c04f7b4b3e14382af113e17ba4f63e2c9d2ee626b720cbce54a14" - -[[package]] -name = "icu_provider" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "139c4cf31c8b5f33d7e199446eff9c1e02decfc2f0eec2c8d71f65befa45b421" -dependencies = [ - "displaydoc", - "icu_locale_core", - "writeable", - "yoke", - "zerofrom", - "zerotrie", - "zerovec", -] - [[package]] name = "idna" version = "1.1.0" @@ -883,12 +804,22 @@ dependencies = [ [[package]] name = "idna_adapter" -version = "1.2.2" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb68373c0d6620ef8105e855e7745e18b0d00d3bdb07fb532e434244cdb9a714" +checksum = "279259b0ac81c89d11c290495fdcfa96ea3643b7df311c138b6fe8ca5237f0f8" dependencies = [ - "icu_normalizer", - "icu_properties", + "idna_mapping", + "unicode-bidi", + "unicode-normalization", +] + +[[package]] +name = "idna_mapping" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11c13906586a4b339310541a274dd927aff6fcbb5b8e3af90634c4b31681c792" +dependencies = [ + "unicode-joining-type", ] [[package]] @@ -974,12 +905,6 @@ version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" -[[package]] -name = "litemap" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92daf443525c4cce67b150400bc2316076100ce0b3686209eb8cf3c31612e6f0" - [[package]] name = "lock_api" version = "0.4.14" @@ -1085,9 +1010,9 @@ dependencies = [ [[package]] name = "num-conv" -version = "0.2.2" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "521739c6d2bac4aa25192232afe6841231376b2b26d4d9fae5ecf8ca5772e441" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" [[package]] name = "num-integer" @@ -1191,15 +1116,6 @@ version = "0.3.33" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "19f132c84eca552bf34cab8ec81f1c1dcc229b811638f9d283dceabe58c5569e" -[[package]] -name = "potential_utf" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0103b1cef7ec0cf76490e969665504990193874ea05c85ff9bab8b911d0a0564" -dependencies = [ - "zerovec", -] - [[package]] name = "powerfmt" version = "0.2.0" @@ -1873,12 +1789,6 @@ dependencies = [ "der", ] -[[package]] -name = "stable_deref_trait" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" - [[package]] name = "str0m" version = "0.21.0" @@ -2027,44 +1937,35 @@ dependencies = [ [[package]] name = "time" -version = "0.3.53" +version = "0.3.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18dfaaeddcb932337b5e7866ee7d0ce9b76d2fd092997146f187ec09b4558a50" +checksum = "8a7619e19bc266e0f9c5e6686659d394bc57973859340060a69221e57dbc0c40" dependencies = [ "deranged", + "itoa", "num-conv", "powerfmt", - "serde_core", + "serde", "time-core", "time-macros", ] [[package]] name = "time-core" -version = "0.1.9" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e1c906769ad99c88eaa54e728060edef082f8e358ff32030cb7c7d315e81109" +checksum = "c9e9a38711f559d9e3ce1cdb06dd7c5b8ea546bc90052da6d06bb76da74bb07c" [[package]] name = "time-macros" -version = "0.2.31" +version = "0.2.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c431b87111666e491a90baa837f914fb45cd5dc3c268591b0220ff5057f2085f" +checksum = "3526739392ec93fd8b359c8e98514cb3e8e021beb4e5f597b00a0221f8ed8a49" dependencies = [ "num-conv", "time-core", ] -[[package]] -name = "tinystr" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8323304221c2a851516f22236c5722a72eaa19749016521d6dff0824447d96d" -dependencies = [ - "displaydoc", - "zerovec", -] - [[package]] name = "tinyvec" version = "1.11.0" @@ -2309,12 +2210,33 @@ version = "1.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20" +[[package]] +name = "unicode-bidi" +version = "0.3.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c1cb5db39152898a79168971543b1cb5020dff7fe43c8dc468b0885f5e29df5" + [[package]] name = "unicode-ident" version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" +[[package]] +name = "unicode-joining-type" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8d00a78170970967fdb83f9d49b92f959ab2bb829186b113e4f4604ad98e180" + +[[package]] +name = "unicode-normalization" +version = "0.1.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fd4f6878c9cb28d874b009da9e8d183b5abc80117c40bbd187a1fde336be6e8" +dependencies = [ + "tinyvec", +] + [[package]] name = "untrusted" version = "0.7.1" @@ -2585,12 +2507,6 @@ version = "0.57.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e" -[[package]] -name = "writeable" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ffae5123b2d3fc086436f8834ae3ab053a283cfac8fe0a0b8eaae044768a4c4" - [[package]] name = "x509-cert" version = "0.2.5" @@ -2630,29 +2546,6 @@ dependencies = [ "time", ] -[[package]] -name = "yoke" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "709fe23a0424b6a435d82152b1bd3fdfb0833487d5fa90d05d42762a9891fef5" -dependencies = [ - "stable_deref_trait", - "yoke-derive", - "zerofrom", -] - -[[package]] -name = "yoke-derive" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de844c262c8848816172cef550288e7dc6c7b7814b4ee56b3e1553f275f1858e" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "synstructure", -] - [[package]] name = "zerocopy" version = "0.8.52" @@ -2673,66 +2566,12 @@ dependencies = [ "syn", ] -[[package]] -name = "zerofrom" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ec05a11813ea801ff6d75110ad09cd0824ddba17dfe17128ea0d5f68e6c5272" -dependencies = [ - "zerofrom-derive", -] - -[[package]] -name = "zerofrom-derive" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11532158c46691caf0f2593ea8358fed6bbf68a0315e80aae9bd41fbade684a1" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "synstructure", -] - [[package]] name = "zeroize" version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e13c156562582aa81c60cb29407084cdb54c4164760106ab78e6c5b0858cf64e" -[[package]] -name = "zerotrie" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f9152d31db0792fa83f70fb2f83148effb5c1f5b8c7686c3459e361d9bc20bf" -dependencies = [ - "displaydoc", - "yoke", - "zerofrom", -] - -[[package]] -name = "zerovec" -version = "0.11.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90f911cbc359ab6af17377d242225f4d75119aec87ea711a880987b18cd7b239" -dependencies = [ - "yoke", - "zerofrom", - "zerovec-derive", -] - -[[package]] -name = "zerovec-derive" -version = "0.11.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "625dc425cab0dca6dc3c3319506e6593dcb08a9f387ea3b284dbd52a92c40555" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "zmij" version = "1.0.21" diff --git a/crates/rutster-trunk/tests/sim_integ.rs b/crates/rutster-trunk/tests/sim_integ.rs index 4c6833f..8d0de1f 100644 --- a/crates/rutster-trunk/tests/sim_integ.rs +++ b/crates/rutster-trunk/tests/sim_integ.rs @@ -330,19 +330,3 @@ async fn pstn_sim_synthetic_caller_drives_trunk_reflex_loop() { let _ = close_tx.send(()); let _ = tokio::time::timeout(Duration::from_secs(1), engine_handle).await; } - -/// Full end-to-end test using the binary's `MediaThread` + `RegisterTrunk`. -/// -/// This test is currently ignored because `rutster-trunk` integration tests -/// cannot depend on the `rutster` binary crate (`rutster` already depends on -/// `rutster-trunk`; Cargo disallows circular dev-dependencies). The active -/// `pstn_sim_synthetic_caller_drives_trunk_reflex_loop` above covers the FOB -// reflex loop + trunk-leg tick directly; this stub marks where the MediaThread -/// wiring test belongs once the binary crate is ready to exercise it. -#[ignore] -#[tokio::test] -async fn full_pstn_e2e_through_media_thread_register_trunk() { - // TODO: exercise MediaCmd::RegisterTrunk + MediaThread tick loop against a - // live TwilioMediaStreamsServer mock once the binary crate exposes a test - // harness from the appropriate crate. -} diff --git a/crates/rutster/tests/trunk_sim_e2e.rs b/crates/rutster/tests/trunk_sim_e2e.rs new file mode 100644 index 0000000..c4dc399 --- /dev/null +++ b/crates/rutster/tests/trunk_sim_e2e.rs @@ -0,0 +1,35 @@ +//! Full end-to-end PSTN sim via the binary's `MediaThread` + `RegisterTrunk`. +//! +//! This test was moved from `crates/rutster-trunk/tests/sim_integ.rs` because +//! `rutster-trunk` integration tests cannot depend on the `rutster` binary +//! crate (`rutster` already depends on `rutster-trunk`; Cargo disallows +//! circular dev-dependencies). The binary crate has access to +//! `MediaThread`, `MediaCmd::RegisterTrunk`, and `spawn_tap_engine` — the +//! full wiring surface the trunk crate's tests couldn't reach. +//! +//! The active `pstn_sim_synthetic_caller_drives_trunk_reflex_loop` in +//! `crates/rutster-trunk/tests/sim_integ.rs` covers the FOB reflex loop + +//! trunk-leg tick directly. This test extends that to exercise the binary's +//! `MediaThread` command channel + the `RegisterTrunk` spawn seam end-to-end. + +#[ignore = "requires MediaThread::RegisterTrunk wiring + MockTwilioMediaStreamsServer; not yet implemented in the binary crate's test harness"] +#[tokio::test] +async fn full_pstn_e2e_through_media_thread_register_trunk() { + // TODO: exercise MediaCmd::RegisterTrunk + MediaThread tick loop against a + // live TwilioMediaStreamsServer mock. The test should: + // 1. Start MockRealtimeBrain. + // 2. Spawn a MediaThread (from crates/rutster/src/media_thread.rs). + // 3. Construct a MockTwilioMediaStreamsServer that pushes synthetic loud + // PcmFrames into a RegisterTrunkInboundChannel. + // 4. Send MediaCmd::RegisterTrunk to the MediaThread. + // 5. Drive the 20ms tick loop for ~500ms. + // 6. Assert barge-in fired (ReflexMetrics.barge_in_count >= 1). + // 7. Assert brain reply observed on the outbound mpsc. + // 8. Assert idle timeout closes the session (ChannelState::Closed). + // + // This requires the binary crate's test harness to expose a way to + // construct a TrunkSession's pipe stack outside the normal axum route + // handler (or to drive the route handler in-process via axum's test + // `oneshot` pattern). Either path is feasible; pick the one that + // matches the existing `barge_in_integration.rs` harness pattern. +}