Cleanup: trim draft-20 comments, consolidate tests (no behaviour change) - #101
Merged
Merged
Conversation
Shorten the comments added by the draft-20 compliance work: drop long spec quotations, repeated quotes and restatements of the code, keeping doc contracts, one-line § citations, and the marked interpretations (Range Filter scope, repeated Immutable Properties, filter replacement by type). Comment-only; no code change. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Shorten doc comments on the draft-20 compliance additions in pkg/moqt/session to what a caller must know, cut long and repeated spec quotations to section citations, and drop history and restated code. Spec interpretations stay marked. Comment-only; the other changes are gofmt field alignment. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Comment-only change in pkg/relay non-test files. It drops history narratives, restatements of the code and long or repeated spec quotations. What stays: exported contracts (including DiscoveryStore), one-line § citations, lock and ordering invariants, and marked spec interpretations. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Move shared helpers (session openers, closeRecorder, handRolledSetup, requireClosedProtocolViolation, requireStaysOpen, subscribePair, ...) into helpers_test.go, replacing seven near-identical handshake helpers and two close-recording conns. Fold one-fix files into topical ones: handshake_test.go (PATH/AUTHORITY, GREASE, early data streams), malformed_test.go, request_reject_test.go, request_ok_properties_test.go, setup_token_test.go, fetch_test.go, broker_test.go, session_test.go. Table-drive near-copies (FIN mid-object, TRACK_STATUS follow-ups, FETCH_OK End before Start, param-scope openers, PATH/AUTHORITY send refusals) and trim comments to purpose plus section citation. Test-only; every test keeps its assertions and timeouts. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…cal files Move the immutable-search and object-properties tests into properties_test.go and the range-filter update tests into rangefilter_eval_test.go, share the property builders, and trim history from test comments. Test-only. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Test-only. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Add helpers_test.go with ns() and stubStream, embed the stub in the test streams, factor the repeated answered-SUBSCRIBE setup, move the queue reset test into namespace_test.go, cite §5.1 for the single SUBSCRIBE response, and trim comments. Test-only. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The descending case now also inserts out of order. Test-only. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Test-only. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Shared helpers move to helpers_test.go and the relay harness (pipeListener,
connectRelay, dialAnotherClient, dialRaw) to harness_test.go. Near-duplicates
merge into one helper each:
- publishing: publishVideoTrack/publishVideoTrackProps/publish, with
newCam1Publisher for the relay-plus-publisher fixture (was
publishWithTrackProps, publishTrack, publishWithProps, publishSecondCam1);
- Objects: writeSubgroup/publishObjects/sendObjects (was sendObject,
publishSubgroupObject, publishOneSubgroup, publishObjects);
- subscribing: subscribeCam1 on a given session and newCam1Subscriber for a
new client (was subscribeCam1Req/subscribeCam1); one subscribeTracks
(was subscribeTracks/openSubscribeTracks);
- FETCH: tryFetchElems/collectFetchElems over one readFetchResponse, also
used by fetchStitched (tryStitchFetch/collectFetchGroups removed);
- drainAll replaces drainAllStreams; ns() replaces videoNS, nsFields and the
wire.TrackNamespace{[]byte(...)} literals; requireSessionClosed replaces
the inline Done()/2s selects; slices/maps replace equalIDs/sortedKeys.
The one-fix files from the draft-20 compliance work fold into topical ones:
subscribe_tracks, malformed_track, cache, publish_done, forward_state,
request_stream, data_stream, track_status, rangefilter_relay,
session_update, session_namespace and relay_upstream.
TestRelay_MaxCacheDurationExpiresCachedObject and
TestRelay_MaxCacheDurationZeroNeverServesFromCache become the subtests of
TestRelay_MaxCacheDurationNotServedFromCache. No other test is removed or
changes what it asserts; no production code changes.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Test doc comments shrink to a line or two of purpose plus the § citation; history narratives and long spec quotations go. Citations the review flagged are corrected: multi-publisher dedup is §9.3, UPDATE_FAILED is §10.9.1, and §9.5/§10.7 are no longer cited for claims they do not make. Near-copies become tables: - TestRelay_AuthDenialUsesPolicyCode replaces the six per-request *_AuthDenialUsesPolicyCode tests (SUBSCRIBE, FETCH, TRACK_STATUS, PUBLISH_NAMESPACE, SUBSCRIBE_NAMESPACE, SUBSCRIBE_TRACKS); - TestSessionHandler_TokenVerification replaces TokenDenialMapsToRequestError and TokenAllowReachesHandler (token_verify_test.go is folded into session_handler_test.go). Each keeps its assertions as a subtest. FETCH helpers move to helpers_fetch_test.go to keep helpers_test.go small; every helper has a doc comment; locsEqual, the discovery import sentinel and a hand-rolled clone/search give way to slices. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…cts and invariants
From the moqt-reviewer pass over the cleanup branch (comment lines only):
- Restore the "Assumption:" on RegisterInboundTrack: the draft does not
say which Track Properties a shared alias carries (the trim had
presented the repo's choice as §2.5).
- Restore two exported-API details: OpenPublish's caller allocates the
alias, and AcceptPublish's refusal codes (UNSUPPORTED_EXTENSION for an
unknown Mandatory Track Property, MALFORMED_TRACK for unparseable
properties).
- Restore four invariants the code does not show:
- why the relay's upstream sub is set to Forward=0;
- the trackKnown coupling for the eagerly created entry;
- RunWriter taking one message at a time for the queue bound;
- why UpdatePrefix's old-prefix lookup is exact.
- Citations:
- the remaining omitted-FORWARD §10.7 → §10.2.18;
- multi-publisher dedup and redundant upstreams §9.5 → §9.3, matching
the tests;
- the §5.1.5 quote corrected.
- §11.4.3: mark the relay's use of only "one greater than the previous
Object" as a choice among the draft's three next-Object tests.
- Fix a stale [subgroupWriter.join] link, and reflow three overlong
comment lines.
Co-Authored-By: Claude Opus 5.5 (1M context) <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.
A cleanup pass over the draft-20 compliance work (#95–#100), which added about 17k lines: 11k of tests and 6k of production code, 38% of that comments. There is no behaviour or API change:
.gofiles change only in comments, plus two gofmt field re-alignments;Net result: 196 files changed, about 4,400 fewer lines.
Production comments (aggressive trim, as decided)
7ec6c2amessage, wire, uriea63596session2b6805drelay: handlers, registry, cache, discoveryWhat was kept:
//nolintreasons.History narratives, restatements of the code, and long or repeated spec quotations were removed.
Production Go: 2,849 lines removed, 1,268 added.
Tests
6260ea3session:helpers_test.go(a single handshake helper, one close-code recorder, shared stubs);9abdcc4message,2a1cef5wire,2ea4f6eregistry,c2e4437cache,8338605discovery: shared helpers, folded files,slices.Equal/ generic receive helpers.80352cc,d99dc81relay:harness_test.go,helpers_test.goandhelpers_fetch_test.go;Tests: 9,995 lines removed, 7,184 added, and 209 test files down to 185.
Nothing lost. I ran the full suite on the base and on this branch:
t.Parallel()kept.A few helpers are stricter than before:
Closeerrors and failed accepts now fail the test.Review follow-ups (
c41519d)A moqt-reviewer pass over the whole branch found no wire-behaviour change and no weakened test. The comment fixes it prompted:
RegisterInboundTrack(which Track Properties a shared alias keeps);OpenPublishcallers allocate the alias, andAcceptPublish's refusal codes;Not in this PR
session_pubsub,handler_fanout,cross_relay,datastream_object). They were trimmed but not split.TestTrackStatus_ReplyForKnownTrackpasses vacuously if its FETCH is refused. This predates the cleanup.Testing
go build,go vet,golangci-lint: clean.go test ./...and-raceon session and relay: pass.make bench-quick: allocs/op at the baseline.make interop-loopback: 6/6 on raw QUIC and on WebTransport.🤖 Generated with Claude Code