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 2 commits into
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
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 (1)
WalkthroughA shared ChangesJoinSet Error Handling in Test Utilities
Sequence DiagramsequenceDiagram
participant ctx
participant MessagePool
participant JoinSet
participant drain_task
ctx->>JoinSet: create JoinSet<anyhow::Result<()>>
ctx->>MessagePool: MessagePool::new(&mut JoinSet)
ctx->>JoinSet: abort_all()
ctx->>drain_task: spawn drain_mpool_services(JoinSet)
drain_task->>JoinSet: join_next() loop
JoinSet-->>drain_task: Result (Ok / Err / Cancelled)
drain_task->>drain_task: log warnings for Err and panic, ignore Cancelled
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested reviewers
🚥 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 |
|
Seems to timeout the tests. Please first assert locally that it works. |
c0581cb to
63bad6a
Compare
|
Hey, thanks for catching that — local repro confirmed your concern. With just the detached Pushed a follow-up: Locally: No |
63a18e4 to
6309c54
Compare
6309c54 to
70c7855
Compare
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
70c7855 to
85a3703
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files
... and 5 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
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