Move Python client generation from hero_router to hero_rpc (build-time, authoritative) #31
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#31
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?
Problem
Python clients are generated by hero_router at runtime from each service's
rpc.discoverresponse. This:.oschemaat build time. Python alone is generated from runtime discovery. When the running server has a stale cached spec, the Python client is stale — exactly thehero_logic_client.pybug diagnosed in #29.Proposal
Move Python client generation into hero_rpc's build-time pipeline. Each service's
.oschemaproduces a Python client file alongside its Rust types, OpenRPC spec, and JS client. The generated file is committed to each service's repo (same model as the other artifacts today).hero_router retains interface-stub generation as a runtime concern — see #companion issue. Interface stubs are LLM-context-window summaries of live discovered services; that IS a runtime-discovery product, not a build-time one.
What moves
hero_router/crates/hero_router/src/python_codegen.rs→hero_rpc/crates/generator/src/python/rpc.discover-at-runtime to.oschema-at-build-time, same as Rust/OpenRPC/JS todaybuild.rsgains Python output to itsgenerated/python/directoryWhat stays
~/.hero/var/router/python/— just no longer generates them, only copiesFallback: runtime codegen for unknown services
For services discovered at runtime that weren't part of the build (e.g. third-party Hero services added later), hero_router can fall back to runtime generation using its existing code path as a last resort. Common case (Hero-workspace services) becomes fast + correct; exotic case still works.
Migration
build.rsto emit Python client togenerated/python/python_codegen.rsbecomes a thin "read-generated-file + copy-to-staging-dir" module, with runtime codegen kept only as the unknown-service fallbackhero_logic_client.pyhasplay_start,workflow_version_fetch,workflow_clone,example_to_input_data, etc. — and is guaranteed to match the running server because it was built from the same.oschemaNon-goals
Related