Generator: generate_server_lib_rs should auto-discover hand-written sibling modules (mirrors generate_sdk_lib_rs) #93
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#93
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
When the generator emits
crates/<name>_server/src/lib.rs, it lists only the codegen-managed modules. Any hand-written sibling modules (e.g.engine,seed,services,tracing_layer, custom domain logic) get stripped on regen.Found by the hero_logic#46 agent during the template-pattern migration — they had to re-emit
hero_logic_server/src/lib.rsfrom abuild.rspost-process step to restore the four hand-written sibling modules. That hack is what this issue removes.The parallel emitter for the SDK (
generate_sdk_lib_rs) already solves this: it auto-discovers modules via//! @sdk-feature:doc-comment markers. The server emitter just needs the same trick.What to do
Mirror the SDK emitter's discovery approach in
generate_server_lib_rs:lib.rs, scancrates/<name>_server/src/for any.rsfile containing a//! @server-feature:(or similar) marker doc comment.pub mod <discovered>;lines for those alongside the codegen-managed modules.@server-feature:mirrors@sdk-feature:).Affected services
Any service whose
_servercrate has hand-written modules beyond the codegen-managed ones:hero_logic_server— hasengine,seed,services,tracing_layerAcceptance
hero_logic_server/src/lib.rsis fully codegen-managed; the four sibling modules survive regen via the marker discovery.hero_logic'sbuild.rsdrops the lib.rs post-process step.Related
generate_sdk_lib_rsin the generator (post-#59 split, lives undercrates/generator/src/generate/)info.titlewithout colon (openrpc_client!macro rejects it) #91serversblock inopenrpc.jsonsoopenrpc_client!::connect()resolves to the service's Unix socket #92Implementation 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).