Skip to content

worker: write v2 envelopes with typed commands#4700

Draft
muhamadazmy wants to merge 1 commit into
mainfrom
pr4700
Draft

worker: write v2 envelopes with typed commands#4700
muhamadazmy wants to merge 1 commit into
mainfrom
pr4700

Conversation

@muhamadazmy
Copy link
Copy Markdown
Contributor

@muhamadazmy muhamadazmy commented May 7, 2026

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 + 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::into_typed::commands::*().

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 7, 2026

Test Results

  8 files  ±0    8 suites  ±0   4m 53s ⏱️ +5s
 50 tests ±0   50 ✅ ±0  0 💤 ±0  0 ❌ ±0 
218 runs  ±0  218 ✅ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit 8032ac8. ± Comparison against base commit d0aa1be.

♻️ This comment has been updated with latest results.

@muhamadazmy muhamadazmy force-pushed the pr4700 branch 15 times, most recently from 9e6bfe2 to c99555d Compare May 10, 2026 16:14
@muhamadazmy muhamadazmy changed the title wip: write v2 envelope wal-protocol: rename Record→Command and unify payload types May 10, 2026
@muhamadazmy muhamadazmy changed the title wal-protocol: rename Record→Command and unify payload types worker: write v2 envelopes with typed commands May 10, 2026
@muhamadazmy muhamadazmy force-pushed the pr4700 branch 6 times, most recently from e68e277 to 94c8dfb Compare May 11, 2026 09:43
@muhamadazmy
Copy link
Copy Markdown
Contributor Author

This is preparation work for v1.8. Should not be merged now:

Note to self:

  • kafka ingress should also start ingesting v2 envelopes.

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::*>().
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