walkthrough: drop redundant sid + wire python sdk + gate types_wasm #111

Merged
timur merged 1 commit from walkthrough-clean-demo into development 2026-05-21 11:59:06 +00:00
Owner

Three issues the maintainer caught after #110:

1. Drop sid / created_at from 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 .oschema source 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 just Greeting = { name, message }. The doc-comment is tightened to make the rule clear.

2. Add .with_python_sdk() to the walkthrough config

Was missing. The demo dir now contains sdk/python/hero_demo_sdk/ + pyproject.toml alongside the Rust / JS / Rhai SDKs.

3. Drop types_wasm.rs from the demo (and gate it project-wide)

types_wasm.rs was emitted unconditionally by rust_types.rs:93 regardless of the OschemaBuildConfig::generate_wasm flag — the flag's check in build/emit/domain.rs was 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:

  • Add generate_wasm: bool field to Generator.
  • Add Generator::wasm() setter.
  • Gate the wasm-types emission in rust_types.rs:93 on self.generate_wasm.
  • Wire OschemaBuildConfig::generate_wasm → Generator::wasm() in build/emit/domain.rs:121 (was a stubbed no-op).

The downstream pub mod types_wasm; + cfg-gated re-exports in both generated/mod.rs and the parent mod.rs were already conditional on has_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 existing types_wasm.rs + cfg-gated wasm32 re-exports keep working. New services (and the walkthrough) get the cleaner default.

4. Step 6 socket moved to /tmp

Unix 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 /tmp is implicitly gitignored.

Verified

  • 138/138 generator unit tests pass.
  • cargo run --example 01_walkthrough completes all six steps.
  • Demo tree contains sdk/{rust,python,js,rhai}/ but no types_wasm.rs.
  • Core types.rs shows auto-injected sid / created_at / updated_at for a schema that doesn't declare them.
  • Step 6 typed-client calls round-trip cleanly.
Three issues the maintainer caught after #110: ## 1. Drop `sid` / `created_at` from 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 `.oschema` source 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 just `Greeting = { name, message }`. The doc-comment is tightened to make the rule clear. ## 2. Add `.with_python_sdk()` to the walkthrough config Was missing. The demo dir now contains `sdk/python/hero_demo_sdk/` + `pyproject.toml` alongside the Rust / JS / Rhai SDKs. ## 3. Drop `types_wasm.rs` from the demo (and gate it project-wide) `types_wasm.rs` was emitted *unconditionally* by `rust_types.rs:93` regardless of the `OschemaBuildConfig::generate_wasm` flag — the flag's check in `build/emit/domain.rs` was 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: - Add `generate_wasm: bool` field to `Generator`. - Add `Generator::wasm()` setter. - Gate the wasm-types emission in `rust_types.rs:93` on `self.generate_wasm`. - Wire `OschemaBuildConfig::generate_wasm → Generator::wasm()` in `build/emit/domain.rs:121` (was a stubbed no-op). The downstream `pub mod types_wasm;` + cfg-gated re-exports in both `generated/mod.rs` and the parent `mod.rs` were already conditional on `has_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 existing `types_wasm.rs` + cfg-gated wasm32 re-exports keep working. New services (and the walkthrough) get the cleaner default. ## 4. Step 6 socket moved to `/tmp` Unix 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 `/tmp` is implicitly gitignored. ## Verified - [x] 138/138 generator unit tests pass. - [x] `cargo run --example 01_walkthrough` completes all six steps. - [x] Demo tree contains `sdk/{rust,python,js,rhai}/` but no `types_wasm.rs`. - [x] Core `types.rs` shows auto-injected `sid` / `created_at` / `updated_at` for a schema that doesn't declare them. - [x] Step 6 typed-client calls round-trip cleanly.
walkthrough: drop redundant sid + wire python sdk + gate types_wasm
Some checks failed
Test / test (push) Failing after 2m16s
Test / test (pull_request) Failing after 2m17s
f82825c5e3
Three issues the maintainer caught after #110:

## 1. Drop `sid` / `created_at` from 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 `.oschema` source was redundant and contradicted
the rule we 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 just `Greeting = { name, message }`. The doc-comment is tightened
to make the rule clear: don't declare them.

## 2. Add `.with_python_sdk()` to the walkthrough config

Was missing. The demo dir now contains `sdk/python/hero_demo_sdk/` +
`pyproject.toml` alongside the Rust / JS / Rhai SDKs.

## 3. Drop `types_wasm.rs` from the demo (and gate it project-wide)

`types_wasm.rs` was emitted *unconditionally* by `rust_types.rs:93`
regardless of the `OschemaBuildConfig::generate_wasm` flag — the
flag's check in `build/emit/domain.rs` was a no-op TODO marker. So
every codegen run produced a second copy of the types in a dep-free
shape, mostly dead weight for services that don't ship a Dioxus /
wasm32 frontend (the typed SDK side already inlines its own
self-contained types per #74).

Fix:

- Add `generate_wasm: bool` field to `Generator` (initialized false in
  both `from_dir` + `from_source`).
- Add `Generator::wasm()` setter.
- Gate the wasm-types emission in `rust_types.rs:93` on
  `self.generate_wasm`.
- Wire `OschemaBuildConfig::generate_wasm → Generator::wasm()` in
  `build/emit/domain.rs:121` (was previously a stubbed no-op).

The downstream cfg-gated `pub mod types_wasm;` + `pub use ::types_wasm::*;`
emissions in both `generated/mod.rs` and the parent `mod.rs` were
already gated on `has_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 existing
`types_wasm.rs` + cfg-gated wasm32 re-exports keep working. New
services (and the walkthrough) get the cleaner default.

## 4. Step 6 socket moved to /tmp

Unix 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…/`).
The socket now binds at `/tmp/hero-walkthrough-<pid>.sock` — short,
collision-safe across concurrent runs, and `/tmp` is implicitly
gitignored.

## Verified

- 138/138 generator unit tests pass.
- `cargo run --example 01_walkthrough` completes all six steps; demo
  tree contains `sdk/{rust,python,js,rhai}/` but no `types_wasm.rs`;
  core `types.rs` shows the auto-injected sid/created_at/updated_at
  fields for a schema that doesn't declare them; step 6 client calls
  round-trip cleanly.
timur merged commit 84189c4401 into development 2026-05-21 11:59:06 +00:00
timur deleted branch walkthrough-clean-demo 2026-05-21 11:59:09 +00:00
Sign in to join this conversation.
No reviewers
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_rpc!111
No description provided.