refactor(container-runtime): Separate types LocalBatchMessage v. OutboundBatchMessage in Outbox and related code#24287
Merged
markfields merged 15 commits intomicrosoft:mainfrom Apr 9, 2025
Conversation
with LocalContainerRuntimeMessage
i.e. the change from serializedOp to viableOp
Do we need to copy or could update inline?
MarioJGMsoft
reviewed
Apr 9, 2025
MarioJGMsoft
reviewed
Apr 9, 2025
kian-thompson
approved these changes
Apr 9, 2025
Contributor
kian-thompson
left a comment
There was a problem hiding this comment.
Love making typing more explicit
| resubmittingBatchId: string, | ||
| referenceSequenceNumber: number, | ||
| ): IBatch<[BatchMessage]> { | ||
| ): { outboundBatch: OutboundSingletonBatch; placeholderMessage: OutboundBatchMessage } { |
Contributor
There was a problem hiding this comment.
nit: Not a huge fan of this return pattern since placeholderMessage is contained in outboundBatch as well
Member
Author
There was a problem hiding this comment.
Yeah I see it too. But I didn't find a way to extract it that I was happy with. Empty Batches are janky, so I let it go.
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.
Description
This is almost entirely a glorified "rename", splitting the type
BatchMessageinto two cases:LocalBatchMessageandOutboundBatchMessage, converting between the two when necessary.Context
As ops are accumulated into a batch in the ContainerRuntime, they're currently serialized immediately. However, we plan to keep those unserialized, and only stringify when virtualizing (grouping, compressing) in preparation to send to the server. See #24281.
This is the first step there. We should model pre/post virtualized batches differently because they are different. pre-virtualization batch messages are called
LocalBatchMessageand post-virtualization are calledOutboundBatchMessage.Reviewer Guidance
The intention is to change no behavior with this PR. Here are the non-typing changes (that affect runtime code):
contentstoserializedOpfor the Local batch caseOutbox.virtualizeBatchto convert fromLocalBatchtoOutboundBatch.serializedOpover tocontents, which paves the way forserializedOpto stop being serialized in the next PR, which is the end goal herecreateEmptyGroupedBatchto support both Local/Outbound forms