Merge hero_rpc_openrpc into hero_rpc2 — single error type + transport surface #146
Labels
No labels
prio_critical
prio_low
type_bug
type_contact
type_issue
type_lead
type_question
type_story
type_task
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lhumina_code/hero_blueprint#146
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Background
We currently ship two crates that serve overlapping roles in the JSON-RPC stack:
hero_rpc_openrpc— older runtime; definesOpenRpcError,OpenRpcTransport, the HTTP-over-UDS transport, and various spec helpers.hero_rpc2— newer runtime introduced in hero_rpc#142 (3f53db8); definesClient,ClientT,ClientError,ToRpcParams, the canonical UDS-HTTP client + server transport, plus thewith_discover/with_service_infomacros.The post-#142
openrpc_client!macro emits code that routes throughhero_rpc2(returnsResult<T, hero_rpc2::ClientError>). But many downstream consumers were written against the olderhero_rpc_openrpc::OpenRpcErrorshape and now break on every?site that composes a generated SDK call with a caller-side return type.Concrete breakage already triaged in this thread
hero_indexer_sdk— neededhero_rpc2+herolib_coredeps added; pushed as463f4e9.hero_proc_sdk— needed the same dep addition +pub use hero_rpc_openrpc::OpenRpcError as HeroProcRpcApiErrorswapped topub use hero_rpc2::ClientError as HeroProcRpcApiError. Pushed as a quick alias patch; see openrpc_client/mod.rs for the TODO referencing this issue.hero_admin_lib— uses the old transport path; admin/server binaries hang at startup against the latest hero_rpc — separate issue.Each time we add a new SDK consumer (every Hero service gets one), the same dance repeats. The duplicate types are the symptom; the disease is that we have two crates trying to be the JSON-RPC runtime.
Proposal
Fold
hero_rpc_openrpcintohero_rpc2— makehero_rpc2the single source of truth for:ClientError(dropOpenRpcError)ClientT/Client/ClientBuilderconnect_http,serve_http)ToRpcParamsadapterwith_discover/with_service_infobuilder methodshero_rpc_openrpc::spec(move underhero_rpc2::spec)[features = "transport"]flag becomes the default surface in hero_rpc2.After the fold:
hero_rpc_openrpccrate is deleted from the workspace.Cargo.tomldropshero_rpc_openrpcand adds (if not already)hero_rpc2.use hero_rpc_openrpc::*becomesuse hero_rpc2::*.OpenRpcErrorbecomesClientError.pub use … as HeroProcRpcApiErroraliases in downstream SDKs collapse topub use hero_rpc2::ClientError as HeroProcRpcApiError(or just drop the alias entirely and have the SDK return the canonical type).Affected repos (initial scan)
lhumina_code/hero_rpc— delete crate, update internalCargo.tomls + re-exportslhumina_code/hero_proc— update hero_proc_sdk + hero_proc_serverlhumina_code/hero_indexer— update hero_indexer_sdk + serverlhumina_code/hero_website_framework— update hero_admin_lib (depends on the old transport)lhumina_code/hero_skills—labre-exports hero_rpc_openrpc in a few places; update_sdk(hero_books, hero_aibroker, hero_logic, hero_db, hero_code, hero_auth, hero_voice, hero_router, …)Migration sequence
hero_rpc_openrpc::*items intohero_rpc2::*. Add#[deprecated]re-exports in hero_rpc_openrpc pointing at the new paths so downstreams compile against either version during the transition.Cargo.tomlto drop hero_rpc_openrpc, fix imports, push to dev branch.Out of scope
_sdkcrates (viaopenrpc_client!macro) need no manual edits — the macro already emitshero_rpc2-shaped code.Why the alias quick-fix isn't the long-term answer
Every new downstream consumer of
openrpc_client!needs to declare bothhero_rpc2ANDhero_rpc_openrpcin deps (the macro expansion uses one, the hand-written builders use the other). Folding the crates makes the dep set match the import set, eliminates the alias dance, and removes ~2000 lines of duplicated transport code from the tree.Acceptance criteria
hero_rpc_openrpccrate no longer exists onorigin/development.origin/developmentof hero_rpc with nohero_rpc_openrpcin itsCargo.toml.