fix(transport): target resource update notifications - #101
ContextVM-org merged 7 commits into
Conversation
eed4e06 to
f2146be
Compare
|
@Anand-0037 subscriptions survive a probe-timeout session removal. The new cleanup runs in the LRU eviction callback, but a stream probe timeout removes the session directly, bypassing that callback. I reproduced a removed session whose URI still lists the client as a subscriber. If that pubkey establishes a new session, it can receive resource updates without subscribing again. I think you should clear subscriptions on this removal path and add a timeout/reconnect test. |
|
Thanks, I missed the direct session removal in the probe-timeout path. I've cleared subscriptions there and added a regression for reconnecting with the same key; resource updates are no longer delivered until the client subscribes again. |
|
@Anand-0037 Parent resource subscriptions miss valid sub-resource updates. The broadcaster performs an exact URI lookup, but MCP allows an update URI to identify a sub-resource of the subscribed URI. See the official MCP schema. I reproduced this case:
I recommend fixing the finding before merge. |
|
@1amKhush Fixed in |
|
@ContextVM-org Lgtm for merge |
…ests Maintainer follow-up on review of ContextVM#101 (issue ContextVM#52): - Record resources/subscribe and resources/unsubscribe only after the request is actually forwarded to the MCP server (dispatch terminal). A middleware-swallowed or failed request no longer leaves phantom subscription state behind, and a dropped unsubscribe can no longer re-add a subscription that never existed. - Clear a client's subscriptions when authorization rejects it, so a revoked client stops receiving resource updates immediately instead of lingering until session eviction. - Regression tests for both paths and a changeset note. Also merges master (ContextVM#102 probe-timeout teardown fix) into the branch so the probe-timeout regression runs against the current writer code.
Summary
Fixes
notifications/resources/updateddelivery so resource updates are sent only to subscribed clients instead of all initialized sessions. Servers can define which update URIs are sub-resources of a subscribed URI; exact URI matching works by default.Changes
SubscriptionStore.resources/subscribeandresources/unsubscriberequests without tying subscriptions to response correlation.matchesSubResourcecallback. Deduplicate clients matching both.sendNotificationbehavior unchanged.Subscriptions intentionally do not veto session eviction, and stale entries from an application-rejected subscribe are tolerated as discussed in #52.
Tests
git diff --checkpassed.d43ae78are awaiting maintainer approval.Closes #52