Generator: emit servers block in openrpc.json so openrpc_client!::connect() resolves to the service's Unix socket #92
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#92
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
The generated
openrpc.jsonlacks aserversblock. Without it,hero_rpc_derive::openrpc_client!'s generatedconnect()method has no idea which Unix socket the service runs on, and consumers can't call it without manually supplying the socket path.Found by the hero_logic#46 agent during the template-pattern migration — they patched a
serversblock into the openrpc.json in abuild.rspost-process step. That hack is what this issue removes.What to do
The generator already has access to the service's socket path via
service.toml([[binaries.sockets]]withprotocol = "openrpc"). Emit aserversblock in every generatedopenrpc.jsonreferencing that socket:Applies to both the aggregate
docs/openrpc.jsonand the per-domaindocs/<domain>/openrpc.jsonfiles.Acceptance
openrpc.jsonincludes aserversblock referencing the service's RPC socket.openrpc_client!'sconnect()resolves to the right socket without manual configuration.hero_logic(and any other consumer) can drop thebuild.rsservers-patching step.recipe_server+hero_serviceregenerate clean.Related
info.titlewithout colon (openrpc_client!macro rejects it) #91Implementation pushed on branch issue-91-92-93-generator-fixes. Bundled with the other two generator fixes from the same root (the hero_logic#46 build.rs post-process patches).
<service> - <domain>(space-dash-space). Aggregate strip logic updated to match.servers[]fromservice.toml[[binaries.sockets]]withprotocol = "openrpc", URL shapeunix://${HERO_SOCKET_DIR}/<path>soopenrpc_client!::connect()resolves viaresolve_socket_path_with_override. Per-domain narrows by binary name suffix_<domain>; aggregate keeps the union.generate_server_lib_rsdiscovers hand-written*.rs/<dir>/mod.rsmodules carrying//! @server-feature:and emitspub modlines for them. Marker-required (server crates carry internal helpers; SDK-style discover-everything would over-expose).Verified via
example/recipe_serverregen +cargo build --workspaceclean +cargo test -p hero_rpc_generator --lib(131 passed).generate_server_lib_rsshould auto-discover hand-written sibling modules (mirrorsgenerate_sdk_lib_rs) #93