worker: write v2 envelopes with typed commands#4700
Draft
muhamadazmy wants to merge 1 commit into
Draft
Conversation
This was referenced May 7, 2026
9e6bfe2 to
c99555d
Compare
e68e277 to
94c8dfb
Compare
Contributor
Author
|
This is preparation work for v1.8. Should not be merged now: Note to self:
|
df8cd5c to
c908ab4
Compare
This was referenced May 12, 2026
a7b6e23 to
2e13782
Compare
Switch the worker's write path from the v1 Envelope/Command enum to v2
typed commands and Envelope<Raw>.
SelfProposer::{self_propose, self_propose_many, append_with_notification}
are now generic over `C: Command + HasRecordKeys` and derive the partition
key from the command via `record_keys()` — the explicit `partition_key`
parameter threaded through LeadershipState, the Actuator trait, and every
RPC handler is gone.
All worker RPC paths (append_invocation, append_invocation_response,
append_signal, cancel/kill/purge_invocation, purge_journal,
resume_invocation, restart_as_new_invocation, get_invocation_output) and
all leader-side ActionEffect proposals (Invoker, Shuffle, Timer, Cleaner,
UpsertSchema, UpsertRuleBook, scheduler decisions, version barriers,
AnnounceLeader) now construct typed commands::*Command values directly,
removing the Command::* enum wrapping and the BytesMut arena previously
used to pre-encode scheduler decisions.
With v2 envelopes now being written, drop the `try_v1_first` branch in
PartitionProcessor::decode_record — v2 is the fast path and v1 stays as
the TypedValueMismatch fallback for replay of older records. Tests under
leadership and rpc are updated to mock the new generic Actuator signatures
and decode via Envelope<Raw>::into_typed::<commands::*>().
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
worker: write v2 envelopes with typed commands
Switch the worker's write path from the v1 Envelope/Command enum to v2
typed commands and Envelope.
SelfProposer::{self_propose, self_propose_many, append_with_notification}
are now generic over
C: Command + HasRecordKeysand derive the partitionkey from the command via
record_keys()— the explicitpartition_keyparameter threaded through LeadershipState, the Actuator trait, and every
RPC handler is gone.
All worker RPC paths (append_invocation, append_invocation_response,
append_signal, cancel/kill/purge_invocation, purge_journal,
resume_invocation, restart_as_new_invocation, get_invocation_output) and
all leader-side ActionEffect proposals (Invoker, Shuffle, Timer, Cleaner,
UpsertSchema, UpsertRuleBook, scheduler decisions, version barriers,
AnnounceLeader) now construct typed commands::Command values directly,
removing the Command:: enum wrapping and the BytesMut arena previously
used to pre-encode scheduler decisions.
With v2 envelopes now being written, drop the
try_v1_firstbranch inPartitionProcessor::decode_record — v2 is the fast path and v1 stays as
the TypedValueMismatch fallback for replay of older records. Tests under
leadership and rpc are updated to mock the new generic Actuator signatures
and decode via Envelope::into_typed::commands::*().