hero_rpc#122 Phase 2: regen template against current hero_rpc + bench schema #7

Merged
timur merged 2 commits from issue-122-template-revalidation into development 2026-05-22 07:43:13 +00:00
Owner

Summary

Closes hero_rpc#122 Phase 2 (Phases 1, 3, 4 land in
lhumina_code/hero_rpc#125).

Migrates the canonical "clone-me" Hero service template onto the
post-#114 / #117 / #119 scaffolder layout and adds the four
benchmark rootobjects (IndexedNone, IndexedSingle, IndexedMulti,
IndexedNonStr) that motivate the index-integration follow-up
(hero_rpc#123).

Layout change

Before After Why
crates/hero_service_sdk/ sdk/rust/ (workspace member) hero_rpc#70 — unified sdk/ tree
crates/hero_service_rhai/ sdk/rhai/ (workspace member) hero_rpc#70
(none) sdk/python/, sdk/js/ hero_rpc#70 — emitted whole
(none) crates/hero_service_web/ hero_rpc#98 — public read-only web crate
(none) tests/ (workspace-root E2E) hero_rpc#115 — per-rootobject e2e tests
crates/hero_service_examples/ removed hero_rpc#116 — dropped per-service _examples placeholder

Codegen

  • All hand-written tracked files regenerated by the current scaffolder + OSchema codegen.
  • types_wasm.rs removed (hero_rpc#114 dropped the wasm twin).
  • build.rs uses the simplified config (no .with_wasm()).
  • SDK lib.rs exposes pub mod generated; pub use generated::*;.

New bench domain

schemas/bench/bench.oschema defines four rootobjects with
deliberately matched field shapes so indexed-vs-full-scan comparisons
stay apples-to-apples:

IndexedNone     — no @index (baseline)
IndexedSingle   — title: str @index
IndexedMulti    — title: str @index, category: BenchCategory @index
IndexedNonStr   — priority: u32 @index

Each rootobject's generated OsisObject::indexed_field_names()
verified after codegen.

Server lifecycle

  • main.rs regenerated to register both domains
    (#[cfg(feature = "catalog")] + #[cfg(feature = "bench")]
    blocks).
  • crates/hero_service_server/src/catalog/rpc.rs preserved
    exactly
    — contains the mocked bootstrap / refactor /
    check / verify handlers that survive the regen unchanged.
  • tests/src/lib.rs::spin_up_service registers both domains on the
    same RpcModule, mirroring main.rs. The duplication between
    the two is documented in
    hero_rpc#124's
    follow-up.

Acceptance criteria

From hero_rpc#122 Phase 1 + Phase 2 + Phase 4:

  • Regenerated cleanly via hero_rpc_generator --name hero_service.
  • cargo build --workspace clean, zero warnings (verified locally).
  • cargo test --workspace — 5 e2e tests pass
    (indexed_multi / indexed_non_str / indexed_none / indexed_single /
    service_definition full_lifecycle), plus all unit tests across
    every crate.
  • All four bench rootobjects expose the correct
    indexed_field_names() after regen.
  • No co-author trailers (per feedback_commit_attribution.md).

Acceptance items not in scope of this PR (documented as follow-ups):

  • lab service hero_service --install --start lifecycle — works
    locally; CI can't drive it from cargo. Verified manually.
  • Python / JS SDK round-trip — the codegen emits both trees,
    Rust + Rhai SDKs are exercised by the e2e tests; full
    Python/JS round-trip is a separate verification task.

Decisions taken without confirmation

  • tests/src/lib.rs hand-rolls the multi-domain registration ladder. The scaffolder template only knows the single-domain shape; rather than block this PR on extracting a MultiDomainBuilder, the hand-rolled lib.rs ships now and the cleanup is scoped to hero_rpc#124.
  • Existing schema layout preserved. schemas/catalog/catalog.oschema was unchanged from the prior commit (the ServiceDefinition rootobject with name @index). New rootobjects live under schemas/bench/, separate from the catalog meta-service.
  • No new admin handler implementations. The new IndexedMulti / etc. rootobjects expose only the auto-generated CRUD shape; no _trigger_save_pre hooks were customised.

Depends on

hero_rpc#125 must merge first so this PR's Cargo.toml git deps (branch = "development") resolve the codegen fixes. CI build of this PR is expected to fail until hero_rpc#125 is merged — re-running CI after that point should turn green.

Follow-ups not done here

  • hero_rpc#123 — wire find_* through hero_indexer with typed <RootObject>FindParams. Drives the ~90× gap the benchmark surfaced.
  • hero_rpc#124 — collapse the spin_up_service duplication into a MultiDomainBuilder and ship Layer-2/3 nushell scripts per tests_pyramid.

Test plan

  • PATH_ROOT=… cargo build --workspace clean.
  • PATH_ROOT=… cargo test --workspace clean (5 e2e + all unit).
  • hero_rpc_generator --name hero_service over the existing
    schemas/ reproduces the committed layout.
  • CI build after hero_rpc#125 lands.

🤖 Generated with Claude Code

## Summary Closes hero_rpc#122 Phase 2 (Phases 1, 3, 4 land in [lhumina_code/hero_rpc#125](https://forge.ourworld.tf/lhumina_code/hero_rpc/pulls/125)). Migrates the canonical "clone-me" Hero service template onto the post-#114 / #117 / #119 scaffolder layout and adds the four benchmark rootobjects (`IndexedNone`, `IndexedSingle`, `IndexedMulti`, `IndexedNonStr`) that motivate the index-integration follow-up ([hero_rpc#123](https://forge.ourworld.tf/lhumina_code/hero_rpc/issues/123)). ## Layout change | Before | After | Why | |--------|-------|-----| | `crates/hero_service_sdk/` | `sdk/rust/` (workspace member) | hero_rpc#70 — unified `sdk/` tree | | `crates/hero_service_rhai/` | `sdk/rhai/` (workspace member) | hero_rpc#70 | | (none) | `sdk/python/`, `sdk/js/` | hero_rpc#70 — emitted whole | | (none) | `crates/hero_service_web/` | hero_rpc#98 — public read-only web crate | | (none) | `tests/` (workspace-root E2E) | hero_rpc#115 — per-rootobject e2e tests | | `crates/hero_service_examples/` | removed | hero_rpc#116 — dropped per-service `_examples` placeholder | ## Codegen - All hand-written tracked files regenerated by the current scaffolder + OSchema codegen. - `types_wasm.rs` removed (hero_rpc#114 dropped the wasm twin). - `build.rs` uses the simplified config (no `.with_wasm()`). - SDK `lib.rs` exposes `pub mod generated; pub use generated::*;`. ## New `bench` domain `schemas/bench/bench.oschema` defines four rootobjects with deliberately matched field shapes so indexed-vs-full-scan comparisons stay apples-to-apples: ``` IndexedNone — no @index (baseline) IndexedSingle — title: str @index IndexedMulti — title: str @index, category: BenchCategory @index IndexedNonStr — priority: u32 @index ``` Each rootobject's generated `OsisObject::indexed_field_names()` verified after codegen. ## Server lifecycle - `main.rs` regenerated to register both domains (`#[cfg(feature = "catalog")]` + `#[cfg(feature = "bench")]` blocks). - `crates/hero_service_server/src/catalog/rpc.rs` **preserved exactly** — contains the mocked `bootstrap` / `refactor` / `check` / `verify` handlers that survive the regen unchanged. - `tests/src/lib.rs::spin_up_service` registers both domains on the same `RpcModule`, mirroring `main.rs`. The duplication between the two is documented in [hero_rpc#124](https://forge.ourworld.tf/lhumina_code/hero_rpc/issues/124)'s follow-up. ## Acceptance criteria From hero_rpc#122 Phase 1 + Phase 2 + Phase 4: - [x] Regenerated cleanly via `hero_rpc_generator --name hero_service`. - [x] `cargo build --workspace` clean, zero warnings (verified locally). - [x] `cargo test --workspace` — 5 e2e tests pass (indexed_multi / indexed_non_str / indexed_none / indexed_single / service_definition full_lifecycle), plus all unit tests across every crate. - [x] All four bench rootobjects expose the correct `indexed_field_names()` after regen. - [x] No co-author trailers (per `feedback_commit_attribution.md`). Acceptance items not in scope of this PR (documented as follow-ups): - [ ] `lab service hero_service --install --start` lifecycle — works locally; CI can't drive it from cargo. Verified manually. - [ ] Python / JS SDK round-trip — the codegen emits both trees, Rust + Rhai SDKs are exercised by the e2e tests; full Python/JS round-trip is a separate verification task. ## Decisions taken without confirmation - **`tests/src/lib.rs` hand-rolls the multi-domain registration ladder.** The scaffolder template only knows the single-domain shape; rather than block this PR on extracting a `MultiDomainBuilder`, the hand-rolled lib.rs ships now and the cleanup is scoped to hero_rpc#124. - **Existing schema layout preserved.** `schemas/catalog/catalog.oschema` was unchanged from the prior commit (the `ServiceDefinition` rootobject with `name @index`). New rootobjects live under `schemas/bench/`, separate from the catalog meta-service. - **No new admin handler implementations.** The new `IndexedMulti` / etc. rootobjects expose only the auto-generated CRUD shape; no `_trigger_save_pre` hooks were customised. ## Depends on [hero_rpc#125](https://forge.ourworld.tf/lhumina_code/hero_rpc/pulls/125) must merge first so this PR's `Cargo.toml` git deps (`branch = "development"`) resolve the codegen fixes. CI build of this PR is expected to fail until hero_rpc#125 is merged — re-running CI after that point should turn green. ## Follow-ups not done here - [hero_rpc#123](https://forge.ourworld.tf/lhumina_code/hero_rpc/issues/123) — wire `find_*` through `hero_indexer` with typed `<RootObject>FindParams`. Drives the ~90× gap the benchmark surfaced. - [hero_rpc#124](https://forge.ourworld.tf/lhumina_code/hero_rpc/issues/124) — collapse the `spin_up_service` duplication into a `MultiDomainBuilder` and ship Layer-2/3 nushell scripts per `tests_pyramid`. ## Test plan - [x] `PATH_ROOT=… cargo build --workspace` clean. - [x] `PATH_ROOT=… cargo test --workspace` clean (5 e2e + all unit). - [x] `hero_rpc_generator --name hero_service` over the existing `schemas/` reproduces the committed layout. - [ ] CI build after hero_rpc#125 lands. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Migrates the canonical "clone-me" Hero service template onto the
post-#114/#117/#119 scaffolder layout and adds the four benchmark
rootobjects that motivate the index integration follow-up
(hero_rpc#123).

Layout:

- crates/hero_service_sdk/  → sdk/rust/             (hero_rpc#70)
- crates/hero_service_rhai/ → sdk/rhai/             (hero_rpc#70)
- + sdk/python/, sdk/js/    (generated)
- + crates/hero_service_web/                        (hero_rpc#98)
- + tests/  (workspace-root E2E tests)              (hero_rpc#115)
- crates/hero_service_examples/ — removed           (hero_rpc#116)

Codegen:

- All hand-written tracked files re-emitted by the current scaffolder
  + OSchema codegen. types_wasm.rs gone, build.rs uses the simplified
  config (no .with_wasm()), SDK `lib.rs` exposes
  `pub mod generated; pub use generated::*;`.
- The new `bench` domain (`schemas/bench/bench.oschema`) defines four
  rootobjects with matched field shapes — `IndexedNone`,
  `IndexedSingle`, `IndexedMulti`, `IndexedNonStr` — covering the
  no-index / single-str / multi-field / non-str-index annotation
  variants. Each one's `OsisObject::indexed_field_names()` was
  verified after codegen.
- `tests/src/lib.rs::spin_up_service` registers both `OsisCatalog`
  and `OsisBench` on a single `RpcModule`, mirroring the production
  main.rs. The duplication between this and `main.rs` is documented
  in hero_rpc#124's follow-up.

Server lifecycle:

- `main.rs` regenerated to cover both domains
  (`#[cfg(feature = "catalog")]` + `#[cfg(feature = "bench")]`
   register blocks).
- `crates/hero_service_server/src/catalog/rpc.rs` preserved exactly —
  contained mocked `bootstrap` / `refactor` / `check` / `verify`
  handlers that survive the regen unchanged.

Tests:

- `cargo test --workspace`: 5 e2e tests pass
  (indexed_multi / indexed_non_str / indexed_none / indexed_single /
  service_definition full_lifecycle), plus all unit tests across
  every crate.

Depends on hero_rpc#122 PR. Cargo.lock pinned to the merged commit
before merging.
timur merged commit a2598993ec into development 2026-05-22 07:43:13 +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!7
No description provided.