Skip to content

feat(session): round out accept-side request helpers#33

Merged
floatdrop merged 2 commits into
draft-18from
feat/accept-side-symmetry
Jun 29, 2026
Merged

feat(session): round out accept-side request helpers#33
floatdrop merged 2 commits into
draft-18from
feat/accept-side-symmetry

Conversation

@floatdrop

Copy link
Copy Markdown
Owner

What

The accept side of the request API was asymmetric: AcceptSubscribe returned a rich *Publication, AcceptPublish returned a bare error, and Fetch / TrackStatus / the three namespace requests had no Accept* helper at all (servers hand-rolled req.Reply). This rounds the set out so every outbound opener has a matching, typed accept-side counterpart.

Outbound Accept-side (new/changed) Handle
Subscribe*Subscription AcceptSubscribe (unchanged) *Publication
Publish*Publication AcceptPublish *IncomingPublication (TrackAlias, Update)
Fetch*FetchRequest AcceptFetch *FetchResponder (OpenFetchStream, Request ID pre-bound)
TrackStatus*TrackStatusRequest AcceptTrackStatus — (one-shot, documented)
PublishNamespace*NamespacePublication AcceptPublishNamespace *IncomingNamespacePublication
SubscribeNamespace*NamespaceSubscription AcceptSubscribeNamespace *IncomingNamespaceSubscription
SubscribeTracks*TrackSubscription AcceptSubscribeTracks *IncomingTrackSubscription (WritePublishBlocked)

Highlights:

  • AcceptPublish now returns *IncomingPublication (was bare error) — the receiving side of a publisher push, with TrackAlias() and Update().
  • AcceptFetch writes FETCH_OK and returns a responder whose OpenFetchStream() binds the fetch's Request ID onto the FETCH_HEADER uni-stream automatically — mirroring how AcceptSubscribe's Publication.OpenSubgroup pre-binds the alias.
  • AcceptSubscribeTracks' handle has WritePublishBlocked, the publisher-side mirror of TrackSubscription.ReadPublishBlocked.
  • AcceptTrackStatus deliberately returns no handle (TRACK_STATUS is a one-shot status query with no object-push side) — documented, not left as an arbitrary gap.

The Incoming* names follow the package's existing convention for the receive/accept side (IncomingSubgroupStream, IncomingFetchStream).

Testing

  • New accept_test.go: round-trips for each helper, including a full FETCH OpenFetchStream exchange (asserting the bound Request ID) and a WritePublishBlockedReadPublishBlocked exchange. The streaming tests run the server side in a goroutine and read on the client in send order, since the sessiontest pipes are synchronous (a deadlock here was caught by go test ./... and fixed).
  • Updated the AcceptPublish callers/example for the new signature; added a README row.
  • go build ./..., full go test ./... (every package ok), golangci-lint run, and the modernize check — all clean.

🤖 Generated with Claude Code

floatdrop and others added 2 commits June 29, 2026 07:47
Every outbound request opener now has a matching Accept* counterpart, so a
server gets the same typed-handle ergonomics AcceptSubscribe already gave:

  - AcceptPublish now returns *IncomingPublication (TrackAlias, Update)
    instead of bare error — the receiving side of a publisher push.
  - AcceptFetch writes FETCH_OK and returns *FetchResponder, whose
    OpenFetchStream binds the fetch's Request ID onto the FETCH_HEADER
    uni-stream automatically.
  - AcceptTrackStatus writes TRACK_STATUS_OK. It returns no handle by
    design (TRACK_STATUS is a one-shot status query with no push side);
    this is documented rather than left as an arbitrary asymmetry.
  - AcceptPublishNamespace / AcceptSubscribeNamespace / AcceptSubscribeTracks
    write REQUEST_OK and return *IncomingNamespacePublication /
    *IncomingNamespaceSubscription / *IncomingTrackSubscription. The last
    carries WritePublishBlocked, mirroring TrackSubscription.ReadPublishBlocked.

Adds accept_test.go (round-trips incl. a FETCH stream and a PUBLISH_BLOCKED
exchange), updates the AcceptPublish callers/example, and adds a README row.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The README "Examples" table maps each topic to a real, compile-checked
Example function; the accept-side row instead listed bare method names,
which is neither an example nor verified. Extend ExampleSession_AcceptRequest
to dispatch and answer every request type via its Accept* helper (adding the
TrackStatus and namespace cases) and point the single "Accept requests" row
at it, dropping the off-convention method list.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@floatdrop floatdrop merged commit d49a924 into draft-18 Jun 29, 2026
9 checks passed
@floatdrop floatdrop deleted the feat/accept-side-symmetry branch June 29, 2026 12:33
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