fix(tool): surface MessagePool service task errors in api_cmd test ctx#6966
fix(tool): surface MessagePool service task errors in api_cmd test ctx#69660xDevNinja wants to merge 1 commit intoChainSafe:mainfrom
Conversation
Both `test_snapshot::ctx` and `generate_test_snapshot::ctx` passed `&mut JoinSet::new()` to `MessagePool::new`. The temporary was dropped on return, aborting every service task spawned by the pool and silently swallowing any error they emitted pre-cancellation. Own the `JoinSet` locally and move it into a detached `tokio::spawn` that drains it with the canonical `while let Some(result) = services.join_next().await` loop from `daemon/mod.rs::propagate_error`, logging errors and non-cancel panics via `tracing::warn!`. Detaching (vs. awaiting inline) avoids the codecov-timeout regression that caused the earlier attempt to be reverted in ChainSafe#6493: the mpool services are long-lived and would never complete the inline await. Refs ChainSafe#6505
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
WalkthroughThese changes ensure that background JoinSet task results in test utility functions are properly handled instead of being silently dropped. A new Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
✨ Simplify code
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary of changes
Changes introduced in this pull request:
JoinSetintest_snapshot::ctxandgenerate_test_snapshot::ctxinstead of passing&mut JoinSet::new()intoMessagePool::new. The inline temporary was dropped on return, aborting every spawned mpool service task and silently swallowing any errors they emitted pre-cancellation.JoinSetinto a detachedtokio::spawn(drain_mpool_services(...))that drains it with the canonicalwhile let Some(result) = services.join_next().awaitloop fromdaemon/mod.rs::propagate_error, logging errors and non-cancel panics viatracing::warn!.drain_mpool_serviceshelper intest_snapshot.rs(visibilitypub(super)) and call it from bothctx()sites.Detaching (vs. awaiting inline) is deliberate: the mpool services are long-lived, so an inline
while let Some(...)would never return — that is precisely what caused codecov CI to time out and led to the earlier attempt being reverted from #6493. A detached drainer surfaces errors without blocking the caller.Reference issue to close (if applicable)
Closes #6505
Other information and links
src/daemon/mod.rs:842-851(propagate_error).MessagePool::newsignature confirmed atsrc/message_pool/msgpool/msg_pool.rs:~721— takesservices: &mut JoinSet<anyhow::Result<()>>, which matches the generic used here.start_rpc#6493.CHANGELOG.mdentry — this is an internal test utility change and is not user-facing per the changelog guide at the top of that file.tracing); asserting on log output would be flaky. Existingrpc_regression_tests_print_uncoveredpasses locally; the heavier regression harness defers to CI.Change checklist
Outside contributions
AI Usage Disclosure
This PR was prepared with assistance from Claude Code (Anthropic). Extent:
cargo fmt --all -- --check,cargo clippy --all-targets --no-deps -- -D warnings(withFOREST_F3_SIDECAR_FFI_BUILD_OPT_OUT=1),cargo check --lib --tests, andcargo test --lib rpc_regression_tests_print_uncovered(1/1 pass) all green.Summary by CodeRabbit