fix(session): Always have calling session be the parent session when making a scoped session #1923
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.
Before the PR,
SessionProxy
'smake_scope(id)
would recursively call up the chain to.make_scope(id)
. This would hit the rootAppSession
and call make scope with resolved namespaceid
. However, this set's the._parent
value of the Proxy session toRoot
and not the calling session. Ex: A nested moduleA-B-C
's parent session currently is the root session,""
, not a proxy session with namespaceA-B
.This worked as we would use
self._ns
(properly resolved) instead ofself._parent._ns
when needing to construct any namespace values. Since the namespace values is all that we really need and all recursive functions didn't add any intermediate proxy logic, it happen to work until now.While debugging bookmark handlers, I noticed that the
session.bookmark.on_bookmark
decorator would not recurse up the parent modules but instead go directly to the root session's bookmark (when callingself._session_proxy._parent.bookmark.on_bookmark(cb)
: "go to this proxy session's bookmark object and register a callback"). It would start atA-B-C
'son_bookmark
call and immediately jump toRoot
session'son_bookmark
call, with no in between calls toA-B
orA
's bookmark object.To fix this, all
SessionProxy
object's should have their._parent
session point to the session who created it, not always the root session.