Generated Python clients omit service methods — only rootobject CRUD is surfaced #29
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#29
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
The Python clients auto-generated by hero_router (via
router.python_client, backed by hero_rpc's generator) only emit CRUD methods for OSIS rootobjects. Custom methods declared on aservicein the .oschema are dropped.Concrete example —
hero_logichero_logicdeclares ~30 custom methods onLogicService(seecrates/hero_logic/schemas/logic/logic.oschema):play_start,play_status,workflow_version_fetch,workflow_clone,workflow_from_template,example_to_input_data,benchmark_list_for_version,pick_version,node_logs,node_retry, etc.The generated client
~/.hero/var/router/python/hero_logic_client.pyhas 48 methods, all CRUD:workflow_list,workflow_get,workflow_set,workflow_delete,workflow_find,workflow_existsplay,workflowversion,example,benchmarklogicservice_list/_get/_set/... (meta-CRUD on the service record itself)Zero of the actual LogicService trait methods are present.
grep 'play_start\|workflow_clone\|workflow_from_template' ~/.hero/var/router/python/hero_logic_client.py→ empty.Impact
Every flow script in hero_logic (and every external caller wanting to drive a play from Python) has to hand-roll JSON-RPC over a raw Unix domain socket. The
e2e_ux_test_flow.json,whiteboard_smoke_test_flow.json,benchmark_flow.json,optimize_flow.jsontemplates all contain 30-60 lines of identicalhttp.client.HTTPConnection+ socket plumbing per Python node just to callplay_start/play_status. The auto-generated client is technically present, but useless for anything except OSIS CRUD, so nobody imports it.Expected behavior
HeroLogicClientshould expose every service method declared in the .oschema. For example:Instead of ~60 lines of http/socket plumbing.
Likely cause
Check
crates/generator/src/python/— the service-method generation branch probably exists for Rust clients but was never extended to Python (or it's there but only matches a specific method annotation thatLogicServicemethods lack).The OpenRPC spec at
src/logic/core/openrpc.jsonDOES contain the LogicService methods (verified:jq '.methods | map(.name) | .[]' < openrpc.json | grep LogicServicereturns all 30+). So the input is complete — the output emission is what's missing.Scope / definition of done
*_client.pyexposes every method from the OpenRPC spec, not just{object}_{crud}shapes..description.hero_logic_client.pyand verify it now containsplay_start,play_status,workflow_clone,workflow_version_fetch, etc.hero_logic/templates/*.jsoncan be rewritten tofrom hero_logic_client import HeroLogicClientinstead of the raw-socket pattern. Size comparison in the PR description.Why this matters
As hero_logic flows grow (the current 6 built-in flows, plus every user-authored flow), every Python action script repeats the same 30-line boilerplate. This also gates any future work that lets users author flows as single scripts ("Level 2" in the companion architecture discussion — making linear procedural flows feel Python-native instead of DAG-shaped).
Consumers outside hero_logic are also affected: any external Python caller of hero_logic's play API today either skips the generated client or writes their own JSON-RPC shim.
Related
Tactical fix up for review in hero_router (the Python generator lives there, not in hero_rpc — the issue's "Likely cause" pointer was off): lhumina_code/hero_router#40
That PR:
LogicService.play_start→play_startin the generated client..descriptionover.summaryfor docstrings (matches hero_rpc's oschema generator output).examples/regen_python_clienthelper and uses it to regenerate~/.hero/var/router/python/hero_logic_client.pyfromhero_logic/crates/hero_logic/src/logic/core/openrpc.json— DoD grepplay_start|workflow_clone|workflow_version_fetchnow matches.Deliberately not in scope there (confirmed with instructions):
hero_logic/templates/*.jsonflow templates — those are being deleted wholesale inhero_logic#13.hero_rpc#31.rpc.discovercache drift — separate PR, tracked inhero_rpc#32. Until hero_logic is rebuilt or that lands, the runtime path (router.python_clientagainst the live socket) still returns the CRUD-only client; the regenerated file confirms the generator fix itself is correct.Will close this issue when hero_router#40 merges.
Landed in hero_router@31ec54cd (via hero_router#40). The tactical generator fix is live on
development:play_start,workflow_clone, …), notLogicService_*.description(falling back tosummary), so oschema-authored comments reach the generated client.cargo run --example regen_python_client -- --spec <openrpc.json> --service <name>regenerates a service's cached Python files without rebuilding the backing binary.Follow-ups still open:
hero_rpc#31— move Python codegen to hero_rpc (architecturally-right home).hero_rpc#32— fix stale-cache drift on liverpc.discoverso the runtime pipeline matches the static-spec pipeline used for verification here.Closing this issue.