Upgrade example/recipe_server to end-to-end demo of new pattern #57
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#57
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?
Goal
The
example/recipe_server/is the in-tree reference for hero_rpc users. Today it predates the current standards and won't passlab infocheck. Upgrade it to be the end-to-end demo of the new scaffold-then-generate flow.Scope
After the scaffold (#scaffold-full-service-repo) and codegen-alignment (#codegen-alignment) issues land, regenerate
example/recipe_server/from scratch using:Result should include:
hero_recipes_server,hero_recipes_sdk,hero_recipes_admin,hero_recipes_examplescrates.service.tomlat each binary crate root (generated, not hand-edited).build.rsper binary reduced to ≤5 lines.hero_recipes_examples(no hand-rolled client)._adminbinary serving the framework default screens atadmin.sock+ a recipes-specific page.RecipeServiceTraitimpl demonstrating both a CRUD-only method and a custom business-logic method.cargo buildregenerates, 4)lab service recipes --startto run it.Stretch — AI-driven narrative
Document (and ideally script) the flow:
hero_rpc scaffoldwith the user's name + schema.cargo build(which triggers codegen) andlab infocheckuntil clean.This is the example that makes hero_rpc tangible for both humans and agents — referenced by the new context skill.
Acceptance
cd example/recipe_server && cargo build && lab infocheckall succeed cleanly.lab service recipes --startworks andcurl --unix-socket .../rpc.sock /healthreturns ok.petstore_server/petstore_clientexamples are either deleted (if redundant) or kept with a note explaining when each pattern applies.Depends on
_admincrate to wire cleanly)hero_rpc scaffold) #54Parent / context tracker: hero_skills#262 — read it before starting work on this issue. Locked decisions, reference materials, and execution order live there. Iterate via comments here; consolidation passes on the body only after feedback settles.
State refresh
Pulled latest.
example/recipe_server/build.rsis unchanged (still 42 lines, hand-rolled rustfmt pass, hand-listed output paths). Upgrade work in this issue is still entirely pending.Still depends on #54, #55, #56 landing first.
Status — recipe_server upgraded to end-to-end demo
Branch:
issue-57-recipe-server-e2e(offdevelopment, all four dep issues #54/#55/#56/#60 already merged). Commit:13ee65c.What landed
recipe_serveris gone — replaced by whathero_rpc_generator --name hero_recipes --workspace-dir example/recipe_serverproduces. 5 crates:hero_recipes,hero_recipes_server,hero_recipes_sdk,hero_recipes_rhai,hero_recipes_admin,hero_recipes_examples.example/recipe_serveris nowexcluded from the parent hero_rpc workspace and carries its own[workspace]block — same shape downstream users get when they scaffold into their own repo.[patch]. The scaffoldedCargo.tomlpinshero_rpc_*+hero_lifecycleto git URL ondevelopment; a single[patch."https://forge.ourworld.tf/lhumina_code/hero_rpc.git"]block at the workspace root remaps them to the sibling../../crates/*so the in-tree demo builds against the current branch. Users scaffolding into their own repo don't need this block.service.tomlper binary, no Makefile. Bothhero_recipes_serverandhero_recipes_admincarryservice.toml, useservice_base!(),validate_service_toml,handle_info_flag,print_startup_banner,prepare_sockets(the §5 boilerplate from #55). NoMakefile, noscripts/*.sh, noservice_recipes.nu(ADR-0001).RecipeServiceTraitimpl filled. Demonstrates both patterns from the issue body:get_by_category/get_by_difficultyas read-only filters composed over the auto-CRUD primitives, andadd_to_collectionas cross-object business logic.hero_recipes_adminconsumeshero_admin_lib. Standard routes (/health,/.well-known/heroservice.json,/static/shared/*) come from the framework. Service-specific surface: a/recipespage embedding<hero-api-docs>against a build-time-included copy of the OpenRPC spec (/openrpc.jsonon the admin socket).example/recipe_server/README.mdcovers: scaffolded layout, the two files you actually write (.oschema+rpc.rs), whatcargo buildregenerates (table), the build/run loop withlab service recipes --install --start, smoke-test curl commands, the 6-step agent workflow, and how to add a domain.example/README.mdindexes the four examples and explains when to use each (scaffold flow vs. recipe_sdk_rpc2 vs. petstore_). Per the issue: petstore_ kept with the explanatory note — they remain the reference for the hand-written OpenRPC pattern.Acceptance evidence
cd example/recipe_server && cargo build --workspace— clean (one upstream unused-import warning intypes_generated.rsfrom the codegen; pre-existing, not introduced here).cargo build --workspaceat the hero_rpc parent — clean.hero_recipes_server --info/--info --json— embeddedservice.tomlparses, the JSON descriptor is canonical.GET /health→{"status":"ok",...}GET /openrpc.json→ 26 methods (5 auto-CRUD × 2 root objects + 3 custom + 11 standardrpc.*/system.*)POST /rpcrecipe.list→ list of 17 SIDs (server picked up seed data from~/hero/var/data/...)POST /rpcRecipeService.get_by_category {"category":"dessert"}→ typed slicelab infocheck—hero_recipes_serverandhero_recipes_adminboth clean. The four other failures (crates/generator,crates/hero_lifecycle,example/petstore_*) are pre-existing in hero_rpc and outside the scope of #57.cargo test -p hero_rpc_generator --lib— 125 passed (scaffolder tests still green).Out of scope / follow-ups
generator,hero_lifecycle,petstore_server,petstore_clientshould be its own cleanup pass — not landed here so this PR stays focused on #57.build.rs(~25 lines:OschemaBuildConfig::new().schemas_dir(...).client_crate_dir(...)...). The literal "≤5-line build.rs" target only fully kicks in oncefrom_service_toml()works for the core crate too (today it's binary-only). Counted as a minor follow-up.Branch ready to PR
https://forge.ourworld.tf/lhumina_code/hero_rpc/compare/development...issue-57-recipe-server-e2e