No reviewers
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!94
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "issue-91-92-93-generator-fixes"
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?
Closes #91, #92, #93.
Three small generator fixes from the same root — the hero_logic#46 PR had to post-process the generator output in
build.rs. Landing them together means downstream services drop their build.rs hacks in one sweep.#91 — Drop colon from
info.titlePer-domain
openrpc.jsonnow uses"<service> - <domain>"(space-dash-space, e.g.RecipeService - recipes). Pre-#91 it was<service>:<domain>whichhero_rpc_derive::openrpc_client!rejected when deriving Rust idents from the title. Aggregate strip logic inwrite_aggregate_openrpc_jsonupdated to match.Format choice: ASCII space-dash-space over
_or em-dash. Reads cleanly in doc viewers, splits trivially in tooling (rsplit_once(" - ")), survives the macro's ident derivation, and avoids ambiguity with snake_case domain names.#92 — Emit
serversblockGenerator now reads
[[binaries.sockets]]entries from the parsedservice.toml(already available onOschemaBuildConfig::service_tomlper #55 §1) and emits one OpenRPC server entry perprotocol = "openrpc"socket:URL format matches what
openrpc_client!::connect()expects (seecrates/derive/src/openrpc_client.rs~L840): it stripsunix://, splits on${HERO_SOCKET_DIR}, and resolves the relative path at runtime viaherolib_core::base::resolve_socket_path_with_override. So no consumer-side resolution code changes.Per-domain narrowing: for multi-binary services, per-domain
openrpc.jsonfilters to binaries whose name carries the domain suffix (_<domain>). When nothing matches (single-binary services like recipe_server), the full list is emitted. Aggregate keeps the deduped union across every per-domain spec.#93 — Auto-discover
@server-featuremodulesgenerate_server_lib_rs(inbuild/emit/rust_server.rs) now mirrors the SDK side's@sdk-feature:scan: walks the server crate'ssrc/for*.rsfiles and<dir>/mod.rsmodules whose top-of-file doc comment carries//! @server-feature:, and emitspub mod <name>;for each alongside the codegen-managed domain modules. The marker value (text after the colon, if any) becomes a#[cfg(feature = "<value>")]gate.Marker-required, not discover-everything: the SDK side picks up every hand-written sibling because SDK crates are mostly client surface. Server crates routinely carry internal helpers (state types, layer impls, util fns) that should NOT be re-exported as top-level modules. Opt-in via the marker keeps the public surface explicit.
So after this lands,
hero_logic_server's four hand-written modules (engine,seed,services,tracing_layer) survive regen as soon as they get a one-line//! @server-feature:marker. Nobuild.rsrewrite.Bonus —
OschemaBuildConfig::service_toml_atAdded a focused builder method that only sets the parsed
ServiceTomlwithout flippingnested_layout: trueor other modern-service defaults the wayfrom_service_toml_at(a constructor) does. Lets non-nested layouts opt intoserversemission without giving up their existing layout config. Used inexample/recipe_server/crates/hero_recipes/build.rsto wire the example end-to-end.Downstream impact (verified, not changed in this PR)
hero_logic#46's
build.rspost-process patches (commit8e76e12onissue-44-template-pattern-upgrade) map 1:1 to these three issues:"LogicService:logic"→"LogicService"title rewriteservers[]block injectionhero_logic_server/src/lib.rsrewrite restoring 4 modulesAdding the
//! @server-feature:marker to those four modules and deleting the post-process block lands the cleanup. Not done in this PR — that belongs in hero_logic#46.Test plan
cargo test -p hero_rpc_generator --lib— 131 passed, 0 failed.cargo build --workspaceclean.example/recipe_serverregenerated: aggregate title"RecipeService", per-domain title"RecipeService - recipes", servers block present in both withunix://${HERO_SOCKET_DIR}/hero_recipes_server/rpc.sock.hero_recipes_server/src/lib.rsstructure.🤖 Generated with Claude Code
Add `OschemaBuildConfig::service_toml_at` — a focused builder method that only sets the parsed `ServiceToml` without flipping `nested_layout` or any other defaults (unlike `from_service_toml_at`, which is a constructor and applies the modern-service defaults). Use it from `example/recipe_server`'s `hero_recipes/build.rs` so the example exercises the new `servers` emission path. Regenerate the docs: - `docs/openrpc.json` aggregate: `"title": "RecipeService"`, single `servers[]` entry → `unix://${HERO_SOCKET_DIR}/hero_recipes_server/rpc.sock`. - `docs/recipes/openrpc.json` per-domain: `"title": "RecipeService - recipes"` (no colon — passes `openrpc_client!`'s ident derivation), same `servers[]`. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>