fix: support 2-part method names in Unix socket dispatch #6

Merged
mik-tf merged 3 commits from development_fix_2part_dispatch into development 2026-03-05 15:14:24 +00:00
Owner

Summary

  • Unix socket dispatch (dispatch_jsonrpc) now accepts both 2-part (Type.method) and 3-part (domain.Type.method) method names
  • 2-part methods scan all domains in the context for a matching handler
  • Fixes ALL RPC calls from browser/WASM clients which don't include domain prefix

Problem

The WASM SDK sends 2-part method names like Contact.get and AuthService.get_challenge, but dispatch_jsonrpc required 3-part names (identity.Contact.get). This caused every RPC call from the Hero OS UI to fail with "Method not found".

The Rust SDK was fixed in #2 to prefix methods with the domain, but browser/JS clients (WASM UI) don't have domain info and send 2-part names.

Test plan

  • cargo check -p hero_rpc_osis passes
  • 3-part methods still route correctly (explicit domain)
  • 2-part methods now resolve by scanning domains
  • AuthService.get_challenge works without domain prefix
  • Contact.get works without domain prefix

🤖 Generated with Claude Code

## Summary - Unix socket dispatch (`dispatch_jsonrpc`) now accepts both 2-part (`Type.method`) and 3-part (`domain.Type.method`) method names - 2-part methods scan all domains in the context for a matching handler - Fixes ALL RPC calls from browser/WASM clients which don't include domain prefix ## Problem The WASM SDK sends 2-part method names like `Contact.get` and `AuthService.get_challenge`, but `dispatch_jsonrpc` required 3-part names (`identity.Contact.get`). This caused **every** RPC call from the Hero OS UI to fail with "Method not found". The Rust SDK was fixed in #2 to prefix methods with the domain, but browser/JS clients (WASM UI) don't have domain info and send 2-part names. ## Test plan - [ ] `cargo check -p hero_rpc_osis` passes - [ ] 3-part methods still route correctly (explicit domain) - [ ] 2-part methods now resolve by scanning domains - [ ] `AuthService.get_challenge` works without domain prefix - [ ] `Contact.get` works without domain prefix 🤖 Generated with [Claude Code](https://claude.com/claude-code)
The Unix socket dispatch (dispatch_jsonrpc) required 3-part method names
(domain.Type.method) but browser/WASM clients send 2-part names
(Type.method) because they don't know which domain owns each type.

This caused ALL RPC calls from the Hero OS WASM UI to fail with
"Method not found" — including auth, CRUD operations, and service methods.

Now dispatch_jsonrpc accepts both formats:
- 3-part (domain.Type.method): routes to the explicit domain (existing behavior)
- 2-part (Type.method): scans all domains in the context for a matching handler

The scan tries each registered domain and returns the first successful match,
making it transparent to clients whether they include the domain prefix or not.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The single-pass scan tried handle_service_call on each domain, but
the first domain with any handler would return an application error
for unknown methods, blocking the scan from reaching the correct domain.

Now uses two phases:
1. Direct handler lookup (type registered via type_names)
2. Service method fallback (handle_service_call) — skips on error

This ensures AuthService.get_challenge routes to the identity domain
(which has the auth handler) instead of stopping at the ai domain.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When scanning domains for a 2-part method, the phase 2 fallback was
treating ALL errors from handle_service_call as "wrong domain, try next".
This caused methods that were found but failed (e.g., missing parameter)
to be skipped, eventually returning "Method not found".

Now only errors containing "Unknown method" trigger a domain skip.
Other errors (parameter validation, runtime failures) are returned
as application errors, matching the 3-part dispatch behavior.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
mik-tf merged commit 3e98249e9f into development 2026-03-05 15:14:24 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lhumina_code/hero_rpc!6
No description provided.