Skip to content

Redesign setup for the deterministic fixture#2304

Merged
Neverlord merged 1 commit intomainfrom
issue/2095-fail-expect-on-skipped-messages
Apr 17, 2026
Merged

Redesign setup for the deterministic fixture#2304
Neverlord merged 1 commit intomainfrom
issue/2095-fail-expect-on-skipped-messages

Conversation

@Neverlord
Copy link
Copy Markdown
Member

@Neverlord Neverlord commented Mar 24, 2026

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.

Closes #2095.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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::consume and 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.

Comment thread libcaf_core/caf/scheduled_actor.cpp Outdated
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 24, 2026

Codecov Report

❌ Patch coverage is 67.95367% with 83 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.93%. Comparing base (551937c) to head (7dc01f5).
⚠️ Report is 30 commits behind head on main.

Files with missing lines Patch % Lines
libcaf_core/caf/scheduled_actor.cpp 61.79% 27 Missing and 7 partials ⚠️
libcaf_net/caf/net/abstract_actor_shell.cpp 58.33% 7 Missing and 3 partials ⚠️
libcaf_core/caf/blocking_actor.cpp 82.69% 7 Missing and 2 partials ⚠️
libcaf_io/caf/io/datagram_servant.cpp 0.00% 8 Missing ⚠️
libcaf_io/caf/io/scribe.cpp 25.00% 5 Missing and 1 partial ⚠️
libcaf_io/caf/io/broker_servant.hpp 75.00% 4 Missing and 1 partial ⚠️
libcaf_io/caf/io/network/manager.cpp 57.14% 3 Missing ⚠️
libcaf_core/caf/actor_system.cpp 0.00% 2 Missing ⚠️
libcaf_core/caf/blocking_actor.hpp 81.81% 2 Missing ⚠️
libcaf_core/caf/rebindable_predicate.hpp 92.00% 1 Missing and 1 partial ⚠️
... and 2 more
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Neverlord Neverlord force-pushed the issue/2095-fail-expect-on-skipped-messages branch from 8861351 to 8d035c3 Compare March 24, 2026 15:22
@Neverlord Neverlord requested a review from Copilot March 24, 2026 15:41

This comment was marked as outdated.

@Neverlord Neverlord force-pushed the issue/2095-fail-expect-on-skipped-messages branch from 8d035c3 to 9969dc3 Compare April 6, 2026 08:19
@Neverlord Neverlord force-pushed the issue/2095-fail-expect-on-skipped-messages branch 2 times, most recently from c1eddcb to d904364 Compare April 13, 2026 11:44
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.
@Neverlord Neverlord force-pushed the issue/2095-fail-expect-on-skipped-messages branch from d904364 to 7dc01f5 Compare April 13, 2026 11:47
@Neverlord Neverlord marked this pull request as ready for review April 14, 2026 18:24
@Neverlord Neverlord requested a review from riemass April 14, 2026 18:24
@Neverlord Neverlord merged commit f458170 into main Apr 17, 2026
15 checks passed
@Neverlord Neverlord deleted the issue/2095-fail-expect-on-skipped-messages branch April 17, 2026 06:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

expect should fail if actor leaves message in mailbox

3 participants