walkthrough: drop redundant sid + wire python sdk + gate types_wasm #111
No reviewers
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!111
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "walkthrough-clean-demo"
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?
Three issues the maintainer caught after #110:
1. Drop
sid/created_atfrom the demo schema[rootobject]is the only signal — the codegen auto-injects the three server-managed base fields (sid/created_at/updated_at) into every rootobject's generated Rust struct + OpenRPC schema. Declaring them in the.oschemasource was redundant and contradicted the rule tightened in #108.The Rust struct emitter (
rust_struct.rs:370) already auto-injects + explicitly skips re-declared variants, so the walkthrough's schema is now justGreeting = { name, message }. The doc-comment is tightened to make the rule clear.2. Add
.with_python_sdk()to the walkthrough configWas missing. The demo dir now contains
sdk/python/hero_demo_sdk/+pyproject.tomlalongside the Rust / JS / Rhai SDKs.3. Drop
types_wasm.rsfrom the demo (and gate it project-wide)types_wasm.rswas emitted unconditionally byrust_types.rs:93regardless of theOschemaBuildConfig::generate_wasmflag — the flag's check inbuild/emit/domain.rswas a no-op TODO marker. Result: every codegen run produced a second copy of the types in a dep-free shape, mostly dead weight for services without a Dioxus / wasm32 frontend (the typed SDK side already inlines its own self-contained types per #74).Fix:
generate_wasm: boolfield toGenerator.Generator::wasm()setter.rust_types.rs:93onself.generate_wasm.OschemaBuildConfig::generate_wasm → Generator::wasm()inbuild/emit/domain.rs:121(was a stubbed no-op).The downstream
pub mod types_wasm;+ cfg-gated re-exports in bothgenerated/mod.rsand the parentmod.rswere already conditional onhas_wasm_types, so they correctly skip when wasm isn't emitted — no further changes needed there. recipe_server's build.rs still has.with_wasm(), so its existingtypes_wasm.rs+ cfg-gated wasm32 re-exports keep working. New services (and the walkthrough) get the cleaner default.4. Step 6 socket moved to
/tmpUnix socket paths have a ~104-char SUN_LEN limit on macOS, and the repo-relative path overflows it on most checkouts (the demo dir is now at
<repo>/examples/walkthrough_demo/instead of/tmp/.tmp…/). Socket now binds at/tmp/hero-walkthrough-<pid>.sock— short, collision-safe, and/tmpis implicitly gitignored.Verified
cargo run --example 01_walkthroughcompletes all six steps.sdk/{rust,python,js,rhai}/but notypes_wasm.rs.types.rsshows auto-injectedsid/created_at/updated_atfor a schema that doesn't declare them.