-
Notifications
You must be signed in to change notification settings - Fork 2.6k
User should set RootsListChanged capability #871
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
User should set RootsListChanged capability #871
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yup lgtm 👍
this could be a separate PR, but it might be nice to support "good" default callbacks as well, like if most users want to respond to "roots/list" with a paginated result of roots in some default way, we might consider providing such a facility. Same with roots/listChanged - if I want to support "listChanged" but am happy with some default response, why make each user write their own callback?
EDIT: Irrelevant edit removed.
@hesreallyhim yeah, agreed... I was thinking about implementing something nicer than this simple PR. A suggestion could be:
I can implement this if @ihrpr or @Kludex are on-board (will wait for their blessing, I don't want to waste time implementing it if the core maintainers don't agree). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The core proposal seems right to me - this allows us to more closely align SDKs with the protocol definition.
listChanged
indicates whether the client will emit notifications when the list of roots changes.
Right now we're essentially assuming if _list_roots_callback
is provided, listChanged=True
. This PR allows splitting the existence of the capability from whether we'll actually send notifications (which aren't the same thing).
However, this seems like it could be a breaking change for use cases that are currently relying on the assumed listChanged=True
+ it now requires users to remember to update 2 places. Adding a default list_changed
callback also seems like a potentially good idea but I think unrelated to this PR.
I'm going to request changes for now as we'll also want tests and a sync with main, but I'll mark this for review amongst maintainers and bring it up to the group. I'll come back with feedback as soon as I have it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @lorenzocesconetto thanks again for this submission - discussed this separately with @dsp-ant and we think this is a sensible change to improve protocol compliance.
However, ideally we'd not have separate parameters for list_roots_callback
and support_roots_list_changed
- with the current setup it's possible to supply one but not the other for example.
It'd be great if instead of just accepting list_roots_callback
on ClientSession
here we could accept a struct that requires users to provide the information at the same time, e.g.
@dataclass
class RootsConfig:
callback: ListRootsFnT
list_changed: bool
This would allow us to avoid callback without list_changed being true or vice versa.
Would you have bandwidth / interest in working on this?
Hi @felixweinberger |
Converting this to a draft while we await changes discussed above to remove it from the review queue for now. |
SDK user will set whether it supports RootsListChanged.
To fall into the safe side, the capability defaults to
False
.Motivation and Context
I was thinking of a more robust solution for this, but since it's the user providing the callback, I don't think there's much we can do here.
How Has This Been Tested?
Locally.
Breaking Changes
No. I added a new arg, but it's in the end of the args list and has a default value.
Types of changes
Checklist
Additional context