rpc: typed MethodNotImplementedError + vgi_rpc.error_kind metadata#8
Merged
Merged
Conversation
Adds a typed marker exception (subclass of AttributeError) plus a new
``vgi_rpc.error_kind`` metadata key on EXCEPTION-level error batches.
Lets clients pattern-match on a stable identifier ("method_not_implemented")
instead of substring-searching the message body.
Used by the VGI DuckDB extension's capability-detection fallback: it
tries a new RPC method, catches the typed marker narrowly, and falls
back to the legacy method only when the worker genuinely doesn't
implement the new one. Other RPC errors propagate as before.
Server-side: both the pipe/subprocess and HTTP unknown-method paths
raise MethodNotImplementedError. The error_kind class attribute is
hoisted from extra → top-level metadata key by Message.from_exception
+ Message.add_to_metadata.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
|
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.
Summary
MethodNotImplementedError(subclass ofAttributeError) so clients can pattern-match on a stable kind identifier instead of substring-searching the message bodyerror_kindfrom the exception'sextrato a top-level wire metadata keyvgi_rpc.error_kind(new key invgi_rpc/metadata.py)vgi_rpc/rpc/_server.pyandvgi_rpc/http/server/_app.py) raise the typed markerWhy
The VGI DuckDB extension needs to add a new RPC method (
catalog_table_scan_branches_get) for multi-source tables, with a clean fallback to a legacy method for workers that don't yet implement it. The fallback site catchesVgiRpcExceptionnarrowly — only whenerror_kind == "method_not_implemented"— so other RPC errors propagate as before. Without this typed marker, the fallback would have to substring-match"has no RPC method"which the senior review flagged as the antipattern.Test plan
test_exhaustive.py::TestServeOneServerErrors::test_unknown_method_errorstill passes (the message text is unchanged; only the exception class differs)test_exhaustive.py::test_unknown_method_error_carries_error_kind_metadataasserts the wire-levelvgi_rpc.error_kind=method_not_implementedmetadatatest_exhaustive.py::test_method_not_implemented_error_class_carries_kindasserts the class attribute andisinstance(..., AttributeError)for back-compattest_http.py::test_unknown_method_404updated to expect the new class name inRpcError.error_type🤖 Generated with Claude Code