template: add greeter (methods-only) + extend catalog service methods + regenerated tests #11

Merged
timur merged 4 commits from methods-only-canary into development 2026-05-22 14:37:04 +00:00
Owner

Summary

  • Greeter domain (schemas/greeter/greeter.oschema): new methods-only canary — zero rootobjects, five service methods (greet, echo, add, concat, info) covering every parameter shape (single str, multi primitive, list, zero-arg). Handwritten handlers in crates/hero_service_server/src/greeter/rpc.rs are trivial pure functions — the point is exercising the wire path, not the business logic.
  • Catalog hybrid extension (schemas/catalog/catalog.oschema): add count() -> u32 and clear() -> bool to the existing service ServiceCatalog block. Catalog is now a hybrid: ServiceDefinition [rootobject] (CRUD + indexed find) plus a 9-method service block.
  • Build wiring: new greeter feature flag across hero_service / hero_service_server / hero_service_sdk; build.rs registers the domain; main.rs adds the cfg-gated MultiDomainBuilder::with_domain::<OsisGreeter>("greeter") line.
  • Drive-by: post-hero_rpc#133 every OSIS CRUD method returns a Future, but ServiceCatalogTrait is still sync. Bridge through a single tokio::task::block_in_place + Handle::block_on helper so list / get_by_name / list_by_interface / service_exists / the new count / clear keep compiling. Tracked for proper async-trait codegen in a follow-up.

Generated tests inventory

Before this PR (one e2e file per rootobject, zero coverage of service-block methods):

tests/generated/
  indexed_multi_e2e.rs
  indexed_multi_find_e2e.rs
  indexed_non_str_e2e.rs
  indexed_non_str_find_e2e.rs
  indexed_none_e2e.rs
  indexed_single_e2e.rs
  indexed_single_find_e2e.rs
  service_definition_e2e.rs
  service_definition_find_e2e.rs

9 generated tests, 0 service-method coverage.

After this PR (post hero_rpc#131 codegen):

tests/generated/
  bench_e2e.rs                        # service Bench { } — empty service block (no methods, file is header-only)
  greeter_e2e.rs                      # 5 tests — methods-only canary
  indexed_multi_e2e.rs
  indexed_multi_find_e2e.rs
  indexed_non_str_e2e.rs
  indexed_non_str_find_e2e.rs
  indexed_none_e2e.rs
  indexed_single_e2e.rs
  indexed_single_find_e2e.rs
  service_definition_e2e.rs
  service_definition_find_e2e.rs
  servicecatalog_e2e.rs               # 9 tests — was 0 in the previous shape

13 generated test files. The new service-method tests cover all 14 service-block methods (5 Greeter + 9 ServiceCatalog).

Test plan

  • cargo build --workspace clean against the hero_rpc#131 patch.
  • cargo build --workspace --tests — every generated <*>_e2e.rs binary compiles and links against the regenerated SDK trait.
  • Generated test binaries link successfully and invoke the spin-up helper correctly; runtime exercise (lab service hero_service --start --ephemeral --json) is gated on the lab subprocess driver landing on the host — that's hero_rpc#124's territory, out of scope here. The pre-existing rootobject E2Es (e.g. service_definition_e2e) fail with the same unknown flag --ephemeral message on the current lab build, confirming the new service-method tests behave identically to the rest of the suite.

Layer-by-layer (lab service hero_service --test)

lab service <name> --test is the post-hero_rpc#124 entry point — not yet shipped on the host's lab build (unknown flag --test for lab service hero_service). The cargo path validates the codegen and link surface, which is the bar this PR sets. Runtime execution will go green automatically when the lab --test verb lands.

Dependency note

Depends on lhumina_code/hero_rpc#134 (closes hero_rpc#131). CI here will fail on master cargo build until that PR merges and this branch rebases onto the updated hero_rpc development SHA. Squash-merge order:

  1. lhumina_code/hero_rpc#134development
  2. Rebase this PR; let Cargo.lock pin the new hero_rpc SHA
  3. lhumina_code/hero_service methods-only-canary → development

lhumina_code/hero_rpc#131

## Summary - **Greeter domain** (`schemas/greeter/greeter.oschema`): new methods-only canary — zero rootobjects, five service methods (`greet`, `echo`, `add`, `concat`, `info`) covering every parameter shape (single str, multi primitive, list, zero-arg). Handwritten handlers in `crates/hero_service_server/src/greeter/rpc.rs` are trivial pure functions — the point is exercising the wire path, not the business logic. - **Catalog hybrid extension** (`schemas/catalog/catalog.oschema`): add `count() -> u32` and `clear() -> bool` to the existing `service ServiceCatalog` block. Catalog is now a hybrid: `ServiceDefinition [rootobject]` (CRUD + indexed find) **plus** a 9-method service block. - **Build wiring**: new `greeter` feature flag across hero_service / hero_service_server / hero_service_sdk; build.rs registers the domain; `main.rs` adds the cfg-gated `MultiDomainBuilder::with_domain::<OsisGreeter>("greeter")` line. - **Drive-by**: post-hero_rpc#133 every OSIS CRUD method returns a Future, but `ServiceCatalogTrait` is still sync. Bridge through a single `tokio::task::block_in_place` + `Handle::block_on` helper so `list` / `get_by_name` / `list_by_interface` / `service_exists` / the new `count` / `clear` keep compiling. Tracked for proper async-trait codegen in a follow-up. ## Generated tests inventory **Before this PR** (one e2e file per rootobject, zero coverage of service-block methods): ``` tests/generated/ indexed_multi_e2e.rs indexed_multi_find_e2e.rs indexed_non_str_e2e.rs indexed_non_str_find_e2e.rs indexed_none_e2e.rs indexed_single_e2e.rs indexed_single_find_e2e.rs service_definition_e2e.rs service_definition_find_e2e.rs ``` 9 generated tests, 0 service-method coverage. **After this PR** (post hero_rpc#131 codegen): ``` tests/generated/ bench_e2e.rs # service Bench { } — empty service block (no methods, file is header-only) greeter_e2e.rs # 5 tests — methods-only canary indexed_multi_e2e.rs indexed_multi_find_e2e.rs indexed_non_str_e2e.rs indexed_non_str_find_e2e.rs indexed_none_e2e.rs indexed_single_e2e.rs indexed_single_find_e2e.rs service_definition_e2e.rs service_definition_find_e2e.rs servicecatalog_e2e.rs # 9 tests — was 0 in the previous shape ``` 13 generated test files. The new service-method tests cover all 14 service-block methods (5 Greeter + 9 ServiceCatalog). ## Test plan - `cargo build --workspace` clean against the hero_rpc#131 patch. - `cargo build --workspace --tests` — every generated `<*>_e2e.rs` binary compiles and links against the regenerated SDK trait. - Generated test binaries link successfully and invoke the spin-up helper correctly; runtime exercise (`lab service hero_service --start --ephemeral --json`) is gated on the lab subprocess driver landing on the host — that's hero_rpc#124's territory, out of scope here. The pre-existing rootobject E2Es (e.g. `service_definition_e2e`) fail with the same `unknown flag --ephemeral` message on the current `lab` build, confirming the new service-method tests behave identically to the rest of the suite. ## Layer-by-layer (`lab service hero_service --test`) `lab service <name> --test` is the post-hero_rpc#124 entry point — not yet shipped on the host's `lab` build (`unknown flag --test for lab service hero_service`). The cargo path validates the codegen and link surface, which is the bar this PR sets. Runtime execution will go green automatically when the lab `--test` verb lands. ## Dependency note Depends on https://forge.ourworld.tf/lhumina_code/hero_rpc/pulls/134 (closes hero_rpc#131). CI here will fail on master `cargo build` until that PR merges and this branch rebases onto the updated `hero_rpc development` SHA. Squash-merge order: 1. `lhumina_code/hero_rpc#134` → `development` 2. Rebase this PR; let Cargo.lock pin the new `hero_rpc` SHA 3. `lhumina_code/hero_service` methods-only-canary → `development` https://forge.ourworld.tf/lhumina_code/hero_rpc/issues/131
Two schemas updates that exercise hero_rpc#131's methods-only test
codegen path:

- schemas/greeter/greeter.oschema — new methods-only domain. Zero
  rootobjects, five service methods (greet, echo, add, concat, info)
  covering every parameter shape (single str, multi primitive, list,
  zero-arg). Pure canary for the SDK trait → server dispatcher →
  generated tests chain on a schema with no rootobject machinery.

- schemas/catalog/catalog.oschema — extend service ServiceCatalog with
  count() -> u32 and clear() -> bool. The catalog domain is now a
  hybrid: ServiceDefinition [rootobject] (CRUD) + a 9-method service
  block. The generated tests crate now covers both shapes
  simultaneously.

lhumina_code/hero_rpc#131
Add a `greeter` feature across hero_service / hero_service_server /
hero_service_sdk so the methods-only canary lives behind a feature
flag (no admin/web UI emission — those scaffolds assume at least one
rootobject; tracked as a separate codegen concern per hero_rpc#131).

- build.rs registers the new `greeter` domain.
- crates/hero_service{,_server}/src/greeter/ are the codegen-scaffolded
  modules — handwritten `rpc.rs` implements `GreeterTrait` with trivial
  pure functions (`greet`, `echo`, `add`, `concat`, `info`) so the
  generated round-trip tests have something concrete to exercise.
- main.rs adds the `#[cfg(feature = "greeter")]` arm onto the
  `MultiDomainBuilder` so the greeter handler is registered alongside
  bench + catalog.

lhumina_code/hero_rpc#131
Two new ServiceCatalog handlers driven by the schema additions:

- count() returns the catalogued service count (cheap len() over the
  list, avoids a full round-trip in dashboards).
- clear() wipes every catalogued service. Returns true on completion.

Drive-by: post-hero_rpc#133 every OSIS CRUD handler returns a Future,
but ServiceCatalogTrait is still sync. Until the legacy server emitter
(rust_rpc.rs::generate_handler_trait) gains async-trait support, bridge
through a single tokio::task::block_in_place + Handle::block_on helper
so the existing list / get_by_name / list_by_interface / service_exists
sites keep compiling. The bridge is safe on the multi-thread runtime
that hero_rpc2's register_async_method dispatches onto.

lhumina_code/hero_rpc#131
Snapshot the post-codegen tests/Cargo.toml so the new greeter (5 tests)
and ServiceCatalog (9 tests, was 7) test binaries are picked up by
cargo. The build.rs sync step keeps these in lockstep automatically —
committed so a fresh clone has the same shape as a post-build tree.

lhumina_code/hero_rpc#131
timur merged commit 91baeb0258 into development 2026-05-22 14:37:04 +00:00
timur deleted branch methods-only-canary 2026-05-22 14:37:04 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lhumina_code/hero_service!11
No description provided.