-
Notifications
You must be signed in to change notification settings - Fork 330
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
refactor: Remove misleading callback_id
from register_callback()
test function
#497
Conversation
Is this supposed to be a draft PR or is it really ready for review? |
On Gitlab people didn't get a notification when you put Draft: in front. Apparently this works differently somehow on Github. There are some things I was going to do before it's ready. Sorry for the confusion. |
This is where the sanity check is done when inducting responses (called from the system state here). What it checks is the callback ID that is registered here, not what we passed into So the reason tests using This is clearly not how it should be and quite misleading. It may also break on seemingly unrelated changes in the future. |
callback_id
from register_callback()
test functioncallback_id
from register_callback()
test function
callback_id
from register_callback()
test functioncallback_id
from register_callback()
test function
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.
Thanks a lot. LGTM.
The function
register_callback()
takes aCallbackId
as an argument. This suggests that thisCallbackId
is registered in theCallContextManager
such that a response using thisCallbackId
can later be inducted successfully by passing this sanity check.This is false. The
CallbackId
handed toregister_callback()
is used to construct an update call, but the origin of a call is irrelevant for the sanity check because each message gets its ownCallbackId
. It is in general not possible to ask theCallContextManager
to register aCallbackId
, rather you must ask theCallContextManager
to register a newCallback
for your call and then theCallContextManager
generates and registers thisCallback
with a newCallbackId
and returns it to you. This is theCallbackId
that must be used to generate the message to pass the sanity check.Since the origin of the call is irrelevant for the intended purpose of this function, it makes sense to use a system task as the call origin (i.e. a heartbeat or a timer), since that does not require a
CallbackId
as an input and return theCallbackId
that must be used to construct the message instead.The changes in this PR are such that the misleading
CallbackId
argument is removed, but otherwise the code is intact. Further changes to improve consistency with how theCallContextManager
should be used will be done in a different PR.