Generator: rpc.rs use super::*; does not propagate OTime / OCur / OLocation / OAddress imports from rpc_generated.rs #120

Closed
opened 2026-05-21 23:17:37 +00:00 by mik-tf · 0 comments
Owner

Problem

The generated rpc.rs file's *ServiceTrait impl blocks reference OTime (and the other otoml::* types) in their method signatures, but rpc.rs itself has no use hero_rpc_osis::otoml::*; import. The only access path is through use super::*; (or pub use super::rpc_generated::*;), which re-exports items DECLARED in rpc_generated.rs but NOT items merely imported into it.

In crates/generator/src/rust/rust_rpc.rs:65 the OTime import is emitted into one file:

output.push_str("use hero_rpc_osis::otoml::{OTime, OCur, OLocation, OAddress};\n");

The corresponding emitter for rpc.rs (line ~734) emits use super::*; which doesn't pick up the import because rpc_generated.rs uses a non-pub use statement.

Symptom

When a consumer writes impl PersonServiceTrait for PersonServiceHandler { fn register(..., kyc_verified_at: OTime) ... } in rpc.rs, rustc emits:

error[E0412]: cannot find type `OTime` in this scope

Workarounds

  1. Add use hero_rpc_osis::otoml::OTime; manually to rpc.rs (lost on regen — but rpc.rs is preserved so the patch stays once applied).
  2. Fully qualify every OTime mention as hero_rpc_osis::otoml::OTime in the trait body.

The partners_gateway consumer at forge.ourworld.tf/znzfreezone_code/znzfreezone_partners_gateway uses option 2 in its s157 wire-up (crates/partners_gateway_oschema/src/external_api/rpc.rs).

Suggested fix

Either:

  • Change rpc_generated.rs emitter so the otoml imports become pub use, so use super::*; in rpc.rs propagates them; OR
  • Have the rpc.rs emitter (rust_rpc.rs:734-738) also emit use hero_rpc_osis::otoml::{OTime, OCur, OLocation, OAddress}; directly when any service-method signature references an otoml type.

The first option is smaller and works regardless of which methods reference otoml types.

Repro

Any OSchema with a service method that takes or returns a non-primitive otoml type (otime, ocur, etc.) and a generator pin at 5408d78 (current HEAD).

Found by

znzfreezone_partners_gateway s157 (2026-05-21) while wiring B-1b skinny-trait dispatch through generator-emitted *ServiceTrait impls.

## Problem The generated `rpc.rs` file's `*ServiceTrait` impl blocks reference `OTime` (and the other `otoml::*` types) in their method signatures, but `rpc.rs` itself has no `use hero_rpc_osis::otoml::*;` import. The only access path is through `use super::*;` (or `pub use super::rpc_generated::*;`), which re-exports items DECLARED in `rpc_generated.rs` but NOT items merely imported into it. In `crates/generator/src/rust/rust_rpc.rs:65` the OTime import is emitted into one file: ```rust output.push_str("use hero_rpc_osis::otoml::{OTime, OCur, OLocation, OAddress};\n"); ``` The corresponding emitter for `rpc.rs` (line ~734) emits `use super::*;` which doesn't pick up the import because `rpc_generated.rs` uses a non-`pub` `use` statement. ## Symptom When a consumer writes `impl PersonServiceTrait for PersonServiceHandler { fn register(..., kyc_verified_at: OTime) ... }` in `rpc.rs`, rustc emits: ``` error[E0412]: cannot find type `OTime` in this scope ``` ## Workarounds 1. Add `use hero_rpc_osis::otoml::OTime;` manually to `rpc.rs` (lost on regen — but `rpc.rs` is preserved so the patch stays once applied). 2. Fully qualify every `OTime` mention as `hero_rpc_osis::otoml::OTime` in the trait body. The `partners_gateway` consumer at `forge.ourworld.tf/znzfreezone_code/znzfreezone_partners_gateway` uses option 2 in its s157 wire-up (`crates/partners_gateway_oschema/src/external_api/rpc.rs`). ## Suggested fix Either: - Change `rpc_generated.rs` emitter so the `otoml` imports become `pub use`, so `use super::*;` in `rpc.rs` propagates them; OR - Have the `rpc.rs` emitter (rust_rpc.rs:734-738) also emit `use hero_rpc_osis::otoml::{OTime, OCur, OLocation, OAddress};` directly when any service-method signature references an otoml type. The first option is smaller and works regardless of which methods reference otoml types. ## Repro Any OSchema with a service method that takes or returns a non-primitive otoml type (`otime`, `ocur`, etc.) and a generator pin at `5408d78` (current HEAD). ## Found by `znzfreezone_partners_gateway` s157 (2026-05-21) while wiring `B-1b` skinny-trait dispatch through generator-emitted `*ServiceTrait` impls.
timur closed this issue 2026-05-22 10:16:37 +00:00
Sign in to join this conversation.
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_blueprint#120
No description provided.