Repository navigation
Add dynamic operation registration and dispatch - #70
Merged
long-nt-tran merged 3 commits intoNov 23, 2026
Merged
Conversation
long-nt-tran
force-pushed
the
dynamic-nexus-operations
branch
from
November 16, 2026 23:03
f22750d to
c88388f
Compare
long-nt-tran
marked this pull request as ready for review
November 16, 2026 23:11
atol
reviewed
Nov 19, 2026
Comment on lines
+213
to
+221
| named_factories = {} | ||
| for name, handler_factory in operation_handler_factories_by_method_name.items(): | ||
| # The service contract lists only named operations. Exclude the dynamic fallback | ||
| # so validation does not reject it as an extra operation. | ||
| operation = get_operation(handler_factory) | ||
| if operation is not None and operation.dynamic: | ||
| continue | ||
| named_factories[name] = handler_factory | ||
| operation_handler_factories_by_method_name = named_factories |
There was a problem hiding this comment.
It seems like dynamic operation handler factories are being added to operation_handler_factories_by_method_name, which forces us to exclude them in multiple places. Maybe instead, the operation_handler decorator can mark the dynamic factory with a private attribute and not attach an Operation, so it never enters that dict. A separate function could then find it. This would also let us drop the dynamic field from the public Operation dataclass.
long-nt-tran
force-pushed
the
dynamic-nexus-operations
branch
from
November 20, 2026 19:35
60763a3 to
50d1fb6
Compare
atol
approved these changes
Nov 20, 2026
| The handler must accept raw nexusrpc.LazyValue input. | ||
|
|
||
| .. warning:: | ||
| Dynamic operation handler (setting dynamic=True) are experimental and may change in |
Contributor
Author
There was a problem hiding this comment.
good call, since there's only supposed to be a single dynamic handler per service I changed the are to is instead
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.
What changed
Same as nexus-rpc/sdk-go#74, for Python.
I have it so that the dynamic handler is excluded when listing named operations because it doesn't have a name. Let me know if this is the correct approach.
Why
This will be useful in the future (namely MCP outbound to start).
Testing
Added new unit test suite, all tests pass.