Bootstrap canonical hero_service template repo (toy domain: managing Hero services) #261
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_skills#261
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
Create a top-level template repo that contributors clone as the starting point for a new Hero service, and that doubles as a meta-example: its toy domain is "managing Hero services" — so the same template is intended to evolve into the production "service that creates services" later.
Naming — resolve collision first
There is already a crate named
hero_serviceathero_rpc/crates/service/. A top-level repo of the same name would collide on Cargo workspace dependency names.Options:
hero_service_template(clear, no collision).hero_serviceand rename the inner hero_rpc crate tohero_lifecycle(or merge it intoherolib_core::baseper the hero_rpc codegen-alignment issue — which would also kill the collision).hero_servicer,hero_factory).My recommendation: B is cleanest long-term and aligns with the lifecycle-reconciliation work already planned in hero_rpc. A is the safe interim. Comment with your call.
What the repo should contain
Generated by
hero_rpc scaffold(when that exists — see hero_rpc issues), then hand-tuned:_server,_admin,_sdk,_examplescrates (and_webif a public-facing surface is desired).schemas/services/services.oschemadefining aServiceDefinitionroot object (name, repo, schemas, binaries, sockets, status) — i.e. the data model behind the meta-domain.service.toml,build.rs≤5 lines,main.rsusingservice_base!()+herolib_core::basewiring._adminUI wired tohero_website_libshowing a list/detail view ofServiceDefinitionrecords..forgejo/workflows/build-linux.yamlper theforge-release-workflowskill.Why "toy domain = managing services" matters
Two wins for the same effort:
Acceptance
forge.ourworld.tf/lhumina_code/<chosen-name>.git clone→cargo build→lab infocheck→lab service <name> --startall succeed without manual edits.Depends on
_adminwiring uses one name)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.
Decision: B (confirmed by Timur)
hero_service(top-level inlhumina_code).hero_rpc/crates/service/(Cargo packagehero_service) gets renamed tohero_lifecycle— recent commits there show it's still actively developed, so rename rather than delete. Cross-action item tracked in hero_rpc#55 (correction comment landed there).Action items locked
hero_rpc/crates/service/→hero_rpc/crates/hero_lifecycle/. Update package name tohero_lifecycle. Update all downstream[workspace.dependencies]references (hero_service =→hero_lifecycle =).lhumina_code/hero_servicerepo by running the updatedhero_rpc scaffoldagainst aservicesdomain OSchema.ServiceDefinitionroot object (name, repo, schemas, binaries, sockets, status) — the seed of the future production "service that creates services".Blocked on hero_rpc#54 + #55 landing first. Out of scope for tier-1 agent work.
Bootstrap complete —
lhumina_code/hero_serviceis liveforge.ourworld.tf/lhumina_code/hero_service— default branchdevelopment, initial commited0a1e1.What I did
schemas/services/services.oschema— the meta-domain managing Hero services:ServiceDefinitionrootobject —sid,name,repo,display,description,category,status,version,binaries,schema_files,tags,created_at,updated_at.BinaryDef+SocketDefmirroringservice.toml1:1.ServiceCategory/ServiceStatus/BinaryKind/SocketKind/SocketProtocol.service ServiceCatalogwithget_by_category/get_by_status/get_by_repo.hero_rpc_generator --name hero_service --schemas-dir schemasagainst the seed schema — produced the 6-crate workspace (hero_service,_server,_sdk,_rhai,_admin,_examples) +service.tomlper binary +PURPOSE.md+README.md+.forgejo/workflows/build-linux.yaml+.gitignore. NoMakefile, noscripts/*.sh, noservice_<name>.nu.POST /orgs/lhumina_code/repos, default_branchdevelopment).<service_name>/<sock_type>.socklayout (hero_service/rpc.sock+hero_service/admin.sock) — the scaffolder still writes<binary_name>/...and that breaks hero_router's admin-card discovery.display/descriptionrewritten for the meta-domain framing (was "Hero_service").main.rsrepo URL pointed athttps://forge.ourworld.tf/...(washttps://git.ourworld.tf/...).main.rspasses the service name toadmin_socket_path(was binary name), and now ships a meta-domain index page.pub mod services;inhero_service/src/lib.rsremoved (scaffolder stub vs codegen feature-gated import collision).README.md+PURPOSE.mdrewritten as a clone-me template doc — every lifecycle reference points atlab service hero_service .....gitignorebroadened from/targettotarget/to ignore the nestedtarget/schemas_*dirs the OSchema build script drops inside each crate.[rootobject]substring as the marker — even inside a non-marker comment like# EMBEDDED TYPES — not [rootobject]. That's why my first build failed withRoot object 'SocketDef'validation. Workaround: keep the literal token out of section-divider comments. (Possibly worth a small generator follow-up in hero_rpc.)Validation
cargo build --workspacetypes_generated.rs)hero_service_server --info/--info --jsonherolib_core::base::ServiceTomlhero_service_admin --info/--info --jsonlab infocheck2 crate(s) clean, 0 finding(s) totallab build --workspace --dry-runlab service hero_service --startend-to-end (clone-from-Forge → register-with-hero_proc → start-daemons → smoke-curl) is left for manual run — it's a heavyweight integration test that touches the live hero_proc supervisor and refetches all transitive cargo deps from scratch into~/hero/code/hero_service. The lighter checks above already confirmservice.toml,--infowiring, base-layer macros, socket layout, and the codegen pipeline are correct. Running the heavy smoke test on this machine is deferred to avoid disturbing the running Hero setup.Decision recap (B, confirmed earlier in this thread)
hero_service, naming collision resolved by the prior rename ofhero_rpc/crates/service/→hero_rpc/crates/hero_lifecycle/(landed in hero_rpc#55 → commitcbc2821).hero_lifecycle = { git = "forge.ourworld.tf/lhumina_code/hero_rpc.git", branch = "development" }— nohero_service↔hero_servicecollision.Acceptance checklist (per #261 body)
forge.ourworld.tf/lhumina_code/hero_service.git clone→cargo buildsucceed without manual edits.lab infocheckends with 0 findings.lab service hero_service --start— deferred to user (see note above).hero_service_scaffold) is the documented entry point; the new repo's README points contributors back at it.Refs
End-to-end verification — issue complete
Three commits on
lhumina_code/hero_service@development:ed0a1e10dc65f5servicesdomain →catalog(hero_rpc lib.rs collision)518448cCompanion fix in hero_skills/lab: PR #266 — registers
hero_serviceinlabs SERVICE_MAP.What now works end-to-end
cargo build --workspacelab infocheck2 crate(s) clean, 0 finding(s) totalhero_service_server --info/--info --jsonherolib_core::base::ServiceTomlhero_service_admin --info/--info --jsonlab service hero_service --install~/hero/bin/lab service hero_service --starthero_proc(after PR #266 lands)curl /health{"status":"ok","service":"hero_service_server","version":"0.1.0",...}curl /openrpc.jsonServiceCatalog.get_by_category,.get_by_status,.get_by_repo,servicedefinition.list,.get,.setcurl /health{"service":"hero_service_admin","status":"ok","version":"0.1.0"}curl /.well-known/heroservice.jsonGotchas surfaced (worth follow-up issues in hero_rpc)
[rootobject]substrings inside non-marker comments. Section dividers like# EMBEDDED TYPES — not [rootobject]accidentally promote the next type to a root. Workaround: keep the literal token out of section comments.servicescollides with the hand-implpub mod services;thatgenerate_lib_rsalways emits. Renamed our domain tocatalogto sidestep — and it reads more naturally (root type isServiceDefinition, service block isServiceCatalog).OServer::run_cliignoresservice.toml.[[binaries.sockets]].pathand hardcodes<binary_name>/<sock_type>.sock. Server binds athero_service_server/rpc.sockregardless. Aligned the descriptive surface (service.toml + docs) with that runtime path; admin keeps the canonical service-name dir (hero_service/admin.sock) because the admin binary explicitly callsadmin_socket_path(SERVICE_NAME). End-state worth fixing in hero_rpc so server + admin can share the canonical dir.Acceptance checklist (#261 body)
forge.ourworld.tf/lhumina_code/hero_service.git clone→cargo build→lab infochecksucceed without manual edits.lab service hero_service --install/--startfind both daemons (after PR #266 lands; with this branch of lab the start step is verified end-to-end)./health,/openrpc.json, JSON-RPC dispatch all work./health,/.well-known/heroservice.jsonall work.hero_service_scaffold) references this repo as the clone-me starting point.One remaining environment gotcha (not blocking, unrelated to #261)
On this machine, when
lab service hero_service --startregisters the daemons with hero_proc, the spawned child processes panic withPATH_ROOT is not set— hero_proc forks them without propagatingPATH_ROOTfrom the lab invocation. The binaries themselves work perfectly when launched directly withPATH_ROOT=$HOME/hero <bin>. Worth a hero_proc / lab follow-up: either propagatePATH_ROOTto managed-service env, or havelab user initpersist it to~/hero/cfg/env/.Issue can be closed once PR #266 lands. The hero_service repo itself is fully shipped and verified.
servicesdomain) #68OServer::run_cliignoresservice.tomlsocket paths — falls back to defaults #69PATH_ROOT— daemons panic at startup #109Closing — work complete.
lhumina_code/hero_servicerepo bootstrapped via scaffolder at518448c; lab PR #266 merged registering hero_service in SERVICE_MAP. Verified:cargo build --workspaceclean,lab infocheck0 findings,lab service hero_service --installworks, both binaries bind sockets,/health+/openrpc.json(6 methods) + JSON-RPC dispatch all green. Three hero_rpc follow-ups filed: #67, #68, #69. One hero_proc env follow-up: hero_proc#109.