session: split pubsub into publish and subscribe files#25
Merged
Conversation
pubsub.go mixed both directions of the request flow. Split it by direction: publish.go owns Publication + Publish/OpenPublish, subscribe.go owns Subscription + Subscribe. UpdateRequest was in pubsub.go but is a generic request-stream operation (also used by fetch.go and track_status.go), so move it to request.go alongside the rest of the request-stream plumbing rather than into either half. Split the tests the same way (publish_test.go / subscribe_test.go) and move the shared openPairWithLimits helper to session_test.go next to openPair. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
What
Split
pkg/moqt/session/pubsub.goby direction of the request flow:publish.go—Publication(struct +TrackAlias/OpenSubgroup/Done),Session.Publish,Session.OpenPublish.subscribe.go—Subscription(struct +TrackAlias/Update),Session.Subscribe.Session.UpdateRequestlived inpubsub.gobut is a generic request-stream operation — it's also called byfetch.goandtrack_status.go, not justSubscription.Update. It moved torequest.goalongside the rest of the request-stream plumbing rather than into either half.Tests
Split the same way:
publish_test.go— publish round-trip/rejected/PublicationDone,TestRequestAcceptPublish, and theTestOpenPublish_*tests.subscribe_test.go— subscribe round-trip/rejected/ID-increment, duplicate-track-alias tests,TestRequestAcceptSubscribe,TestIncomingSubgroupStreamTrackKey,TestAcceptWrongType, and the context-cancel test.The shared
openPairWithLimitshelper (used by both halves) moved tosession_test.gonext toopenPair.Pure code movement — no behavior change.
Verification
go build ./...go test ./pkg/moqt/session/— passgolangci-lint run ./pkg/moqt/session/— 0 issues🤖 Generated with Claude Code