Defat hero_rpc_osis: gate legacy RPC server, redis, and herolib_ai behind features #22
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_rpc#22
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?
Problem
Every Hero service that uses
hero_rpc_servertransitively compiles heavy dependencies it never uses:AxumRpcServermock data generator inosis/src/rpc/server.rsAxumRpcServer(3200+ lines inrpc/server.rs) — completely superseded byhero_rpc_server::OServerDependency chain today
The
servercrate only needs a few traits and types fromosis::rpc:OsisAppRpcHandler,OsisDomainInit(fromhandler.rs,osis_app_bridge.rs)RequestContext(fromrequest_context.rs)JsonRpcRequest,JsonRpcResponse,JsonRpcError(fromjsonrpc.rs)OsisLifecycleHooks(fromlifecycle.rs)It does NOT need
rpc/server.rs(the legacy Axum server),rpc/client.rs(Redis client), orherolib_ai.Solution
Split the
rpcfeature inhero_rpc_osis/Cargo.toml:rpc-corefeature — just the traits, types, and dispatch logic the server needs. Zero heavy deps (no redis, no AI, no axum/tower/hyper).rpcfeature — keeps everything for backwards compat, depends onrpc-core+ the heavy deps.hero_rpc_serverswitches fromosis[rpc]toosis[rpc-core].Files in
osis/src/rpc/by category:mod.rs(re-exports only)server.rs(3200 lines, old AxumRpcServer)handler.rs(OsisRpcHandler trait)client.rs(Redis-based client)osis_app_bridge.rs(OsisAppRpcHandler)unix_server.rs(old UDS server)jsonrpc.rs(JSON-RPC types)request_context.rslifecycle.rs(hooks trait)dispatch.rsprotocol.rserror.rscontext.rsdebug.rsDeps split:
Impact
All downstream services (
hero_osis,hero_books,hero_voice,hero_logic,hero_biz,hero_services) get faster compiles and smaller binaries. No API changes — generated code imports fromhero_rpc_osis::rpc::*which still works.Acceptance criteria
rpc-corefeature compiles without redis/AI/axum depshero_rpc_serverdepends onosis[rpc-core]onlycargo check --workspacepasses in hero_rpccargo check --workspacepasses in hero_osisrpcfeature still works for any direct users