Redesign setup for the deterministic fixture#2304
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request refactors the local_actor execution model to let the deterministic test fixture drive actors by calling consume directly (instead of going through resume), enabling the fixture to detect skipped messages and to manually dispatch scheduler jobs.
Changes:
- Introduces
local_actor::consumeand updates actor implementations/callers (scheduled actor, blocking actor, net actor shell, Qt widget, IO servants/managers) to use it. - Redesigns the deterministic fixture internals (global mailbox + job queue) and adds APIs/tests for dispatching messages and scheduled jobs deterministically.
- Adds supporting utilities and adjusts tests to validate skip behavior and the new fixture capabilities.
Reviewed changes
Copilot reviewed 26 out of 26 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| libcaf_test/caf/test/fixture/deterministic.hpp | Refactors the fixture API and internals (private data, dispatch APIs, evaluator refactor). |
| libcaf_test/caf/test/fixture/deterministic.cpp | Implements global mailbox/job queue, direct consume-driven dispatch, and scheduler integration. |
| libcaf_test/caf/test/fixture/deterministic.test.cpp | Adds coverage for manual job dispatch and skip-detection regression. |
| libcaf_core/caf/local_actor.hpp | Introduces consume_result and the consume(mailbox_element_ptr&) interface. |
| libcaf_core/caf/scheduled_actor.hpp / .cpp | Reworks message handling around consume, updates init/resume logic and metrics/finalization flow. |
| libcaf_core/caf/blocking_actor.hpp / .cpp | Adapts blocking actors to the new consume interface and refactors receive logic. |
| libcaf_net/caf/net/abstract_actor_shell.hpp / .cpp | Adds consume override and reuses it from the message loop. |
| libcaf_io/caf/io/* | Updates broker servants and network managers to drive brokers via consume and ensures context is set. |
| libcaf_core/caf/mixin/actor_widget.hpp | Switches Qt event delivery to set scheduler context + call consume. |
| libcaf_core/caf/intrusive_ptr_access.hpp / caf/intrusive_ptr.hpp | Extracts intrusive pointer refcount policy into a reusable header. |
| libcaf_core/caf/detail/sync_request_bouncer.* | Adds overload to bounce sync requests from mailbox_element_ptr. |
| libcaf_core/caf/detail/blocking_behavior.* / libcaf_core/CMakeLists.txt | Removes the old blocking behavior wrapper implementation. |
| libcaf_core/caf/*.test.cpp | Updates/extends tests for skip behavior and mailbox state expectations. |
| libcaf_core/caf/abstract_actor.hpp, caf/detail/behavior_stack.hpp | Minor API/tidy-ups to support refactor (e.g., is_terminated, noexcept). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #2304 +/- ##
==========================================
+ Coverage 72.86% 72.93% +0.06%
==========================================
Files 632 631 -1
Lines 30833 30843 +10
Branches 3318 3315 -3
==========================================
+ Hits 22466 22494 +28
+ Misses 6473 6461 -12
+ Partials 1894 1888 -6 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
8861351 to
8d035c3
Compare
8d035c3 to
9969dc3
Compare
c1eddcb to
d904364
Compare
Refactor the `local_actor` interface to allow the deterministic fixture to call `consume` directly instead of going through `resume`. This setup gives the fixture better control over actors and allows us to detect when an actor skips a message instead of processing it.
d904364 to
7dc01f5
Compare
Refactor the
local_actorinterface to allow the deterministic fixture to callconsumedirectly instead of going throughresume. This setup gives the fixture better control over actors and allows us to detect when an actor skips a message instead of processing.Closes #2095.