Skip to content

session: split pubsub into publish and subscribe files#25

Merged
floatdrop merged 1 commit into
draft-18from
session-split-pubsub
Jun 27, 2026
Merged

session: split pubsub into publish and subscribe files#25
floatdrop merged 1 commit into
draft-18from
session-split-pubsub

Conversation

@floatdrop

Copy link
Copy Markdown
Owner

What

Split pkg/moqt/session/pubsub.go by direction of the request flow:

  • publish.goPublication (struct + TrackAlias/OpenSubgroup/Done), Session.Publish, Session.OpenPublish.
  • subscribe.goSubscription (struct + TrackAlias/Update), Session.Subscribe.

Session.UpdateRequest lived in pubsub.go but is a generic request-stream operation — it's also called by fetch.go and track_status.go, not just Subscription.Update. It moved to request.go alongside 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 the TestOpenPublish_* tests.
  • subscribe_test.go — subscribe round-trip/rejected/ID-increment, duplicate-track-alias tests, TestRequestAcceptSubscribe, TestIncomingSubgroupStreamTrackKey, TestAcceptWrongType, and the context-cancel test.

The shared openPairWithLimits helper (used by both halves) moved to session_test.go next to openPair.

Pure code movement — no behavior change.

Verification

  • go build ./...
  • go test ./pkg/moqt/session/ — pass
  • golangci-lint run ./pkg/moqt/session/ — 0 issues

🤖 Generated with Claude Code

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>
@floatdrop floatdrop merged commit 68a1313 into draft-18 Jun 27, 2026
9 checks passed
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