Extend hero_rpc#133's async conversion to service-method handlers — close the codegen gap #137
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#137
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
Extend hero_rpc#133's async conversion to service-method handlers. #133 converted the CRUD handler emitter to
async fnand removedspawn_blockingaround CRUD dispatch. It did not touch the service-method handler emitter — that one still emits syncfn. The result: any service-method handler that needs to call async code (the indexer, another service, an HTTP API) must re-introduce ablock_in_place+block_onbridge inside the handler body.This was exposed by hero_rpc#134 (which closed #131 and added generated E2E tests for
serviceblock methods) — the regeneratedcatalog/rpc.rsin hero_service had to addtokio::task::block_in_place(|| Handle::current().block_on(...))to call async code from a sync service-method handler. That's exactly the pattern #133 was supposed to eliminate.What's broken today
What we want
Zero sync↔async bridges anywhere inside any generated handler.
What to change
crates/generator/src/rust/rust_osis.rsor wherever else service handler stubs are produced) emitasync fninstead offn. Return types should be wrapped to indicateimpl Future + Sendvia RPITIT, matching the pattern already used byOsisAppRpcHandler(the CRUD handler trait).crates/osis/src/rpc/server.rs— there are stillspawn_blockingwrappers around service-method dispatch at lines ~1443, ~1920 from the #133 work which intentionally kept them for sync user handlers), switch to direct.awaitonce the trait surface is async.async fnand drop anyblock_in_placeworkarounds.Prerequisites
None. Stacks on top of #133 (merged).
Acceptance criteria
grep -rn "block_in_place\|block_on" hero_service/crates/<svc>_server/src/returns no occurrences inside generated or hand-written handler bodies (legitimate uses elsewhere, e.g. in test fixtures, are fine).grep -rn "spawn_blocking" hero_rpc/crates/osis/src/rpc/returns no occurrences around service-method dispatch (CRUD dispatch was already cleaned in #133).cargo test -p hero_rpc_osisclean.lab service hero_service --testruns all five layers green.Out of scope
block_in_placeworkaround in hero_service'scatalog/rpc.rsfrom #134 — it gets removed automatically once this issue lands and hero_service regenerates.Links
Closeout — both PRs merged.
5d0abe7— generator emitsasync fnfor service-method handlers; OSIS dispatch dropsspawn_blockingaround service-method calls.bridge_synchelper +block_in_placeworkaround #11 had to add; catalog + greeter handler impls converted toasync fn. Zero sync↔async crossings in any handler body.Architectural state of meta hero_skills#262: both halves of the OSIS async conversion (CRUD via #133, service-method via #137) are landed. The codegen story is consistent — generated handler stubs are async by default.
Runtime validation via
lab service hero_service --testis pending an orthogonallabtohero_serviceephemeral-launch interplay issue (installed binary fails silently when spawned bylab --ephemeral). Filed as a separate follow-up; not in scope for this issue.Next: hero_rpc#132's first sub-issue (hero_indexer migration to oschema codegen) is now unblocked.