feat: record a subscribe issued with no attached Transport - #429
Merged
diegolmello merged 15 commits intoSep 1, 2026
Merged
diegolmello merged 15 commits into
diegolmello merged 15 commits into
Conversation
A subscribe made while the Socket holds no attached Transport is recorded instead of dropped, and issued by subscribeAll once a Transport is attached. Closes #424
…ubscribe-issued-with-no-transport-attache # Conflicts: # lib/drivers/__tests__/ddpSubscriptions.spec.ts
diegolmello
deleted the
diegolmello/fix-a-subscribe-issued-with-no-transport-attache
branch
September 1, 2026 14:36
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.
Proposed changes
A
subscribeissued while the Socket holds no attached Transport is now recorded instead of silently dropped. The discriminator is attachment, and only attachment: whether the Socket held an attached Transport at the moment of the send. Nosubframe is composed, the entry is the instruction, andsubscribeAllissues it once a Transport is attached. A Transport that is attached but never opened is unchanged, and so is the Socket's own refusal to send, which is not on this path.The mechanism is one injected predicate on
DDPSubscriptions,isOffline, alongside the existing close-generation thunk, wired by the Socket to report that it holds no attached Transport and that no close owns it.Built on that rule:
unsubscribewith no attached Transport forgets the entry locally and resolves, sending nothing. An unknown id still rejects; the connected path is unchanged.Socket.logoutwith no attached Transport and no close taken forgets every entry and clears the stored Login before resolving, so the next user does not inherit the previous user's streams. The close-owned branch still rejects and touches nothing.falsewith no attached Transport:resubscribeWhenRecordedreads the same predicate and does not attempt, letting its Deadline resolvefalse. Without this a handle would read as acknowledgement and the gate would report ready with no connection.unsubscribethat never enters the wire.CONTEXT.mdgains Offline sub, cited from theDDP subscriptionentry.Consumer-visible log string change:
[ddp] Subscribe not acknowledgedis now[ddp] Subscribe not recorded.A handle for an Offline sub names a stream that was never on the wire, and nothing in the Driver contract distinguishes it from one the server acknowledged.
Closes #424
Closes #425
Closes #426
Closes #427
Closes #428
Steps to reproduce
subframe reaches the wireunsubscribethat subscription: it resolves, the entry is forgotten, and a later Login sends nothing for itlogout: every entry and the stored Login are gonewaitForNotifyUserMediaSubs: it resolvesfalseand sends nothingTests
subframeSocket.close()still forgets every entry, including thesesubstill leaves no entry; an Abandoned sub still keeps its entry; a wait that expired on an attached Transport still leaves no entrymethodcall with no Transport attached is still refused immediatelyisOfflineon theDDPSubscriptionsharness, with the option required rather than defaultedunsubscribewith no attached Transport forgets the entry, resolves, and sends nothing; an unrecorded id still rejectsunsubscribewith no attached Transport leaves nothing for a later Login'ssubscribeAlllogouton a never-connected Socket forgets every entry and clears the stored Login; the close-owned branch still rejects and touches nothingfalsewith no Transport attached while both media entries are recorded, and sends no frameresubscribeWhenRecordedsends nothing and resolvesfalsewith nothing attached while entries are present