Skip to content

rpc: typed MethodNotImplementedError + vgi_rpc.error_kind metadata#8

Merged
rustyconover merged 1 commit into
mainfrom
feat/method-not-implemented-marker
May 17, 2026
Merged

rpc: typed MethodNotImplementedError + vgi_rpc.error_kind metadata#8
rustyconover merged 1 commit into
mainfrom
feat/method-not-implemented-marker

Conversation

@rustyconover

Copy link
Copy Markdown
Collaborator

Summary

  • Adds typed MethodNotImplementedError (subclass of AttributeError) so clients can pattern-match on a stable kind identifier instead of substring-searching the message body
  • Hoists error_kind from the exception's extra to a top-level wire metadata key vgi_rpc.error_kind (new key in vgi_rpc/metadata.py)
  • Both unknown-method handlers (vgi_rpc/rpc/_server.py and vgi_rpc/http/server/_app.py) raise the typed marker

Why

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 catches VgiRpcException narrowly — only when error_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

  • Existing test_exhaustive.py::TestServeOneServerErrors::test_unknown_method_error still passes (the message text is unchanged; only the exception class differs)
  • New test_exhaustive.py::test_unknown_method_error_carries_error_kind_metadata asserts the wire-level vgi_rpc.error_kind=method_not_implemented metadata
  • New test_exhaustive.py::test_method_not_implemented_error_class_carries_kind asserts the class attribute and isinstance(..., AttributeError) for back-compat
  • test_http.py::test_unknown_method_404 updated to expect the new class name in RpcError.error_type
  • Full suite: 3209 passed, 151 skipped, 0 failures

🤖 Generated with Claude Code

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>
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@rustyconover
rustyconover merged commit d3fd810 into main May 17, 2026
4 of 6 checks passed
@rustyconover
rustyconover deleted the feat/method-not-implemented-marker branch May 17, 2026 04:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants