Make mux the source of truth for virtual channel prefix layout#63
Merged
Make mux the source of truth for virtual channel prefix layout#63
Conversation
added 2 commits
April 29, 2026 18:04
VirtualChannel already forwards SlotSize/NumSlots/GetFds to its mux because storage is owned by the mux, but it did not forward ChecksumSize, MetadataSize, or PrefixSize. As a result, HandleCreatePublisher's SetChecksumSize/ SetMetadataSize/SetPrefixSize calls landed on the virtual channel only, the consistency check at the same site validated against per-vchan fields, and HandleCreateSubscriber returned the virtual channel's (often default) sizes. Two virtual channels on the same mux could silently disagree on prefix layout while sharing storage. Mark the cs/ms/ps accessors and setters virtual on Channel and override them on VirtualChannel to delegate to the mux. Now the existing consistency check naturally rejects mismatched layouts across vchans on a mux, subscribers always receive the mux's authoritative sizes, and writes from any vchan handle update the shared mux. Made-with: Cursor
VirtualChannelMuxPrefixIsShared verifies that a publisher's checksum_size and metadata_size on one virtual channel propagate to the mux, that a subscriber on a sibling vchan sees those sizes (not the per-vchan defaults), that a matching second publisher on a sibling vchan succeeds, and that mismatched cs/ms on another sibling vchan is rejected. VirtualChannelMuxPrefixSubscriberFirst covers the placeholder-mux path: a subscriber creates the mux and a vchan first, then a publisher with non-default cs/ms arrives, and a subsequent subscriber on a sibling vchan sees the publisher's authoritative sizes via the mux. Both tests fail on the previous code (sibling vchans report PrefixSize=64 default) and pass after the layout-forwarding fix. Made-with: Cursor
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.
VirtualChannel already forwards SlotSize/NumSlots/GetFds to its mux because storage is owned by the mux, but it did not forward ChecksumSize, MetadataSize, or PrefixSize. As a result, HandleCreatePublisher's SetChecksumSize/ SetMetadataSize/SetPrefixSize calls landed on the virtual channel only, the consistency check at the same site validated against per-vchan fields, and HandleCreateSubscriber returned the virtual channel's (often default) sizes. Two virtual channels on the same mux could silently disagree on prefix layout while sharing storage.
Mark the cs/ms/ps accessors and setters virtual on Channel and override them on VirtualChannel to delegate to the mux. Now the existing consistency check naturally rejects mismatched layouts across vchans on a mux, subscribers always receive the mux's authoritative sizes, and writes from any vchan handle update the shared mux.
Made-with: Cursor