Skip to content

[worker][refactor] change rpc handlers to return their next steps instead of taking actions inline#5043

Open
MohamedBassem wants to merge 1 commit into
mainfrom
pr5043
Open

[worker][refactor] change rpc handlers to return their next steps instead of taking actions inline#5043
MohamedBassem wants to merge 1 commit into
mainfrom
pr5043

Conversation

@MohamedBassem

@MohamedBassem MohamedBassem commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

As part of the work on centeralizes writes to the self proposer inside one scheduler, this PR refactors the RPC handlers to return their decisions to the main PP loop where they get executed there. This is in prep for shipping the proposals to a channel in the next PR.

This PR is mostly mechanical and does the following:

  1. Changes the handlers to no longer take the "Actuator" trait and instead return their Decision from the function.
  2. The decision can be either: Propose a command (with its different modes), reply now, or the pre-vqueues invoker poking.

Tests are much simpler as they no longer need to mock the leadership state. Only meaningful change was a bug in the restart_as_new test copy_prefix_zero_with_no_version_uses_service_invocation_command where it was using the default patch_deployment_id and it didn't actually hit the assertions inside the mock handlers as it was failing with CannotPatchDeploymentId. The tests where not setting expectations on num calls to the mock, so it didn't fail when the call to append_and_respond_asynchronously didn't happen. So this was fixed along the way by using PatchDeploymentId::PinToLatest to hit the correct assertions. This PR anyways removes mockall altogether from that worker crate.


Stack created with Sapling. Best reviewed with ReviewStack.

@github-actions

github-actions Bot commented Jul 15, 2026

Copy link
Copy Markdown

Test Results

  8 files  ±0    8 suites  ±0   5m 1s ⏱️ -1s
 61 tests ±0   61 ✅ ±0  0 💤 ±0  0 ❌ ±0 
268 runs  ±0  268 ✅ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit 77f7f50. ± Comparison against base commit 47c66b3.

♻️ This comment has been updated with latest results.

@MohamedBassem
MohamedBassem force-pushed the pr5043 branch 6 times, most recently from c27728d to 894af8b Compare July 15, 2026 11:39
@MohamedBassem
MohamedBassem marked this pull request as ready for review July 15, 2026 11:39
…tead of taking actions inline

As part of the work on centeralizes writes to the self proposer inside one scheduler, this PR refactors the RPC handlers to return their decisions to the main PP loop where they get executed there. This is in prep for shipping the proposals to a channel in the next PR.

This PR is mostly mechanical and does the following:
1. Changes the handlers to no longer take the "Actuator" trait and instead return their `Decision` from the function.
2. The decision can be either: Propose a command (with its different modes), reply now, or the pre-vqueues invoker poking.

Tests are much simpler as they no longer need to mock the leadership state. Only meaningful change was a bug in the restart_as_new test `copy_prefix_zero_with_no_version_uses_service_invocation_command` where it was using the default `patch_deployment_id` and it didn't actually hit the assertions inside the mock handlers as it was failing with `CannotPatchDeploymentId`. The tests where not setting expectations on num calls to the mock, so it didn't fail when the call to `append_and_respond_asynchronously` didn't happen. So this was fixed along the way by using `PatchDeploymentId::PinToLatest` to hit the correct assertions. This PR anyways removes `mockall` altogether from that worker crate.
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.

1 participant